Update scripts and docs to use yarn
where appropriate
Most `npm` operations are replaced with `yarn`, which generally has better behavior. However, steps like publish that write to the NPM registry are left to `npm`, which currently handles these tasks best.
This commit is contained in:
parent
db5b76b225
commit
7c947d87ab
11 changed files with 46 additions and 35 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -3,7 +3,7 @@ npm-debug.log
|
||||||
/node_modules
|
/node_modules
|
||||||
/lib
|
/lib
|
||||||
|
|
||||||
# version file and tarball created by 'npm pack'
|
# version file and tarball created by `npm pack` / `yarn pack`
|
||||||
/git-revision.txt
|
/git-revision.txt
|
||||||
/matrix-react-sdk-*.tgz
|
/matrix-react-sdk-*.tgz
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ matrix:
|
||||||
- name: Linting Checks
|
- name: Linting Checks
|
||||||
script:
|
script:
|
||||||
# run the linter, but exclude any files known to have errors or warnings.
|
# run the linter, but exclude any files known to have errors or warnings.
|
||||||
- npm run lintwithexclusions
|
- yarn lintwithexclusions
|
||||||
# - name: End-to-End Tests
|
# - name: End-to-End Tests
|
||||||
# if: branch = develop
|
# if: branch = develop
|
||||||
# install:
|
# install:
|
||||||
|
|
31
README.md
31
README.md
|
@ -66,7 +66,7 @@ practices that anyone working with the SDK needs to be be aware of and uphold:
|
||||||
component is a view or a structure, and then a broad functional grouping
|
component is a view or a structure, and then a broad functional grouping
|
||||||
(e.g. 'rooms' here)
|
(e.g. 'rooms' here)
|
||||||
|
|
||||||
* After creating a new component you must run `npm run reskindex` to regenerate
|
* After creating a new component you must run `yarn reskindex` to regenerate
|
||||||
the `component-index.js` for the SDK (used in future for skinning)
|
the `component-index.js` for the SDK (used in future for skinning)
|
||||||
|
|
||||||
* The view's CSS file MUST have the same name (e.g. view/rooms/MessageTile.css).
|
* The view's CSS file MUST have the same name (e.g. view/rooms/MessageTile.css).
|
||||||
|
@ -131,26 +131,37 @@ for now.
|
||||||
Development
|
Development
|
||||||
===========
|
===========
|
||||||
|
|
||||||
Ensure you have the latest stable Node JS runtime installed (v8.x is the best choice). Then check out
|
Ensure you have the latest stable Node JS runtime installed (v8.x is the best
|
||||||
the code and pull in dependencies:
|
choice).
|
||||||
|
|
||||||
|
Using `yarn` instead of `npm` is recommended. Please see the Yarn [install
|
||||||
|
guide](https://yarnpkg.com/docs/install/) if you do not have it already.
|
||||||
|
|
||||||
|
Then check out the code and pull in dependencies:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/matrix-org/matrix-react-sdk.git
|
git clone https://github.com/matrix-org/matrix-react-sdk.git
|
||||||
cd matrix-react-sdk
|
cd matrix-react-sdk
|
||||||
git checkout develop
|
git checkout develop
|
||||||
npm install
|
yarn install
|
||||||
```
|
```
|
||||||
|
|
||||||
`matrix-react-sdk` depends on `matrix-js-sdk`. To make use of changes in the
|
`matrix-react-sdk` depends on `matrix-js-sdk`. To make use of changes in the
|
||||||
latter and to ensure tests run against the develop branch of `matrix-js-sdk`,
|
latter and to ensure tests run against the develop branch of `matrix-js-sdk`,
|
||||||
you should run the following which will sync changes from the JS sdk here.
|
you should check out `matrix-js-sdk`, change into that new directory, and run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm link ../matrix-js-sdk
|
yarn link
|
||||||
```
|
```
|
||||||
|
|
||||||
Command assumes a checked out and installed `matrix-js-sdk` folder in parent
|
Then, switch back to `matrix-react-sdk` and run:
|
||||||
folder.
|
|
||||||
|
```bash
|
||||||
|
yarn link matrix-js-sdk
|
||||||
|
```
|
||||||
|
|
||||||
|
See the [help for `yarn link`](https://yarnpkg.com/docs/cli/link) for more
|
||||||
|
details about this.
|
||||||
|
|
||||||
Running tests
|
Running tests
|
||||||
=============
|
=============
|
||||||
|
@ -158,5 +169,5 @@ Running tests
|
||||||
Ensure you've followed the above development instructions and then:
|
Ensure you've followed the above development instructions and then:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run test
|
yarn test
|
||||||
```
|
```
|
||||||
|
|
12
jenkins.sh
12
jenkins.sh
|
@ -9,24 +9,24 @@ nvm use 10
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
# install the other dependencies
|
# install the other dependencies
|
||||||
npm install
|
yarn install
|
||||||
|
|
||||||
scripts/fetchdep.sh matrix-org matrix-js-sdk
|
scripts/fetchdep.sh matrix-org matrix-js-sdk
|
||||||
rm -r node_modules/matrix-js-sdk || true
|
rm -r node_modules/matrix-js-sdk || true
|
||||||
ln -s ../matrix-js-sdk node_modules/matrix-js-sdk
|
ln -s ../matrix-js-sdk node_modules/matrix-js-sdk
|
||||||
(cd matrix-js-sdk && npm install)
|
(cd matrix-js-sdk && yarn install)
|
||||||
|
|
||||||
# run the mocha tests
|
# run the mocha tests
|
||||||
npm run test -- --no-colors
|
yarn test --no-colors
|
||||||
|
|
||||||
# run eslint
|
# run eslint
|
||||||
npm run lintall -- -f checkstyle -o eslint.xml || true
|
yarn lintall -f checkstyle -o eslint.xml || true
|
||||||
|
|
||||||
# re-run the linter, excluding any files known to have errors or warnings.
|
# re-run the linter, excluding any files known to have errors or warnings.
|
||||||
npm run lintwithexclusions
|
yarn lintwithexclusions
|
||||||
|
|
||||||
# delete the old tarball, if it exists
|
# delete the old tarball, if it exists
|
||||||
rm -f matrix-react-sdk-*.tgz
|
rm -f matrix-react-sdk-*.tgz
|
||||||
|
|
||||||
# build our tarball
|
# build our tarball
|
||||||
npm pack
|
yarn pack
|
||||||
|
|
|
@ -8,7 +8,7 @@ var fs = require('fs');
|
||||||
* to build everything; however it's the easiest way to load our dependencies
|
* to build everything; however it's the easiest way to load our dependencies
|
||||||
* from node_modules.
|
* from node_modules.
|
||||||
*
|
*
|
||||||
* If you run karma in multi-run mode (with `npm run test-multi`), it will watch
|
* If you run karma in multi-run mode (with `yarn test-multi`), it will watch
|
||||||
* the tests for changes, and webpack will rebuild using a cache. This is much quicker
|
* the tests for changes, and webpack will rebuild using a cache. This is much quicker
|
||||||
* than a clean rebuild.
|
* than a clean rebuild.
|
||||||
*/
|
*/
|
||||||
|
@ -35,7 +35,7 @@ function fileExists(name) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// try find the gemini-scrollbar css in an npm-version-agnostic way
|
// try find the gemini-scrollbar css in an version-agnostic way
|
||||||
var gsCss = 'node_modules/gemini-scrollbar/gemini-scrollbar.css';
|
var gsCss = 'node_modules/gemini-scrollbar/gemini-scrollbar.css';
|
||||||
if (!fileExists(gsCss)) {
|
if (!fileExists(gsCss)) {
|
||||||
gsCss = 'node_modules/react-gemini-scrollbar/'+gsCss;
|
gsCss = 'node_modules/react-gemini-scrollbar/'+gsCss;
|
||||||
|
@ -198,7 +198,7 @@ module.exports = function (config) {
|
||||||
alias: {
|
alias: {
|
||||||
// alias any requires to the react module to the one in our
|
// alias any requires to the react module to the one in our
|
||||||
// path, otherwise we tend to get the react source included
|
// path, otherwise we tend to get the react source included
|
||||||
// twice when using npm link.
|
// twice when using `npm link` / `yarn link`.
|
||||||
react: path.resolve('./node_modules/react'),
|
react: path.resolve('./node_modules/react'),
|
||||||
|
|
||||||
'matrix-react-sdk': path.resolve('test/skinned-sdk.js'),
|
'matrix-react-sdk': path.resolve('test/skinned-sdk.js'),
|
||||||
|
|
|
@ -40,17 +40,17 @@
|
||||||
"rethemendex": "res/css/rethemendex.sh",
|
"rethemendex": "res/css/rethemendex.sh",
|
||||||
"i18n": "matrix-gen-i18n",
|
"i18n": "matrix-gen-i18n",
|
||||||
"prunei18n": "matrix-prune-i18n",
|
"prunei18n": "matrix-prune-i18n",
|
||||||
"build": "npm run reskindex && npm run start:init",
|
"build": "yarn reskindex && yarn start:init",
|
||||||
"build:watch": "babel src -w --skip-initial-build -d lib --source-maps --copy-files",
|
"build:watch": "babel src -w --skip-initial-build -d lib --source-maps --copy-files",
|
||||||
"emoji-data-strip": "node scripts/emoji-data-strip.js",
|
"emoji-data-strip": "node scripts/emoji-data-strip.js",
|
||||||
"start": "npm run start:init && npm run start:all",
|
"start": "yarn start:init && yarn start:all",
|
||||||
"start:all": "concurrently --kill-others-on-fail --prefix \"{time} [{name}]\" -n build,reskindex \"npm run build:watch\" \"npm run reskindex:watch\"",
|
"start:all": "concurrently --kill-others-on-fail --prefix \"{time} [{name}]\" -n build,reskindex \"yarn build:watch\" \"yarn reskindex:watch\"",
|
||||||
"start:init": "babel src -d lib --source-maps --copy-files",
|
"start:init": "babel src -d lib --source-maps --copy-files",
|
||||||
"lint": "eslint src/",
|
"lint": "eslint src/",
|
||||||
"lintall": "eslint src/ test/",
|
"lintall": "eslint src/ test/",
|
||||||
"lintwithexclusions": "eslint --max-warnings 0 --ignore-path .eslintignore.errorfiles src test",
|
"lintwithexclusions": "eslint --max-warnings 0 --ignore-path .eslintignore.errorfiles src test",
|
||||||
"clean": "rimraf lib",
|
"clean": "rimraf lib",
|
||||||
"prepublish": "npm run clean && npm run build && git rev-parse HEAD > git-revision.txt",
|
"prepublish": "yarn clean && yarn build && git rev-parse HEAD > git-revision.txt",
|
||||||
"test": "karma start --single-run=true --browsers ChromeHeadless",
|
"test": "karma start --single-run=true --browsers ChromeHeadless",
|
||||||
"test-multi": "karma start"
|
"test-multi": "karma start"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# script which is run by the travis build (after `npm run test`).
|
# script which is run by the travis build (after `yarn test`).
|
||||||
#
|
#
|
||||||
# clones riot-web develop and runs the tests against our version of react-sdk.
|
# clones riot-web develop and runs the tests against our version of react-sdk.
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ scripts/fetchdep.sh vector-im riot-web
|
||||||
pushd "$RIOT_WEB_DIR"
|
pushd "$RIOT_WEB_DIR"
|
||||||
|
|
||||||
mkdir node_modules
|
mkdir node_modules
|
||||||
npm install
|
yarn install
|
||||||
|
|
||||||
# use the version of js-sdk we just used in the react-sdk tests
|
# use the version of js-sdk we just used in the react-sdk tests
|
||||||
rm -r node_modules/matrix-js-sdk
|
rm -r node_modules/matrix-js-sdk
|
||||||
|
@ -23,5 +23,5 @@ ln -s "$REACT_SDK_DIR/node_modules/matrix-js-sdk" node_modules/matrix-js-sdk
|
||||||
rm -r node_modules/matrix-react-sdk
|
rm -r node_modules/matrix-react-sdk
|
||||||
ln -s "$REACT_SDK_DIR" node_modules/matrix-react-sdk
|
ln -s "$REACT_SDK_DIR" node_modules/matrix-react-sdk
|
||||||
|
|
||||||
npm run build
|
yarn build
|
||||||
popd
|
popd
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# script which is run by the travis build (after `npm run test`).
|
# script which is run by the travis build (after `yarn test`).
|
||||||
#
|
#
|
||||||
# clones riot-web develop and runs the tests against our version of react-sdk.
|
# clones riot-web develop and runs the tests against our version of react-sdk.
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
npm install
|
yarn install
|
||||||
scripts/fetchdep.sh matrix-org matrix-js-sdk
|
scripts/fetchdep.sh matrix-org matrix-js-sdk
|
||||||
rm -r node_modules/matrix-js-sdk || true
|
rm -r node_modules/matrix-js-sdk || true
|
||||||
ln -s ../matrix-js-sdk node_modules/matrix-js-sdk
|
ln -s ../matrix-js-sdk node_modules/matrix-js-sdk
|
||||||
|
|
||||||
cd matrix-js-sdk
|
cd matrix-js-sdk
|
||||||
npm install
|
yarn install
|
||||||
cd ..
|
cd ..
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# script which is run by the travis build (after `npm run test`).
|
# script which is run by the travis build (after `yarn test`).
|
||||||
#
|
#
|
||||||
# clones riot-web develop and runs the tests against our version of react-sdk.
|
# clones riot-web develop and runs the tests against our version of react-sdk.
|
||||||
|
|
||||||
|
@ -10,5 +10,5 @@ RIOT_WEB_DIR=riot-web
|
||||||
|
|
||||||
scripts/travis/build.sh
|
scripts/travis/build.sh
|
||||||
pushd "$RIOT_WEB_DIR"
|
pushd "$RIOT_WEB_DIR"
|
||||||
npm run test
|
yarn test
|
||||||
popd
|
popd
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# script which is run by the travis build (after `npm run test`).
|
# script which is run by the travis build (after `yarn test`).
|
||||||
#
|
#
|
||||||
# clones riot-web develop and runs the tests against our version of react-sdk.
|
# clones riot-web develop and runs the tests against our version of react-sdk.
|
||||||
|
|
||||||
set -ev
|
set -ev
|
||||||
|
|
||||||
scripts/travis/build.sh
|
scripts/travis/build.sh
|
||||||
CHROME_BIN='/usr/bin/google-chrome-stable' npm run test
|
CHROME_BIN='/usr/bin/google-chrome-stable' yarn test
|
||||||
|
|
Loading…
Reference in a new issue