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: 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"

View file

@ -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:

View file

@ -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

View file

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

View file

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

View file

@ -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

View file

@ -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"
},

View file

@ -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
```
<!-- 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
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

View file

@ -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"

View file

@ -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

View file

@ -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"
}

View file

@ -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/

View file

@ -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

View file

@ -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 <<EOF
<label for="spoilerbutton" onclick=""><div id="nagbar-changelog">New features!</div>Changelog</label>
<div id="changelog" class="spoiler">
EOF
"$(npm bin)/marked" ../../CHANGELOG.md
"$(yarn bin)/marked" ../../CHANGELOG.md
echo """
</div>
"""

View file

@ -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 .