Merge pull request #2773 from jryans/yarn

Switch to `yarn` for dependency management
This commit is contained in:
J. Ryan Stinnett 2019-03-13 09:34:34 +00:00 committed by GitHub
commit 9585f111a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 7188 additions and 61 deletions

5
.gitignore vendored
View file

@ -4,7 +4,7 @@ npm-debug.log
/node_modules
/lib
# version file and tarball created by 'npm pack'
# version file and tarball created by `npm pack` / `yarn pack`
/git-revision.txt
/matrix-react-sdk-*.tgz
@ -15,6 +15,3 @@ npm-debug.log
/src/component-index.js
.DS_Store
# https://github.com/vector-im/riot-web/issues/7083
package-lock.json

View file

@ -20,7 +20,7 @@ matrix:
- name: Linting Checks
script:
# run the linter, but exclude any files known to have errors or warnings.
- npm run lintwithexclusions
- yarn lintwithexclusions
# - name: End-to-End Tests
# if: branch = develop
# install:

View file

@ -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
(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 view's CSS file MUST have the same name (e.g. view/rooms/MessageTile.css).
@ -131,26 +131,36 @@ for now.
Development
===========
Ensure you have the latest stable Node JS runtime installed (v8.x is the best choice). Then check out
the code and pull in dependencies:
Ensure you have the latest stable Node JS runtime installed (v8.x is the best
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.
`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`,
you should set up `matrix-js-sdk`:
```bash
git clone https://github.com/matrix-org/matrix-react-sdk.git
git clone https://github.com/matrix-org/matrix-js-sdk
cd matrix-js-sdk
git checkout develop
yarn link
yarn install
```
Then check out `matrix-react-sdk` and pull in dependencies:
```bash
git clone https://github.com/matrix-org/matrix-react-sdk
cd matrix-react-sdk
git checkout develop
npm install
yarn link matrix-js-sdk
yarn install
```
`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`,
you should run the following which will sync changes from the JS sdk here.
```bash
npm link ../matrix-js-sdk
```
Command assumes a checked out and installed `matrix-js-sdk` folder in parent
folder.
See the [help for `yarn link`](https://yarnpkg.com/docs/cli/link) for more
details about this.
Running tests
=============
@ -158,5 +168,5 @@ Running tests
Ensure you've followed the above development instructions and then:
```bash
npm run test
yarn test
```

View file

@ -8,25 +8,29 @@ nvm use 10
set -x
# install the other dependencies
npm install
scripts/fetchdep.sh matrix-org matrix-js-sdk
rm -r node_modules/matrix-js-sdk || true
ln -s ../matrix-js-sdk node_modules/matrix-js-sdk
(cd matrix-js-sdk && npm install)
pushd matrix-js-sdk
yarn link
yarn install
popd
yarn link matrix-js-sdk
# install the other dependencies
yarn install
# run the mocha tests
npm run test -- --no-colors
yarn test --no-colors
# 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.
npm run lintwithexclusions
yarn lintwithexclusions
# delete the old tarball, if it exists
rm -f matrix-react-sdk-*.tgz
# build our tarball
npm pack
yarn pack

View file

@ -8,7 +8,7 @@ var fs = require('fs');
* to build everything; however it's the easiest way to load our dependencies
* 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
* 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';
if (!fileExists(gsCss)) {
gsCss = 'node_modules/react-gemini-scrollbar/'+gsCss;
@ -198,7 +198,7 @@ module.exports = function (config) {
alias: {
// alias any requires to the react module to the one in our
// 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'),
'matrix-react-sdk': path.resolve('test/skinned-sdk.js'),

View file

@ -40,17 +40,17 @@
"rethemendex": "res/css/rethemendex.sh",
"i18n": "matrix-gen-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",
"emoji-data-strip": "node scripts/emoji-data-strip.js",
"start": "npm run start:init && npm run start:all",
"start:all": "concurrently --kill-others-on-fail --prefix \"{time} [{name}]\" -n build,reskindex \"npm run build:watch\" \"npm run reskindex:watch\"",
"start": "yarn start:init && yarn start:all",
"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",
"lint": "eslint src/",
"lintall": "eslint src/ test/",
"lintwithexclusions": "eslint --max-warnings 0 --ignore-path .eslintignore.errorfiles src test",
"clean": "rimraf lib",
"prepublish": "npm run clean && npm run build && git rev-parse HEAD > git-revision.txt",
"prepare": "yarn clean && yarn build && git rev-parse HEAD > git-revision.txt",
"test": "karma start --single-run=true --browsers ChromeHeadless",
"test-multi": "karma start"
},

View file

@ -1,6 +1,6 @@
#!/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.
@ -9,19 +9,17 @@ set -ev
RIOT_WEB_DIR=riot-web
REACT_SDK_DIR=`pwd`
yarn link
scripts/fetchdep.sh vector-im riot-web
pushd "$RIOT_WEB_DIR"
mkdir node_modules
npm install
yarn link matrix-js-sdk
yarn link matrix-react-sdk
# use the version of js-sdk we just used in the react-sdk tests
rm -r node_modules/matrix-js-sdk
ln -s "$REACT_SDK_DIR/node_modules/matrix-js-sdk" node_modules/matrix-js-sdk
yarn install
# ... and, of course, the version of react-sdk we just built
rm -r node_modules/matrix-react-sdk
ln -s "$REACT_SDK_DIR" node_modules/matrix-react-sdk
yarn build
npm run build
popd

View file

@ -1,6 +1,6 @@
#!/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.

View file

@ -1,11 +1,13 @@
#!/bin/sh
#!/bin/bash
set -ex
npm install
scripts/fetchdep.sh matrix-org matrix-js-sdk
rm -r node_modules/matrix-js-sdk || true
ln -s ../matrix-js-sdk node_modules/matrix-js-sdk
cd matrix-js-sdk
npm install
cd ..
scripts/fetchdep.sh matrix-org matrix-js-sdk
pushd matrix-js-sdk
yarn link
yarn install
popd
yarn link matrix-js-sdk
yarn install

View file

@ -1,6 +1,6 @@
#!/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.
@ -10,5 +10,5 @@ RIOT_WEB_DIR=riot-web
scripts/travis/build.sh
pushd "$RIOT_WEB_DIR"
npm run test
yarn test
popd

View file

@ -1,10 +1,10 @@
#!/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.
set -ev
scripts/travis/build.sh
CHROME_BIN='/usr/bin/google-chrome-stable' npm run test
CHROME_BIN='/usr/bin/google-chrome-stable' yarn test

7116
yarn.lock Normal file

File diff suppressed because it is too large Load diff