Skip to content

Commit

Permalink
Merge pull request #5335 from Automattic/use/yarn
Browse files Browse the repository at this point in the history
Switched dependency management, scripts and Travis to yarn.
  • Loading branch information
eliorivero committed Oct 27, 2016
2 parents fa2f1ef + fceacf1 commit 65c1c06
Show file tree
Hide file tree
Showing 15 changed files with 7,988 additions and 14 deletions.
1 change: 1 addition & 0 deletions .svnignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ _inc/build/static.dops-style.css.map
_inc/build/static.dops-style.rtl.css.map
_inc/build/style.min.rtl.css.map
.codeclimate.yml
yarn.lock
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ env:
global:
- WP_TRAVISCI=phpunit

cache:
directories:
- ~/.yarn
- ~/.nvm

# Next we define our matrix of additional build configurations to test against.
# The versions listed above will automatically create our first configuration,
# so it doesn't need to be re-defined below.
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
"url": "https://github.com/Automattic/jetpack/issues"
},
"scripts": {
"watch": "gulp watch",
"clean": "rm -rf _inc/build/*.js _inc/build/*.css _inc/build/*.map _inc/build/*.html",
"distclean": "rm -rf node_modules",
"build": "npm install && npm run build-client",
"build-client": "gulp",
"build-production": "npm run clean && npm run build && npm run build-languages && gulp languages:extract && NODE_ENV=production npm run build",
"build-languages": "gulp languages",
"test-client": "NODE_ENV=test NODE_PATH=tests:_inc/client:node_modules/@automattic/dops-components/client tests/runner.js",
"lint": "eslint _inc/client -c .eslintrc"
"watch": "tools/yarn-scripts/watch.sh",
"clean": "tools/yarn-scripts/clean.sh",
"distclean": "tools/yarn-scripts/distclean.sh",
"build": "tools/yarn-scripts/build.sh",
"build-client": "tools/yarn-scripts/build-client.sh",
"build-production": "tools/yarn-scripts/build-production.sh",
"build-languages": "tools/yarn-scripts/build-languages.sh",
"test-client": "tools/yarn-scripts/test-client.sh",
"lint": "tools/yarn-scripts/lint.sh"
},
"dependencies": {
"del": "^2.2.0",
Expand Down
9 changes: 7 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,20 @@ If you're having trouble installing 6.x, [nvm](https://www.npmjs.com/package/nvm
git clone https://github.com/Automattic/jetpack.git
```

3. Make sure the Jetpack plugin is active and run
3. Install [yarn](https://www.npmjs.com/package/yarn) package.
```
npm install -g yarn
```

4. Make sure the Jetpack plugin is active and run

```
npm run build
```

This will install npm dependencies and then build the files.

4. Open `/wp-admin/admin.php?page=jetpack` in your browser.
5. Open `/wp-admin/admin.php?page=jetpack` in your browser.

#### Production build

Expand Down
6 changes: 3 additions & 3 deletions tests/run-travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ else

gem install sass
gem install compass
npm install -g npm
npm install -g gulp-cli
npm install
npm install -g yarn
yarn install gulp-cli
yarn

if $WP_TRAVISCI; then
# Everything is fine
Expand Down
6 changes: 6 additions & 0 deletions tools/yarn-scripts/build-client.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

# This file is meant to be run as a yarn script
# Run `yarn run build-client` from the root Jetpack folder to execute it

gulp
8 changes: 8 additions & 0 deletions tools/yarn-scripts/build-languages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

# This file is meant to be run as a yarn script
# Run `yarn run build-languages` from the root Jetpack folder to execute it

gulp languages


11 changes: 11 additions & 0 deletions tools/yarn-scripts/build-production.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# This file is meant to be run as a yarn script
# Run `yarn run build-production' from the root Jetpack folder to execute it

yarn run clean && /
yarn run build && /
yarn run build-languages && /
gulp languages:extract && /
NODE_ENV=production BABEL_ENV=production yarn run build

7 changes: 7 additions & 0 deletions tools/yarn-scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# This file is meant to be run as a yarn script
# Run `yarn run build` from the root Jetpack folder to execute it

yarn
yarn run build-client
6 changes: 6 additions & 0 deletions tools/yarn-scripts/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

# This file is meant to be run as a yarn script
# Run `yarn run build-client` from the root Jetpack folder to execute it

rm -rf _inc/build/*.js _inc/build/*.css _inc/build/*.map _inc/build/*.html
6 changes: 6 additions & 0 deletions tools/yarn-scripts/distclean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

# This file is meant to be run as a yarn script
# Run `yarn run distclean` from the root Jetpack folder to execute it

rm -rf node_modules
6 changes: 6 additions & 0 deletions tools/yarn-scripts/lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

# This file is meant to be run as a yarn script
# Run `yarn run lint` from the root Jetpack folder to execute it

eslint _inc/client -c .eslintrc
7 changes: 7 additions & 0 deletions tools/yarn-scripts/test-client.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# This file is meant to be run as a yarn script
# Run `yarn run test-client` from the root Jetpack folder to execute it

NODE_ENV=test NODE_PATH=tests:_inc/client:node_modules/@automattic/dops-components/client tests/runner.js

6 changes: 6 additions & 0 deletions tools/yarn-scripts/watch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

# This file is meant to be run as a yarn script
# Run `yarn run watch' from the root Jetpack folder to execute it

gulp watch

0 comments on commit 65c1c06

Please sign in to comment.