Skip to content

Commit

Permalink
Yarn as a dev dep and auto fetch and install mobile code
Browse files Browse the repository at this point in the history
* Yarn is installed locally as a development dependency
* The mobile submodule is updated in preinstall
* The mobile packages are installed in preinstall as well
* Yarn is executed by providing the working (sub)directory as a
parameter
* No need to install yarn globally in Travis
  • Loading branch information
hypest committed Sep 17, 2018
1 parent 60a4935 commit 5eaf120
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 19 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ before_install:
}
- nvm install && nvm use
- npm install npm -g
- npm install yarn -g

branches:
only:
Expand Down
15 changes: 0 additions & 15 deletions bin/install-node-nvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,6 @@ npm install
# Make sure npm is up-to-date
npm install npm -g

# Check if yarn is installed
if [ "$TRAVIS" != "true" ] && ! command_exists "yarn"; then
if ask "$(error_message "Yarn isn't installed, would you like to download and install it automatically?")" Y; then
echo -en $(status_message "Installing yarn..." )
npm install -g yarn >/dev/null 2>&1
echo ' done!'
else
echo -e $(error_message "")
echo -e $(error_message "Please install Yarn manually, then re-run the setup script to continue.")
echo -e $(error_message "Yarn installation instructions can be found here: $(action_format "https://yarnpkg.com/lang/en/docs/install/#install-via-npm")")
fi

exit 1
fi

# There was a bug in NPM that caused changes in package-lock.json. Handle that.
if [ "$TRAVIS" != "true" ] && ! git diff --exit-code package-lock.json >/dev/null; then
if ask "$(warning_message "Your package-lock.json changed, which may mean there's an issue with your NPM cache. Would you like to try and automatically clean it up?" )" N 10; then
Expand Down
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@
"webpack": "4.8.3",
"webpack-cli": "2.1.3",
"webpack-livereload-plugin": "2.1.1",
"webpack-rtl-plugin": "github:yoavf/webpack-rtl-plugin#develop"
"webpack-rtl-plugin": "github:yoavf/webpack-rtl-plugin#develop",
"yarn": "1.9.4"
},
"npmPackageJsonLintConfig": {
"extends": "@wordpress/npm-package-json-lint-config",
Expand Down Expand Up @@ -175,7 +176,10 @@
"lint-css": "stylelint '**/*.scss'",
"lint-css:fix": "stylelint '**/*.scss' --fix",
"package-plugin": "./bin/build-plugin-zip.sh",
"postinstall": "npm run check-licenses && npm run build:packages",
"mobile-submodule-update": "git submodule update --init --recursive",
"mobile-install": "npx yarn --cwd gutenberg-mobile install",
"preinstall": "npm run mobile-submodule-update && npm run mobile-install && npm run check-licenses && npm run build:packages",
"postinstall": "npx yarn --cwd gutenberg-mobile install && npm run check-licenses && npm run build:packages",
"pot-to-php": "./bin/pot-to-php.js",
"precommit": "lint-staged",
"publish:check": "npm run build:packages && lerna updated",
Expand All @@ -185,7 +189,7 @@
"pretest-e2e": "concurrently \"./bin/reset-e2e-tests.sh\" \"npm run build\"",
"test-e2e": "cross-env JEST_PUPPETEER_CONFIG=test/e2e/puppeteer.config.js wp-scripts test-unit-js --config test/e2e/jest.config.json --runInBand",
"test-e2e:watch": "npm run test-e2e -- --watch",
"test-mobile": "cd gutenberg-mobile; yarn test:inside-gb; cd ..;",
"test-mobile": "npx yarn --cwd gutenberg-mobile test:inside-gb",
"test-php": "npm run lint-php && npm run test-unit-php",
"test-unit": "wp-scripts test-unit-js --config test/unit/jest.config.json",
"test-unit:coverage": "npm run test-unit -- --coverage",
Expand Down

0 comments on commit 5eaf120

Please sign in to comment.