Skip to content

Commit

Permalink
Merge pull request #10913 from mrclay/yarn_takeover
Browse files Browse the repository at this point in the history
chore(build): move JS package mgmt from npm to Yarn
  • Loading branch information
mrclay committed Apr 25, 2017
2 parents bb6a7dc + 65f3c03 commit 888ca42
Show file tree
Hide file tree
Showing 8 changed files with 2,943 additions and 27 deletions.
4 changes: 2 additions & 2 deletions .scripts/release.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function run_commands($commands) {
// Setup. Version checks are here so we fail early if any deps are missing
run_commands([
"git --version",
"npm --version",
"yarn version",
"node --version",
"sphinx-build --version",

Expand All @@ -58,7 +58,7 @@ function run_commands($commands) {
run_commands(array(
"sphinx-build -b gettext docs docs/locale/pot",
"sphinx-intl build --locale-dir=docs/locale/",
"npm install && npm update",
"yarn install && yarn update",
"node .scripts/write-changelog.js",
"git add .",
"git commit -am \"chore(release): v$version\"",
Expand Down
26 changes: 17 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ matrix:
include:
# Lint checks for PHP code and composer.json
- php: 5.6
env: VARIA=true
env: JOB_NAME=commit_and_composer_lint VARIA=true
before_install:
- phpenv config-rm xdebug.ini
- composer config -g github-oauth.github.com ${GITHUB_TOKEN}
install:
- phpenv rehash
- composer travis:install
Expand All @@ -38,21 +39,24 @@ matrix:

# Build and test javascript
- php: 5.6
env: VARIA=true
env: JOB_NAME=js_tests VARIA=true
dist: trusty
before_install:
- phpenv config-rm xdebug.ini
- composer config -g github-oauth.github.com ${GITHUB_TOKEN}
install:
- npm install
- composer travis:install
- npm install -g yarn && yarn
before_script:
- composer travis:install
script:
- npm test
- yarn test

# Build docs and check for errors
# Flags used here, not in `make html`:
# -n Run in nit-picky mode. Currently, this generates warnings for all missing references.
# -W Turn warnings into errors. This means that the build stops at the first warning and sphinx-build exits with exit status 1.
- php: 5.6
env: VARIA=true
env: JOB_NAME=docs_build VARIA=true
install:
- pip install --user "Sphinx==1.3.1"
- pip install --user "sphinx-intl"
Expand All @@ -68,10 +72,11 @@ matrix:
services:
- memcached
- mysql
env: VARIA=true
env: JOB_NAME=memcache_php56 VARIA=true
before_install:
- phpenv config-rm xdebug.ini
- phpenv config-add ./.scripts/travis/memcached.ini
- composer config -g github-oauth.github.com ${GITHUB_TOKEN}
install:
- composer travis:install-with-mysql
script:
Expand All @@ -81,10 +86,11 @@ matrix:

# HHVM build
- php: hhvm-3.15
env: JOB_NAME=hhvm E2E=true
dist: trusty
sudo: required
env: E2E=true
before_install:
- composer config -g github-oauth.github.com ${GITHUB_TOKEN}
install:
- composer travis:install-with-mysql
script:
Expand All @@ -93,9 +99,10 @@ matrix:

# End to end tests
- php: 5.6
env: E2E=true
env: JOB_NAME=local_web_server E2E=true
before_install:
- phpenv config-rm xdebug.ini
- composer config -g github-oauth.github.com ${GITHUB_TOKEN}
install:
- composer travis:install-with-mysql
- php -S localhost:8888 index.php &
Expand Down Expand Up @@ -136,6 +143,7 @@ env:

## Cache dependencies
cache:
yarn: true
directories:
- $HOME/.composer/cache
- $HOME/.npm
8 changes: 4 additions & 4 deletions docs/contribute/code.rst
Original file line number Diff line number Diff line change
Expand Up @@ -283,19 +283,19 @@ Elgg uses `Karma`_ with `Jasmine`_ to run JS unit tests.
.. _Karma: http://karma-runner.github.io/0.8/index.html
.. _Jasmine: http://pivotal.github.io/jasmine/

You will need to have nodejs and npm installed.
You will need to have nodejs and yarn installed.

First install all the development dependencies:

.. code::
npm install
yarn
Run through the tests just once and then quit:

.. code::
npm test
yarn test
You can also run tests continuously during development so they run on each save:

Expand All @@ -310,7 +310,7 @@ You can run the test suite inside Chrome dev tools:

.. code::
npm run chrome
yarn run chrome
This will output a URL like ``http://localhost:9876/``.

Expand Down
6 changes: 3 additions & 3 deletions docs/contribute/docs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ Testing docs locally
--------------------
Elgg has a `grunt`_ script that automatically builds the docs, opens them in a browser
window, and automatically reloads as you make changes (the reload takes just a few
seconds). You need `npm`_ and `sphinx`_ installed to be able to use these scripts.
seconds). You need `yarn`_ and `sphinx`_ installed to be able to use these scripts.

.. code:: sh
cd path/to/elgg/
npm install
yarn
grunt
It's that easy! Grunt will continue running, watching the docs for changes and
automatically rebuilding.

.. _grunt: http://gruntjs.com/
.. _npm: https://nodejs.org/
.. _yarn: https://yarnpkg.com/
.. _sphinx: http://www.sphinx-doc.org/

Follow the existing document organization
Expand Down
4 changes: 2 additions & 2 deletions docs/contribute/releases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Requirements
* Commit access to http://github.com/Elgg/Elgg
* Admin access to https://elgg.org/
* Access to `Twitter account`_
* Node.js and NPM installed
* Node.js and Yarn installed
* Sphinx installed (``easy_install sphinx && easy_install sphinx-intl``)
* Transifex client installed (``easy_install transifex-client``)
* Transifex account with access to Elgg project
Expand Down Expand Up @@ -79,7 +79,7 @@ Install the prerequisites:

.. code:: sh
npm install elgg-conventional-changelog
yarn install elgg-conventional-changelog
easy_install sphinx
easy_install sphinx-intl
easy_install transifex-client
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/javascript.rst
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ Third-party assets

We recommend managing third-party scripts and styles with Composer.
Elgg core uses ``fxp/composer-asset-plugin`` for this purpose.
This plugin allows you to pull dependencies from the Bower or NPM package repositories,
This plugin allows you to pull dependencies from the Bower or Yarn package repositories,
but using the Composer command-line tool.

For example, to include jQuery, you could run the following Composer commands:
Expand Down
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,24 @@
},
"homepage": "https://github.com/Elgg/Elgg",
"scripts": {
"test": "node_modules/karma/bin/karma start engine/tests/js/karma.conf.js --single-run",
"chrome": "node_modules/karma/bin/karma start engine/tests/js/karma.conf.js --browsers Chrome"
"test": "karma start engine/tests/js/karma.conf.js --single-run",
"chrome": "karma start engine/tests/js/karma.conf.js --browsers Chrome"
},
"devDependencies": {
"elgg-conventional-changelog": "~0.1.2",
"grunt": "~0.4.5",
"grunt": "~1.0.1",
"grunt-contrib-clean": "~0.6.0",
"grunt-contrib-connect": "~0.9.0",
"grunt-contrib-watch": "~0.6.1",
"grunt-exec": "~0.4.6",
"grunt-open": "~0.2.3",
"jquery-mockjax": "^2.1.1",
"karma": "^0.12.32",
"karma": "^1.6",
"karma-chrome-launcher": "^0.2.3",
"karma-jasmine": "~0.2.0",
"karma-phantomjs-launcher": "~0.1",
"karma-phantomjs-launcher": "^1.0.4",
"karma-requirejs": "~0.2",
"load-grunt-config": "~0.16.0",
"phantomjs": "~1.9.7-14",
"requirejs": "~2.2.0"
}
}
Loading

0 comments on commit 888ca42

Please sign in to comment.