Skip to content

Commit

Permalink
Merge pull request #856 from jryans/yarn
Browse files Browse the repository at this point in the history
Switch to `yarn` for dependency management
  • Loading branch information
jryans authored Mar 11, 2019
2 parents fc1ea27 + cc86f42 commit 90670cf
Show file tree
Hide file tree
Showing 9 changed files with 4,935 additions and 7,822 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ reports
/lib
/specbuild

# version file and tarball created by 'npm pack'
# version file and tarball created by `npm pack` / `yarn pack`
/git-revision.txt
/matrix-js-sdk-*.tgz
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ Please check [the working browser example](examples/browser) for more informatio
In Node.js
----------

``npm install matrix-js-sdk``
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.

``yarn add matrix-js-sdk``

```javascript
var sdk = require("matrix-js-sdk");
Expand Down Expand Up @@ -283,7 +285,7 @@ This SDK uses JSDoc3 style comments. You can manually build and
host the API reference from the source files like this:

```
$ npm run gendoc
$ yarn gendoc
$ cd .jsdoc
$ python -m SimpleHTTPServer 8005
```
Expand Down Expand Up @@ -319,15 +321,15 @@ To provide the Olm library in a browser application:

To provide the Olm library in a node.js application:

* ``npm install https://matrix.org/packages/npm/olm/olm-3.0.0.tgz``
* ``yarn add https://matrix.org/packages/npm/olm/olm-3.0.0.tgz``
(replace the URL with the latest version you want to use from
https://matrix.org/packages/npm/olm/)
* ``global.Olm = require('olm');`` *before* loading ``matrix-js-sdk``.

If you want to package Olm as dependency for your node.js application, you
can use ``npm install https://matrix.org/packages/npm/olm/olm-3.0.0.tgz
--save-optional`` (if your application also works without e2e crypto enabled)
or ``--save`` (if it doesn't) to do so.
If you want to package Olm as dependency for your node.js application, you can
use ``yarn add https://matrix.org/packages/npm/olm/olm-3.0.0.tgz``. If your
application also works without e2e crypto enabled, add ``--optional`` to mark it
as an optional dependency.


Contributing
Expand All @@ -337,28 +339,28 @@ want to use this SDK, skip this section.*

First, you need to pull in the right build tools:
```
$ npm install
$ yarn install
```

Building
--------

To build a browser version from scratch when developing::
```
$ npm run build
$ yarn build
```

To constantly do builds when files are modified (using ``watchify``)::
```
$ npm run watch
$ yarn watch
```

To run tests (Jasmine)::
```
$ npm test
$ yarn test
```

To run linting:
```
$ npm run lint
$ yarn lint
```
2 changes: 1 addition & 1 deletion git-hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ export PATH="$rootdir/node_modules/.bin:$PATH"

# now run our checks
cd "$tmpdir"
npm run lint
yarn lint
14 changes: 8 additions & 6 deletions jenkins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"

nvm use 10 || exit $?
npm install || exit $?
yarn install || exit $?

RC=0

Expand All @@ -18,17 +18,19 @@ function fail {
# don't use last time's test reports
rm -rf reports coverage || exit $?

npm test || fail "npm test finished with return code $?"
yarn test || fail "yarn test finished with return code $?"

npm run -s lint -- -f checkstyle > eslint.xml ||
yarn -s lint -f checkstyle > eslint.xml ||
fail "eslint finished with return code $?"

# delete the old tarball, if it exists
rm -f matrix-js-sdk-*.tgz

npm pack ||
fail "npm pack finished with return code $?"
# `yarn pack` doesn't seem to run scripts, however that seems okay here as we
# just built as part of `install` above.
yarn pack ||
fail "yarn pack finished with return code $?"

npm run gendoc || fail "JSDoc failed with code $?"
yarn gendoc || fail "JSDoc failed with code $?"

exit $RC
Loading

0 comments on commit 90670cf

Please sign in to comment.