s/npm/yarn

This commit is contained in:
Colin Caine 2019-05-31 16:48:53 +01:00
parent 09904e2724
commit 3c618ac7a4
15 changed files with 51 additions and 51 deletions

View file

@ -17,16 +17,16 @@ init:
- ps: Write-Host "[+] Location of Bash ..." - ps: Write-Host "[+] Location of Bash ..."
- ps: Get-Command -Name 'bash' - ps: Get-Command -Name 'bash'
# Verify NPM # Verify yarn
- ps: Write-Host "[+] Location of NPM ..." - ps: Write-Host "[+] Location of yarn ..."
- ps: Get-Command -Name 'npm' - ps: Get-Command -Name 'yarn'
# Verify software versions # Verify software versions
- ps: Write-Host "[+] Verifying software verisons ..." - ps: Write-Host "[+] Verifying software verisons ..."
- sh --version - sh --version
- bash --version - bash --version
- node --version - node --version
- npm --version - yarn --version
# #
# Python version will show "2.7" below, which is required to keep # Python version will show "2.7" below, which is required to keep
@ -72,8 +72,8 @@ install:
- ps: Get-Location - ps: Get-Location
- bash -e -l -c "cd $APPVEYOR_BUILD_FOLDER && ls -alh" - bash -e -l -c "cd $APPVEYOR_BUILD_FOLDER && ls -alh"
# Install NPM modules # Install yarn modules
- bash -e -l -c "cd $APPVEYOR_BUILD_FOLDER && npm install" - bash -e -l -c "cd $APPVEYOR_BUILD_FOLDER && yarn install"
build_script: build_script:
# Add Python-3.6 to %PATH% # Add Python-3.6 to %PATH%
@ -101,8 +101,8 @@ build_script:
- ps: Write-Host "[+] Current directory under Bash ..." - ps: Write-Host "[+] Current directory under Bash ..."
- bash -e -l -c "cd $APPVEYOR_BUILD_FOLDER && ls -alh" - bash -e -l -c "cd $APPVEYOR_BUILD_FOLDER && ls -alh"
- ps: Write-Host "[+] Starting 'npm run build' ..." - ps: Write-Host "[+] Starting 'yarn run build' ..."
- bash -e -l -c "cd $APPVEYOR_BUILD_FOLDER && export PYINSTALLER=1 && npm run build" - bash -e -l -c "cd $APPVEYOR_BUILD_FOLDER && export PYINSTALLER=1 && yarn run build"
test_script: test_script:
# Add Python-3.6 to %PATH% # Add Python-3.6 to %PATH%
@ -130,5 +130,5 @@ test_script:
- ps: Write-Host "[+] Current directory under Bash ..." - ps: Write-Host "[+] Current directory under Bash ..."
- bash -e -l -c "cd $APPVEYOR_BUILD_FOLDER && ls -alh" - bash -e -l -c "cd $APPVEYOR_BUILD_FOLDER && ls -alh"
- ps: Write-Host "[+] Starting 'npm run test' ..." - ps: Write-Host "[+] Starting 'yarn run test' ..."
- bash -e -l -c "cd $APPVEYOR_BUILD_FOLDER && export PYINSTALLER=1 && npm run test" - bash -e -l -c "cd $APPVEYOR_BUILD_FOLDER && export PYINSTALLER=1 && yarn run test"

View file

@ -6,12 +6,12 @@ commands:
- restore_cache: - restore_cache:
keys: keys:
- dependency-cache-{{ checksum "package.json" }} - dependency-cache-{{ checksum "package.json" }}
- run: npm install - run: yarn install
- save_cache: - save_cache:
key: dependency-cache-{{ checksum "package.json" }} key: dependency-cache-{{ checksum "package.json" }}
paths: paths:
- ./node_modules - ./node_modules
- run: npm run build - run: yarn run build
jobs: jobs:
lint: lint:
docker: docker:
@ -21,14 +21,14 @@ jobs:
- run: sudo apt install -qq shellcheck - run: sudo apt install -qq shellcheck
- commoncmd - commoncmd
- run: bash -c 'GLOBIGNORE="node_modules" shellcheck **/*.sh' - run: bash -c 'GLOBIGNORE="node_modules" shellcheck **/*.sh'
- run: npm run lint - run: yarn run lint
- run: bash -c '"$(npm bin)/tslint" --project .' - run: bash -c '"$(yarn bin)/tslint" --project .'
unit: unit:
docker: docker:
- image: circleci/node:latest - image: circleci/node:latest
steps: steps:
- commoncmd - commoncmd
- run: bash -c '"$(npm bin)/jest" src' - run: bash -c '"$(yarn bin)/jest" src'
e2e: e2e:
docker: docker:
- image: circleci/node:latest-browsers - image: circleci/node:latest-browsers
@ -36,12 +36,12 @@ jobs:
MOZ_HEADLESS: 1 MOZ_HEADLESS: 1
steps: steps:
- commoncmd - 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: get-firefox --branch nightly --platform linux --extract --target ~/
- run: ~/firefox/firefox -v - 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: 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: workflows:
version: 2 version: 2
build_test_lint: build_test_lint:

View file

@ -126,7 +126,7 @@ Here's an example: you're writing the [`native()`](https://github.com/tridactyl/
# Build Process # 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 [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. - 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. - 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 - 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 # Code of conduct

View file

@ -10,5 +10,5 @@ file_changed() {
} }
if file_changed package.json; then if file_changed package.json; then
npm install yarn install
fi fi

View file

@ -10,5 +10,5 @@ file_changed() {
} }
if file_changed package.json; then if file_changed package.json; then
npm install yarn install
fi fi

View file

@ -20,6 +20,6 @@ fi
if [ -n "$uglyFiles" ]; then if [ -n "$uglyFiles" ]; then
echo "Prettify your files first:" echo "Prettify your files first:"
echo 'npm run pretty' echo 'yarn run pretty'
exit 1 exit 1
fi fi

View file

@ -52,8 +52,8 @@
"run": "web-ext run -s build/ -u 'txti.es'", "run": "web-ext run -s build/ -u 'txti.es'",
"watch": "echo 'watch is broken, use build instead'; exit 0;", "watch": "echo 'watch is broken, use build instead'; exit 0;",
"clean": "rm -rf build generated", "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", "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; npm run clean", "update-buildsystem": "rm -rf src/node_modules; yarn run clean",
"lint": "bash hooks/pre-commit", "lint": "bash hooks/pre-commit",
"pretty": "bash scripts/pretty.sh" "pretty": "bash scripts/pretty.sh"
}, },

View file

@ -231,11 +231,11 @@ Onboarding:
``` ```
git clone https://github.com/tridactyl/tridactyl.git git clone https://github.com/tridactyl/tridactyl.git
cd tridactyl cd tridactyl
npm install yarn install
npm run build 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. 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 # Build tridactyl if you haven't done that yet
npm run build yarn run build
# Package for a browser # 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. 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 ### Development loop
``` ```
npm run build & npm run run yarn run build & yarn run run
``` ```
<!-- This will compile and deploy your files each time you save them. --> <!-- This will compile and deploy your files each time you save them. -->
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 ### 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 ### Documentation

View file

@ -3,4 +3,4 @@
# Put the AMO flavour text in your clipboard for easy pasting. # Put the AMO flavour text in your clipboard for easy pasting.
# AMO doesn't support all HTML in markdown so we strip it out. # 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"

View file

@ -17,10 +17,10 @@ isWindowsMinGW() {
if [ "$(isWindowsMinGW)" = "True" ]; then if [ "$(isWindowsMinGW)" = "True" ]; then
WIN_PYTHON="py -3" WIN_PYTHON="py -3"
NPM_BIN_DIR="$(cygpath "$(npm bin)")" YARN_BIN_DIR="$(cygpath "$(yarn bin)")"
PATH=$NPM_BIN_DIR:$PATH PATH=$yarn_BIN_DIR:$PATH
else else
PATH="$(npm bin):$PATH" PATH="$(yarn bin):$PATH"
fi fi
export PATH export PATH
@ -37,12 +37,12 @@ else
fi fi
# .bracketexpr.generated.ts is needed for metadata generation # .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 src/grammars/.bracketexpr.generated.ts
# It's important to generate the metadata before the documentation because # It's important to generate the metadata before the documentation because
# missing imports might break documentation generation on clean builds # 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 \ && node compiler/gen_metadata.js \
--out src/.metadata.generated.ts \ --out src/.metadata.generated.ts \
--themeDir src/static/themes \ --themeDir src/static/themes \
@ -71,7 +71,7 @@ scripts/authors.sh
if [ -e "$CLEANSLATE" ] ; then if [ -e "$CLEANSLATE" ] ; then
cp -v "$CLEANSLATE" build/static/css/cleanslate.css cp -v "$CLEANSLATE" build/static/css/cleanslate.css
else else
echo "Couldn't find cleanslate.css. Try running 'npm install'" echo "Couldn't find cleanslate.css. Try running 'yarn install'"
fi fi
if [ -e "$TRIDACTYL_LOGO" ] ; then if [ -e "$TRIDACTYL_LOGO" ] ; then

View file

@ -24,7 +24,7 @@ prettierUgly() {
local acc="" local acc=""
local IFS=$'\n' local IFS=$'\n'
for jsfile in $1; do 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 done
echo "$acc" echo "$acc"
} }

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/sh
dest=generated/static/docs 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/ cp -r $dest build/static/

View file

@ -14,6 +14,6 @@ for page in $pages
do do
fileroot=$(echo "$page" | cut -d'.' -f-2) fileroot=$(echo "$page" | cut -d'.' -f-2)
sed "/REPLACETHIS/,$ d" tutor.template.html > "$dest$fileroot.html" 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" sed "1,/REPLACETHIS/ d" tutor.template.html >> "$dest$fileroot.html"
done done

View file

@ -11,7 +11,7 @@ newtab="../../generated/static/newtab.html"
newtabtemp="../../generated/static/newtab.temp.html" newtabtemp="../../generated/static/newtab.temp.html"
sed "/REPLACETHIS/,$ d" newtab.template.html > "$newtabtemp" 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" sed "1,/REPLACETHIS/ d" newtab.template.html >> "$newtabtemp"
# Why think when you can pattern match? # Why think when you can pattern match?
@ -24,7 +24,7 @@ cat <<EOF
<label for="spoilerbutton" onclick=""><div id="nagbar-changelog">New features!</div>Changelog</label> <label for="spoilerbutton" onclick=""><div id="nagbar-changelog">New features!</div>Changelog</label>
<div id="changelog" class="spoiler"> <div id="changelog" class="spoiler">
EOF EOF
"$(npm bin)/marked" ../../CHANGELOG.md "$(yarn bin)/marked" ../../CHANGELOG.md
echo """ echo """
</div> </div>
""" """

View file

@ -8,8 +8,8 @@ sign_and_submit() {
} }
publish_beta_nonewtab() { publish_beta_nonewtab() {
npm run clean yarn run clean
npm run build yarn run build
scripts/version.js beta scripts/version.js beta
sed 's/tridactyl.vim.betas@cmcaine/tridactyl.vim.betas.nonewtab@cmcaine/' -i build/manifest.json sed 's/tridactyl.vim.betas@cmcaine/tridactyl.vim.betas.nonewtab@cmcaine/' -i build/manifest.json
sed '/\s*"newtab":.*/d' -i build/manifest.json sed '/\s*"newtab":.*/d' -i build/manifest.json
@ -18,16 +18,16 @@ publish_beta_nonewtab() {
} }
publish_beta() { publish_beta() {
npm run clean yarn run clean
npm run build yarn run build
scripts/version.js beta scripts/version.js beta
sed 's/"name": "Tridactyl"/"name": "Tridactyl: Beta"/' -i build/manifest.json sed 's/"name": "Tridactyl"/"name": "Tridactyl: Beta"/' -i build/manifest.json
sign_and_submit sign_and_submit
} }
publish_stable() { publish_stable() {
npm run clean yarn run clean
npm run build yarn run build
sed 's/tridactyl.vim.betas@cmcaine/tridactyl.vim@cmcaine/' -i build/manifest.json sed 's/tridactyl.vim.betas@cmcaine/tridactyl.vim@cmcaine/' -i build/manifest.json
sign_and_submit sign_and_submit
tar --exclude-from=.gitignore -czf ../public_html/betas/tridactyl_source.tar.gz . tar --exclude-from=.gitignore -czf ../public_html/betas/tridactyl_source.tar.gz .