diff --git a/.appveyor.yml b/.appveyor.yml index b99fa11e..48e012bc 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -17,16 +17,16 @@ init: - ps: Write-Host "[+] Location of Bash ..." - ps: Get-Command -Name 'bash' - # Verify NPM - - ps: Write-Host "[+] Location of NPM ..." - - ps: Get-Command -Name 'npm' + # Verify yarn + - ps: Write-Host "[+] Location of yarn ..." + - ps: Get-Command -Name 'yarn' # Verify software versions - ps: Write-Host "[+] Verifying software verisons ..." - sh --version - bash --version - node --version - - npm --version + - yarn --version # # Python version will show "2.7" below, which is required to keep @@ -72,8 +72,8 @@ install: - ps: Get-Location - bash -e -l -c "cd $APPVEYOR_BUILD_FOLDER && ls -alh" - # Install NPM modules - - bash -e -l -c "cd $APPVEYOR_BUILD_FOLDER && npm install" + # Install yarn modules + - bash -e -l -c "cd $APPVEYOR_BUILD_FOLDER && yarn install" build_script: # Add Python-3.6 to %PATH% @@ -101,8 +101,8 @@ build_script: - ps: Write-Host "[+] Current directory under Bash ..." - bash -e -l -c "cd $APPVEYOR_BUILD_FOLDER && ls -alh" - - ps: Write-Host "[+] Starting 'npm run build' ..." - - bash -e -l -c "cd $APPVEYOR_BUILD_FOLDER && export PYINSTALLER=1 && npm run build" + - ps: Write-Host "[+] Starting 'yarn run build' ..." + - bash -e -l -c "cd $APPVEYOR_BUILD_FOLDER && export PYINSTALLER=1 && yarn run build" test_script: # Add Python-3.6 to %PATH% @@ -130,5 +130,5 @@ test_script: - ps: Write-Host "[+] Current directory under Bash ..." - bash -e -l -c "cd $APPVEYOR_BUILD_FOLDER && ls -alh" - - ps: Write-Host "[+] Starting 'npm run test' ..." - - bash -e -l -c "cd $APPVEYOR_BUILD_FOLDER && export PYINSTALLER=1 && npm run test" + - ps: Write-Host "[+] Starting 'yarn run test' ..." + - bash -e -l -c "cd $APPVEYOR_BUILD_FOLDER && export PYINSTALLER=1 && yarn run test" diff --git a/.circleci/config.yml b/.circleci/config.yml index bdb95e70..ef77b116 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,12 +6,12 @@ commands: - restore_cache: keys: - dependency-cache-{{ checksum "package.json" }} - - run: npm install + - run: yarn install - save_cache: key: dependency-cache-{{ checksum "package.json" }} paths: - ./node_modules - - run: npm run build + - run: yarn run build jobs: lint: docker: @@ -21,14 +21,14 @@ jobs: - run: sudo apt install -qq shellcheck - commoncmd - run: bash -c 'GLOBIGNORE="node_modules" shellcheck **/*.sh' - - run: npm run lint - - run: bash -c '"$(npm bin)/tslint" --project .' + - run: yarn run lint + - run: bash -c '"$(yarn bin)/tslint" --project .' unit: docker: - image: circleci/node:latest steps: - commoncmd - - run: bash -c '"$(npm bin)/jest" src' + - run: bash -c '"$(yarn bin)/jest" src' e2e: docker: - image: circleci/node:latest-browsers @@ -36,12 +36,12 @@ jobs: MOZ_HEADLESS: 1 steps: - commoncmd - - run: sudo npm i -g get-firefox + - run: sudo yarn i -g get-firefox - run: get-firefox --branch nightly --platform linux --extract --target ~/ - run: ~/firefox/firefox -v - - run: bash -c '"$(npm bin)/web-ext" build --source-dir ./build --overwrite-dest' + - run: bash -c '"$(yarn bin)/web-ext" build --source-dir ./build --overwrite-dest' - run: mv web-ext-artifacts/*.zip web-ext-artifacts/tridactyl.xpi - - run: bash -c 'PATH="$HOME/firefox:$PATH" "$(npm bin)/jest"' + - run: bash -c 'PATH="$HOME/firefox:$PATH" "$(yarn bin)/jest"' workflows: version: 2 build_test_lint: diff --git a/contributing.md b/contributing.md index 7f615dd5..11af3344 100644 --- a/contributing.md +++ b/contributing.md @@ -126,7 +126,7 @@ Here's an example: you're writing the [`native()`](https://github.com/tridactyl/ # Build Process -Building Tridactyl is done with `npm run build`. This makes npm run [scripts/build.sh](https://github.com/tridactyl/tridactyl/blob/master/scripts/build.sh), which performs the following steps: +Building Tridactyl is done with `yarn run build`. This makes yarn run [scripts/build.sh](https://github.com/tridactyl/tridactyl/blob/master/scripts/build.sh), which performs the following steps: - Running the [macro preprocessor](https://github.com/tridactyl/tridactyl/blob/master/scripts/excmds_macros.py) to turn `src/excmds.ts` into `src/.excmds_background.ts` and `src/.excmds_content.ts` (see the "The macros" section for more info). - Running the [metadata-generation](https://github.com/tridactyl/tridactyl/blob/master/compiler/gen_metadata.ts) which just re-injects type information and comment strings into Tridactyl's code in order to make them available to Tridactyl at runtime. It also checks what themes are available at compile time and adds this information to the metadata. @@ -134,7 +134,7 @@ Building Tridactyl is done with `npm run build`. This makes npm run [scripts/bui - Generating the newtab, author and tutorial pages with custom scripts and the documentation using typedoc. - Importing CSS files and embedding resources (other CSS files, base64 pictures) into them wherever they're needed -You can run Tridactyl easily in a temporary Firefox profile with `npm run run`. +You can run Tridactyl easily in a temporary Firefox profile with `yarn run run`. # Code of conduct diff --git a/hooks/post-checkout b/hooks/post-checkout index 39b5d413..b1198053 100755 --- a/hooks/post-checkout +++ b/hooks/post-checkout @@ -10,5 +10,5 @@ file_changed() { } if file_changed package.json; then - npm install + yarn install fi diff --git a/hooks/post-merge b/hooks/post-merge index 729e91a4..52765ed5 100755 --- a/hooks/post-merge +++ b/hooks/post-merge @@ -10,5 +10,5 @@ file_changed() { } if file_changed package.json; then - npm install + yarn install fi diff --git a/hooks/pre-commit b/hooks/pre-commit index bb9d654b..da437bd1 100755 --- a/hooks/pre-commit +++ b/hooks/pre-commit @@ -20,6 +20,6 @@ fi if [ -n "$uglyFiles" ]; then echo "Prettify your files first:" - echo 'npm run pretty' + echo 'yarn run pretty' exit 1 fi diff --git a/package.json b/package.json index bfdc6dba..ef159f0b 100644 --- a/package.json +++ b/package.json @@ -52,8 +52,8 @@ "run": "web-ext run -s build/ -u 'txti.es'", "watch": "echo 'watch is broken, use build instead'; exit 0;", "clean": "rm -rf build generated", - "test": "npm run build && rm -rf web-ext-artifacts/* && web-ext build --source-dir ./build --overwrite-dest && mv web-ext-artifacts/*.zip web-ext-artifacts/tridactyl.xpi && jest --silent", - "update-buildsystem": "rm -rf src/node_modules; npm run clean", + "test": "yarn run build && rm -rf web-ext-artifacts/* && web-ext build --source-dir ./build --overwrite-dest && mv web-ext-artifacts/*.zip web-ext-artifacts/tridactyl.xpi && jest --silent", + "update-buildsystem": "rm -rf src/node_modules; yarn run clean", "lint": "bash hooks/pre-commit", "pretty": "bash scripts/pretty.sh" }, diff --git a/readme.md b/readme.md index 5dc01a02..b1db2d97 100644 --- a/readme.md +++ b/readme.md @@ -231,11 +231,11 @@ Onboarding: ``` git clone https://github.com/tridactyl/tridactyl.git cd tridactyl -npm install -npm run build +yarn install +yarn run build ``` -Each time package.json or package-lock.json change after you checkout or pull, you should run `npm install` again. +Each time package.json or package-lock.json change after you checkout or pull, you should run `yarn install` again. Addon is built in tridactyl/build. Load it as a temporary addon in firefox with `about:debugging` or see [Development loop](#Development-loop). The addon should work in Firefox 52+, but we're only deliberately supporting >=57. @@ -243,9 +243,9 @@ If you want to install a local copy of the add-on into your developer or nightly ``` # Build tridactyl if you haven't done that yet -npm run build +yarn run build # Package for a browser -"$(npm bin)/web-ext" build -s build +"$(yarn bin)/web-ext" build -s build ``` If you want to build a signed copy (e.g. for the non-developer release), you can do that with `web-ext sign`. You'll need some keys for AMO and to edit the application id in `src/manifest.json`. There's a helper script in `scripts/sign` that's used by our build bot and for manual releases. @@ -328,16 +328,16 @@ PS C:\Users\{USERNAME}\.tridactyl> gpg2 --verify .\native_main.exe.sig .\native_ ### Development loop ``` -npm run build & npm run run +yarn run build & yarn run run ``` -You'll need to run `npm run build` every time you edit the files, and press "r" in the `npm run run` window to make sure that the files are properly reloaded. +You'll need to run `yarn run build` every time you edit the files, and press "r" in the `yarn run run` window to make sure that the files are properly reloaded. ### Committing -A pre-commit hook is added by `npm install` that simply runs `npm test`. If you know that your commit doesn't break the tests you can commit with `git commit -n` to ignore the hooks. If you're making a PR, travis will check your build anyway. +A pre-commit hook is added by `yarn install` that simply runs `yarn test`. If you know that your commit doesn't break the tests you can commit with `git commit -n` to ignore the hooks. If you're making a PR, travis will check your build anyway. ### Documentation diff --git a/scripts/amo_text_to_clipboard.sh b/scripts/amo_text_to_clipboard.sh index fca3ce2c..289b0057 100755 --- a/scripts/amo_text_to_clipboard.sh +++ b/scripts/amo_text_to_clipboard.sh @@ -3,4 +3,4 @@ # Put the AMO flavour text in your clipboard for easy pasting. # AMO doesn't support all HTML in markdown so we strip it out. -"$(npm bin)/marked" doc/amo.md | sed -r "s/<.?p>//g" | sed -r "s/<.?h.*>//g" | xclip -selection "clipboard" +"$(yarn bin)/marked" doc/amo.md | sed -r "s/<.?p>//g" | sed -r "s/<.?h.*>//g" | xclip -selection "clipboard" diff --git a/scripts/build.sh b/scripts/build.sh index 7f1cc3d1..586e5b71 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -17,10 +17,10 @@ isWindowsMinGW() { if [ "$(isWindowsMinGW)" = "True" ]; then WIN_PYTHON="py -3" - NPM_BIN_DIR="$(cygpath "$(npm bin)")" - PATH=$NPM_BIN_DIR:$PATH + YARN_BIN_DIR="$(cygpath "$(yarn bin)")" + PATH=$yarn_BIN_DIR:$PATH else - PATH="$(npm bin):$PATH" + PATH="$(yarn bin):$PATH" fi export PATH @@ -37,12 +37,12 @@ else fi # .bracketexpr.generated.ts is needed for metadata generation -"$(npm bin)/nearleyc" src/grammars/bracketexpr.ne > \ +"$(yarn bin)/nearleyc" src/grammars/bracketexpr.ne > \ src/grammars/.bracketexpr.generated.ts # It's important to generate the metadata before the documentation because # missing imports might break documentation generation on clean builds -"$(npm bin)/tsc" compiler/gen_metadata.ts -m commonjs --target es2017 \ +"$(yarn bin)/tsc" compiler/gen_metadata.ts -m commonjs --target es2017 \ && node compiler/gen_metadata.js \ --out src/.metadata.generated.ts \ --themeDir src/static/themes \ @@ -71,7 +71,7 @@ scripts/authors.sh if [ -e "$CLEANSLATE" ] ; then cp -v "$CLEANSLATE" build/static/css/cleanslate.css else - echo "Couldn't find cleanslate.css. Try running 'npm install'" + echo "Couldn't find cleanslate.css. Try running 'yarn install'" fi if [ -e "$TRIDACTYL_LOGO" ] ; then diff --git a/scripts/common.sh b/scripts/common.sh index 793cc03b..8001bb1d 100755 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -24,7 +24,7 @@ prettierUgly() { local acc="" local IFS=$'\n' for jsfile in $1; do - diff <(staged "$jsfile") <(staged "$jsfile" | "$(npm bin)/prettier" --stdin-filepath "$jsfile") >/dev/null || acc="$jsfile"$'\n'"$acc" + diff <(staged "$jsfile") <(staged "$jsfile" | "$(yarn bin)/prettier" --stdin-filepath "$jsfile") >/dev/null || acc="$jsfile"$'\n'"$acc" done echo "$acc" } diff --git a/scripts/make_docs.sh b/scripts/make_docs.sh index 52a79096..882f7345 100755 --- a/scripts/make_docs.sh +++ b/scripts/make_docs.sh @@ -1,4 +1,4 @@ #!/bin/sh dest=generated/static/docs -"$(npm bin)/typedoc" --theme src/static/typedoc/ --out $dest src --ignoreCompilerErrors +"$(yarn bin)/typedoc" --theme src/static/typedoc/ --out $dest src --ignoreCompilerErrors cp -r $dest build/static/ diff --git a/scripts/make_tutorial.sh b/scripts/make_tutorial.sh index d695b58a..1c4f50c8 100755 --- a/scripts/make_tutorial.sh +++ b/scripts/make_tutorial.sh @@ -14,6 +14,6 @@ for page in $pages do fileroot=$(echo "$page" | cut -d'.' -f-2) sed "/REPLACETHIS/,$ d" tutor.template.html > "$dest$fileroot.html" - "$(npm bin)/marked" "$page" >> "$dest$fileroot.html" + "$(yarn bin)/marked" "$page" >> "$dest$fileroot.html" sed "1,/REPLACETHIS/ d" tutor.template.html >> "$dest$fileroot.html" done diff --git a/scripts/newtab.md.sh b/scripts/newtab.md.sh index b5de9c40..5072732b 100755 --- a/scripts/newtab.md.sh +++ b/scripts/newtab.md.sh @@ -11,7 +11,7 @@ newtab="../../generated/static/newtab.html" newtabtemp="../../generated/static/newtab.temp.html" sed "/REPLACETHIS/,$ d" newtab.template.html > "$newtabtemp" -"$(npm bin)/marked" newtab.md >> "$newtabtemp" +"$(yarn bin)/marked" newtab.md >> "$newtabtemp" sed "1,/REPLACETHIS/ d" newtab.template.html >> "$newtabtemp" # Why think when you can pattern match? @@ -24,7 +24,7 @@ cat <
New features!
Changelog
EOF -"$(npm bin)/marked" ../../CHANGELOG.md +"$(yarn bin)/marked" ../../CHANGELOG.md echo """
""" diff --git a/scripts/sign b/scripts/sign index bdbc3bb1..8e0af2fc 100755 --- a/scripts/sign +++ b/scripts/sign @@ -8,8 +8,8 @@ sign_and_submit() { } publish_beta_nonewtab() { - npm run clean - npm run build + yarn run clean + yarn run build scripts/version.js beta sed 's/tridactyl.vim.betas@cmcaine/tridactyl.vim.betas.nonewtab@cmcaine/' -i build/manifest.json sed '/\s*"newtab":.*/d' -i build/manifest.json @@ -18,16 +18,16 @@ publish_beta_nonewtab() { } publish_beta() { - npm run clean - npm run build + yarn run clean + yarn run build scripts/version.js beta sed 's/"name": "Tridactyl"/"name": "Tridactyl: Beta"/' -i build/manifest.json sign_and_submit } publish_stable() { - npm run clean - npm run build + yarn run clean + yarn run build sed 's/tridactyl.vim.betas@cmcaine/tridactyl.vim@cmcaine/' -i build/manifest.json sign_and_submit tar --exclude-from=.gitignore -czf ../public_html/betas/tridactyl_source.tar.gz .