parent
213baa37b0
commit
f48b343af1
|
@ -27,10 +27,9 @@ jobs:
|
||||||
- checkout:
|
- checkout:
|
||||||
<<: *post_checkout
|
<<: *post_checkout
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: angular-{{ .Branch }}-{{ checksum "npm-shrinkwrap.json" }}
|
key: angular-{{ .Branch }}-{{ checksum "yarn.lock" }}
|
||||||
|
|
||||||
- run: npm install
|
- run: yarn install
|
||||||
- run: npm run postinstall
|
|
||||||
- run: ./node_modules/.bin/gulp lint
|
- run: ./node_modules/.bin/gulp lint
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
@ -39,12 +38,12 @@ jobs:
|
||||||
- checkout:
|
- checkout:
|
||||||
<<: *post_checkout
|
<<: *post_checkout
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: angular-{{ .Branch }}-{{ checksum "npm-shrinkwrap.json" }}
|
key: angular-{{ .Branch }}-{{ checksum "yarn.lock" }}
|
||||||
|
|
||||||
- run: bazel run @nodejs//:npm install
|
- run: bazel run @yarn//:yarn
|
||||||
- run: bazel build packages/...
|
- run: bazel build packages/...
|
||||||
- save_cache:
|
- save_cache:
|
||||||
key: angular-{{ .Branch }}-{{ checksum "npm-shrinkwrap.json" }}
|
key: angular-{{ .Branch }}-{{ checksum "yarn.lock" }}
|
||||||
paths:
|
paths:
|
||||||
- "node_modules"
|
- "node_modules"
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,9 @@ repository (google3).
|
||||||
|
|
||||||
That repository defines dependencies on specific versions of
|
That repository defines dependencies on specific versions of
|
||||||
all the tools. You can run the tools Bazel installed, for
|
all the tools. You can run the tools Bazel installed, for
|
||||||
example rather than `npm install` (which depends on whatever
|
example rather than `yarn install` (which depends on whatever
|
||||||
version you have installed on your machine), you can
|
version you have installed on your machine), you can
|
||||||
`bazel run @build_bazel_rules_typescript_node//:bin/npm install`.
|
`bazel run @yarn//:yarn`.
|
||||||
|
|
||||||
Bazel accepts a lot of options. We check in some options in the
|
Bazel accepts a lot of options. We check in some options in the
|
||||||
`.bazelrc` file. See the [bazelrc doc]. For example, if you don't
|
`.bazelrc` file. See the [bazelrc doc]. For example, if you don't
|
||||||
|
|
|
@ -26,6 +26,8 @@ following products on your development machine:
|
||||||
(version `>=3.10.7 <4.0.0`), which comes with Node. Depending on your system, you can install Node either from
|
(version `>=3.10.7 <4.0.0`), which comes with Node. Depending on your system, you can install Node either from
|
||||||
source or as a pre-packaged bundle.
|
source or as a pre-packaged bundle.
|
||||||
|
|
||||||
|
* [Yarn](https://yarnpkg.com) (version `>=1.0.2 <2.0.0`) which is used to install dependencies.
|
||||||
|
|
||||||
* [Java Development Kit](http://www.oracle.com/technetwork/es/java/javase/downloads/index.html) which is used
|
* [Java Development Kit](http://www.oracle.com/technetwork/es/java/javase/downloads/index.html) which is used
|
||||||
to execute the selenium standalone server for e2e testing.
|
to execute the selenium standalone server for e2e testing.
|
||||||
|
|
||||||
|
@ -56,29 +58,13 @@ Next, install the JavaScript modules needed to build and test Angular:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
# Install Angular project dependencies (package.json)
|
# Install Angular project dependencies (package.json)
|
||||||
npm install
|
yarn install
|
||||||
```
|
```
|
||||||
|
|
||||||
**Optional**: In this document, we make use of project local `npm` package scripts and binaries
|
**Optional**: In this document, we make use of project local `npm` package scripts and binaries
|
||||||
(stored under `./node_modules/.bin`) by prefixing these command invocations with `$(npm bin)`; in
|
(stored under `./node_modules/.bin`) by prefixing these command invocations with `$(npm bin)`; in
|
||||||
particular `gulp` and `protractor` commands. If you prefer, you can drop this path prefix by either:
|
particular `gulp` and `protractor` commands. If you prefer, you can drop this path prefix by either:
|
||||||
|
|
||||||
*Option 1*: globally installing these two packages as follows:
|
|
||||||
|
|
||||||
* `npm install -g gulp` (you might need to prefix this command with `sudo`)
|
|
||||||
* `npm install -g protractor` (you might need to prefix this command with `sudo`)
|
|
||||||
|
|
||||||
Since global installs can become stale, and required versions can vary by project, we avoid their
|
|
||||||
use in these instructions.
|
|
||||||
|
|
||||||
*Option 2*: globally installing the package `npm-run` by running `npm install -g npm-run`
|
|
||||||
(you might need to prefix this command with `sudo`). You will then be able to run locally installed
|
|
||||||
package scripts by invoking: e.g., `npm-run gulp build`
|
|
||||||
(see [npm-run project page](https://github.com/timoxley/npm-run) for more details).
|
|
||||||
|
|
||||||
|
|
||||||
*Option 3*: defining a bash alias like `alias nbin='PATH=$(npm bin):$PATH'` as detailed in this
|
|
||||||
[Stack Overflow answer](http://stackoverflow.com/questions/9679932/how-to-use-package-installed-locally-in-node-modules/15157360#15157360) and used like this: e.g., `nbin gulp build`.
|
|
||||||
|
|
||||||
## Installing Bower Modules
|
## Installing Bower Modules
|
||||||
|
|
||||||
|
|
|
@ -24,11 +24,8 @@ Note that the `package.json` file uses a special `file://../../dist` scheme
|
||||||
to reference the Angular packages, so that the locally-built Angular
|
to reference the Angular packages, so that the locally-built Angular
|
||||||
is installed into the test app.
|
is installed into the test app.
|
||||||
|
|
||||||
Also, beware of floating (non-shrinkwrapped) dependencies. If in doubt
|
Also, beware of floating (non-locked) dependencies. If in doubt
|
||||||
you can install the package directly from `file:../../node_modules`. For example,
|
you can install the package directly from `file:../../node_modules`.
|
||||||
this is useful for protractor, which has a slow post-install step
|
|
||||||
(`webdriver-manager update`) that can be skipped when the package from
|
|
||||||
Angular's `node_modules` is installed.
|
|
||||||
|
|
||||||
## Running integration tests
|
## Running integration tests
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
"protractor": "file:../../node_modules/protractor"
|
"protractor": "file:../../node_modules/protractor"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"postinstall": "webdriver-manager update --gecko false",
|
||||||
"closure": "java -jar node_modules/google-closure-compiler/compiler.jar --flagfile closure.conf",
|
"closure": "java -jar node_modules/google-closure-compiler/compiler.jar --flagfile closure.conf",
|
||||||
"test": "ngc && yarn run closure && concurrently \"yarn run serve\" \"yarn run protractor\" --kill-others --success first",
|
"test": "ngc && yarn run closure && concurrently \"yarn run serve\" \"yarn run protractor\" --kill-others --success first",
|
||||||
"serve": "lite-server -c e2e/browser.config.json",
|
"serve": "lite-server -c e2e/browser.config.json",
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"postinstall": "webdriver-manager update --gecko false",
|
||||||
"test": "concurrently \"npm run serve\" \"npm run protractor\" --kill-others --success first",
|
"test": "concurrently \"npm run serve\" \"npm run protractor\" --kill-others --success first",
|
||||||
"serve": "lite-server -c bs-config.e2e.json",
|
"serve": "lite-server -c bs-config.e2e.json",
|
||||||
"preprotractor": "tsc -p e2e",
|
"preprotractor": "tsc -p e2e",
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
"protractor": "file:../../node_modules/protractor"
|
"protractor": "file:../../node_modules/protractor"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"postinstall": "webdriver-manager update --gecko false",
|
||||||
"closure": "java -jar node_modules/google-closure-compiler/compiler.jar --flagfile closure.conf",
|
"closure": "java -jar node_modules/google-closure-compiler/compiler.jar --flagfile closure.conf",
|
||||||
"test": "ngc && yarn run closure && concurrently \"yarn run serve\" \"yarn run protractor\" --kill-others --success first",
|
"test": "ngc && yarn run closure && concurrently \"yarn run serve\" \"yarn run protractor\" --kill-others --success first",
|
||||||
"serve": "lite-server -c e2e/browser.config.json",
|
"serve": "lite-server -c e2e/browser.config.json",
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,51 +0,0 @@
|
||||||
All of our npm dependencies are locked via the `npm-shrinkwrap.json` file for the following reasons:
|
|
||||||
|
|
||||||
- our project has lots of dependencies which update at unpredictable times, so it's important that
|
|
||||||
we update them explicitly once in a while rather than implicitly when any of us runs npm install
|
|
||||||
- locked dependencies allow us to do reuse npm cache on travis, significantly speeding up our builds
|
|
||||||
(by 5 minutes or more)
|
|
||||||
- locked dependencies allow us to detect when node_modules folder is out of date after a branch switch
|
|
||||||
which allows us to build the project with the correct dependencies every time
|
|
||||||
|
|
||||||
We also generate `npm-shrinkwrap.clean.js` file which is used during code reviews or debugging to easily review what has actually changed without extra noise.
|
|
||||||
|
|
||||||
To add a new dependency do the following:
|
|
||||||
|
|
||||||
1. if you are on linux or windows, then use MacOS or ask someone with MacOS to perform the
|
|
||||||
installation. This is due to an optional `fsevents` dependency that is really required on MacOS
|
|
||||||
to get good performance from file watching.
|
|
||||||
2. make sure you are in sync with `upstream/master`
|
|
||||||
3. ensure that your `node_modules` directory is not stale by running `npm install`
|
|
||||||
4. add a new dependency via `npm install --save-dev <packagename>`
|
|
||||||
5. run `./tools/npm/reshrinkwrap`
|
|
||||||
6. these steps should change 3 files: `package.json`, `npm-shrinkwrap.json` and `npm-shrinkwrap.clean.json`
|
|
||||||
7. commit changes to these three files and you are done
|
|
||||||
|
|
||||||
|
|
||||||
To update existing dependency do the following:
|
|
||||||
|
|
||||||
1. if you are on linux or windows, then use MacOS or ask someone with MacOS to perform the
|
|
||||||
installation. This is due to an optional `fsevents` dependency that is really required on MacOS
|
|
||||||
to get good performance from file watching.
|
|
||||||
2. make sure you are in sync with `upstream/master`: `git fetch upstream && git rebase upstream/master`
|
|
||||||
3. ensure that your `node_modules` directory is not stale by running `npm install`
|
|
||||||
4. run `npm install --save-dev <packagename>@<version|latest>` or `npm update <packagename>` to
|
|
||||||
update to the latest version that matches version constraint in `package.json`
|
|
||||||
5. run `./tools/npm/reshrinkwrap`
|
|
||||||
6. these steps should change 2 files: `npm-shrinkwrap.json` and `npm-shrinkwrap.clean.json`.
|
|
||||||
Optionally if you used `npm install ...` in the first step, `package.json` might be modified as
|
|
||||||
well.
|
|
||||||
7. commit changes to these three files and you are done
|
|
||||||
|
|
||||||
|
|
||||||
To Remove an existing dependency do the following:
|
|
||||||
|
|
||||||
1. if you are on linux or windows, then use MacOS or ask someone with MacOS to perform the
|
|
||||||
installation. This is due to an optional `fsevents` dependency that is really required on MacOS
|
|
||||||
to get good performance from file watching.
|
|
||||||
2. make sure you are in sync with `upstream/master`: `git fetch upstream && git rebase upstream/master`
|
|
||||||
3. ensure that your `node_modules` directory is not stale by running `npm install`
|
|
||||||
4. run `npm uninstall --save-dev <packagename>@<version|latest>`
|
|
||||||
5. run `./tools/npm/reshrinkwrap`
|
|
||||||
6. these steps should change 3 files: `package.json`, `npm-shrinkwrap.json` and `npm-shrinkwrap.clean.json`.
|
|
||||||
7. commit changes to these three files and you are done
|
|
146
package.json
146
package.json
|
@ -17,7 +17,8 @@
|
||||||
"url": "https://github.com/angular/angular.git"
|
"url": "https://github.com/angular/angular.git"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"postinstall": "node tools/npm/copy-npm-shrinkwrap && webdriver-manager update",
|
"preinstall": "node -e \"if(process.env.npm_execpath.indexOf('yarn') === -1) throw new Error('Please use Yarn instead of NPM to install dependencies. See: https://yarnpkg.com/lang/en/docs/install/')\"",
|
||||||
|
"postinstall": "webdriver-manager update --gecko false",
|
||||||
"check-env": "gulp check-env"
|
"check-env": "gulp check-env"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -28,86 +29,87 @@
|
||||||
"zone.js": "^0.8.12"
|
"zone.js": "^0.8.12"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"fsevents": "^1.0.14"
|
"fsevents": "1.0.17"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@bazel/typescript": "0.1.x",
|
"@bazel/typescript": "0.1.x",
|
||||||
"@types/angularjs": "^1.5.13-alpha",
|
"@types/angularjs": "1.5.13-alpha",
|
||||||
"@types/base64-js": "^1.2.5",
|
"@types/base64-js": "1.2.5",
|
||||||
"@types/chokidar": "^1.1.0",
|
"@types/chokidar": "1.7.3",
|
||||||
"@types/fs-extra": "0.0.22-alpha",
|
"@types/fs-extra": "0.0.22-alpha",
|
||||||
"@types/hammerjs": "^2.0.33",
|
"@types/hammerjs": "2.0.33",
|
||||||
"@types/jasmine": "^2.2.22-alpha",
|
"@types/jasmine": "2.2.22-alpha",
|
||||||
"@types/node": "^6.0.84",
|
"@types/node": "6.0.88",
|
||||||
"@types/selenium-webdriver": "^3.0.6",
|
"@types/selenium-webdriver": "3.0.6",
|
||||||
"@types/systemjs": "^0.19.32",
|
"@types/systemjs": "0.19.32",
|
||||||
"angular": "^1.5.0",
|
"angular": "1.5.0",
|
||||||
"angular-animate": "^1.5.0",
|
"angular-animate": "1.5.0",
|
||||||
"angular-mocks": "^1.5.0",
|
"angular-mocks": "1.5.0",
|
||||||
"base64-js": "^1.2.0",
|
"base64-js": "1.2.0",
|
||||||
"bower": "^1.3.12",
|
"bower": "1.7.2",
|
||||||
"browserstacktunnel-wrapper": "^1.4.2",
|
"browserstacktunnel-wrapper": "1.4.2",
|
||||||
"canonical-path": "0.0.2",
|
"canonical-path": "0.0.2",
|
||||||
"chokidar": "^1.1.0",
|
"chokidar": "1.4.2",
|
||||||
"clang-format": "^1.0.32",
|
"clang-format": "1.0.41",
|
||||||
"cldr": "^4.5.0",
|
"cldr": "4.5.0",
|
||||||
"cldr-data-downloader": "^0.3.2",
|
"cldr-data-downloader": "0.3.2",
|
||||||
"cldrjs": "^0.5.0",
|
"cldrjs": "0.5.0",
|
||||||
"conventional-changelog": "^1.1.0",
|
"conventional-changelog": "1.1.0",
|
||||||
"cors": "^2.7.1",
|
"cors": "2.7.1",
|
||||||
"dgeni": "^0.4.2",
|
"dgeni": "0.4.2",
|
||||||
"dgeni-packages": "^0.16.5",
|
"dgeni-packages": "0.16.5",
|
||||||
"domino": "^1.0.29",
|
"domino": "1.0.29",
|
||||||
"entities": "^1.1.1",
|
"entities": "1.1.1",
|
||||||
"firebase-tools": "^3.9.2",
|
"firebase-tools": "3.9.2",
|
||||||
"firefox-profile": "^0.3.4",
|
"firefox-profile": "0.3.11",
|
||||||
"fs-extra": "^0.26.3",
|
"fs-extra": "0.26.3",
|
||||||
"glob": "^4.0.6",
|
"glob": "4.5.3",
|
||||||
"gulp": "^3.8.8",
|
"gulp": "3.9.1",
|
||||||
"gulp-clang-format": "^1.0.23",
|
"gulp-clang-format": "1.0.23",
|
||||||
"gulp-connect": "^2.3.1",
|
"gulp-connect": "2.3.1",
|
||||||
"gulp-conventional-changelog": "^1.1.0",
|
"gulp-conventional-changelog": "1.1.0",
|
||||||
"gulp-tslint": "^7.0.1",
|
"gulp-tslint": "7.0.1",
|
||||||
"hammerjs": "^2.0.8",
|
"hammerjs": "2.0.8",
|
||||||
"incremental-dom": "^0.4.1",
|
"incremental-dom": "0.4.1",
|
||||||
"jasmine": "^2.4.1",
|
"jasmine": "2.4.1",
|
||||||
"jasmine-core": "^2.4.1",
|
"jasmine-core": "2.4.1",
|
||||||
"jpm": "1.0.0",
|
"jpm": "1.0.0",
|
||||||
"karma": "^0.13.20",
|
"karma": "0.13.20",
|
||||||
"karma-browserstack-launcher": "^0.1.9",
|
"karma-browserstack-launcher": "0.1.9",
|
||||||
"karma-chrome-launcher": "^0.2.0",
|
"karma-chrome-launcher": "0.2.0",
|
||||||
"karma-jasmine": "^0.3.6",
|
"karma-jasmine": "0.3.6",
|
||||||
"karma-sauce-launcher": "^0.3.0",
|
"karma-sauce-launcher": "0.3.0",
|
||||||
"karma-sourcemap-loader": "^0.3.6",
|
"karma-sourcemap-loader": "0.3.6",
|
||||||
"madge": "0.5.0",
|
"madge": "0.5.0",
|
||||||
"minimist": "^1.2.0",
|
"minimist": "1.2.0",
|
||||||
"nan": "^2.4.0",
|
"nan": "2.4.0",
|
||||||
"node-uuid": "1.4.x",
|
"node-uuid": "1.4.8",
|
||||||
"protractor": "5.1.x",
|
"protractor": "5.1.2",
|
||||||
"react": "^0.14.0",
|
"react": "0.14.9",
|
||||||
"rewire": "^2.3.3",
|
"rewire": "2.5.2",
|
||||||
"rho": "^0.3.0",
|
"rho": "0.3.0",
|
||||||
"rollup": "^0.47.4",
|
"rollup": "0.47.4",
|
||||||
"rollup-plugin-commonjs": "^8.1.0",
|
"rollup-plugin-commonjs": "8.1.0",
|
||||||
"rollup-plugin-node-resolve": "^3.0.0",
|
"rollup-plugin-node-resolve": "3.0.0",
|
||||||
"rollup-plugin-sourcemaps": "^0.4.2",
|
"rollup-plugin-sourcemaps": "0.4.2",
|
||||||
"selenium-webdriver": "3.0.x",
|
"selenium-webdriver": "3.0.x",
|
||||||
"semver": "^5.1.0",
|
"semver": "5.1.0",
|
||||||
"sorcery": "^0.10.0",
|
"sorcery": "0.10.0",
|
||||||
"source-map": "^0.5.6",
|
"source-map": "0.5.6",
|
||||||
"source-map-support": "^0.4.2",
|
"source-map-support": "0.4.2",
|
||||||
"systemjs": "0.18.10",
|
"systemjs": "0.18.10",
|
||||||
"ts-api-guardian": "^0.2.2",
|
"ts-api-guardian": "0.2.2",
|
||||||
"tsickle": "0.24.x",
|
"tsickle": "0.24.x",
|
||||||
"tslint": "^4.1.1",
|
"tslint": "4.1.1",
|
||||||
"tslint-eslint-rules": "^3.1.0",
|
"tslint-eslint-rules": "3.1.0",
|
||||||
"typescript": "^2.4.2",
|
"typescript": "2.4.2",
|
||||||
"universal-analytics": "^0.3.9",
|
"uglify-js": "2.8.29",
|
||||||
"vlq": "^0.2.2",
|
"universal-analytics": "0.3.10",
|
||||||
"vrsource-tslint-rules": "^4.0.0",
|
"vlq": "0.2.2",
|
||||||
"webpack": "^1.12.6",
|
"vrsource-tslint-rules": "4.0.0",
|
||||||
"xhr2": "^0.1.4",
|
"webpack": "1.12.9",
|
||||||
"yargs": "^3.31.0",
|
"xhr2": "0.1.4",
|
||||||
"yarn": "^0.19.1"
|
"yargs": "3.31.0",
|
||||||
|
"yarn": "1.0.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,6 @@ echo "#################################"
|
||||||
echo "Running platform-server end to end tests"
|
echo "Running platform-server end to end tests"
|
||||||
echo "#################################"
|
echo "#################################"
|
||||||
|
|
||||||
npm install
|
yarn install
|
||||||
|
|
||||||
npm run test
|
npm run test
|
||||||
|
|
|
@ -35,9 +35,8 @@ fi
|
||||||
#######################
|
#######################
|
||||||
|
|
||||||
setEnvVar NODE_VERSION 6.9.5
|
setEnvVar NODE_VERSION 6.9.5
|
||||||
setEnvVar NPM_VERSION 3.10.7 # do not upgrade to >3.10.8 unless https://github.com/npm/npm/issues/14042 is resolved
|
|
||||||
setEnvVar YARN_VERSION 1.0.2
|
setEnvVar YARN_VERSION 1.0.2
|
||||||
setEnvVar SAUCE_CONNECT_VERSION 4.3.11
|
setEnvVar SAUCE_CONNECT_VERSION 4.4.9
|
||||||
setEnvVar ANGULAR_CLI_VERSION 1.4.0-rc.2
|
setEnvVar ANGULAR_CLI_VERSION 1.4.0-rc.2
|
||||||
setEnvVar PROJECT_ROOT $(cd ${thisDir}/../..; pwd)
|
setEnvVar PROJECT_ROOT $(cd ${thisDir}/../..; pwd)
|
||||||
|
|
||||||
|
|
|
@ -28,24 +28,17 @@ mkdir -p ${LOGS_DIR}
|
||||||
# Install node
|
# Install node
|
||||||
#nvm install ${NODE_VERSION}
|
#nvm install ${NODE_VERSION}
|
||||||
|
|
||||||
# Install version of npm that we are locked against
|
|
||||||
travisFoldStart "install-npm"
|
# Install version of yarn that we are locked against
|
||||||
npm install -g npm@${NPM_VERSION}
|
travisFoldStart "install-yarn"
|
||||||
travisFoldEnd "install-npm"
|
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version "${YARN_VERSION}"
|
||||||
|
travisFoldEnd "install-yarn"
|
||||||
|
|
||||||
|
|
||||||
# Install all npm dependencies according to shrinkwrap.json
|
# Install all npm dependencies according to yarn.lock
|
||||||
travisFoldStart "npm-install"
|
travisFoldStart "yarn-install"
|
||||||
node tools/npm/check-node-modules --purge || npm install
|
node tools/npm/check-node-modules --purge || yarn install
|
||||||
travisFoldEnd "npm-install"
|
travisFoldEnd "yarn-install"
|
||||||
|
|
||||||
|
|
||||||
# Install Selenium WebDriver
|
|
||||||
travisFoldStart "webdriver-manager-update"
|
|
||||||
# --gecko false prevents webdriver-manager to ping Github for updates
|
|
||||||
# which can hit the Github api limit.
|
|
||||||
$(npm bin)/webdriver-manager update --gecko false
|
|
||||||
travisFoldEnd "webdriver-manager-update"
|
|
||||||
|
|
||||||
|
|
||||||
# Install bower packages
|
# Install bower packages
|
||||||
|
@ -54,14 +47,6 @@ travisFoldStart "bower-install"
|
||||||
travisFoldEnd "bower-install"
|
travisFoldEnd "bower-install"
|
||||||
|
|
||||||
|
|
||||||
if [[ ${TRAVIS} && (${CI_MODE} == "e2e" || ${CI_MODE} == "e2e_2" || ${CI_MODE} == "aio" || ${CI_MODE} == "aio_e2e" || ${CI_MODE} == "aio_tools_test") ]]; then
|
|
||||||
# Install version of yarn that we are locked against
|
|
||||||
travisFoldStart "install-yarn"
|
|
||||||
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version "${YARN_VERSION}"
|
|
||||||
travisFoldEnd "install-yarn"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
if [[ ${TRAVIS} && (${CI_MODE} == "aio" || ${CI_MODE} == "aio_e2e" || ${CI_MODE} == "aio_tools_test") ]]; then
|
if [[ ${TRAVIS} && (${CI_MODE} == "aio" || ${CI_MODE} == "aio_e2e" || ${CI_MODE} == "aio_tools_test") ]]; then
|
||||||
# angular.io: Install all yarn dependencies according to angular.io/yarn.lock
|
# angular.io: Install all yarn dependencies according to angular.io/yarn.lock
|
||||||
travisFoldStart "yarn-install.aio"
|
travisFoldStart "yarn-install.aio"
|
||||||
|
|
|
@ -22,7 +22,7 @@ CONNECT_URL="https://saucelabs.com/downloads/sc-${SAUCE_CONNECT_VERSION}-linux.t
|
||||||
CONNECT_DIR="/tmp/sauce-connect-$RANDOM"
|
CONNECT_DIR="/tmp/sauce-connect-$RANDOM"
|
||||||
CONNECT_DOWNLOAD="sc-latest-linux.tar.gz"
|
CONNECT_DOWNLOAD="sc-latest-linux.tar.gz"
|
||||||
|
|
||||||
# logging disabled because it's seems to be overwhelming travis and causing flakes
|
# logging disabled because it seems to be overwhelming travis and causing flakes
|
||||||
# when we are cat-ing the log in print-logs.sh
|
# when we are cat-ing the log in print-logs.sh
|
||||||
# CONNECT_LOG="$LOGS_DIR/sauce-connect"
|
# CONNECT_LOG="$LOGS_DIR/sauce-connect"
|
||||||
# CONNECT_STDOUT="$LOGS_DIR/sauce-connect.stdout"
|
# CONNECT_STDOUT="$LOGS_DIR/sauce-connect.stdout"
|
||||||
|
|
|
@ -30,7 +30,7 @@ if (+process.version[1] < 5) {
|
||||||
try {
|
try {
|
||||||
semver = require('semver');
|
semver = require('semver');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
issues.push('Looks like you are missing some npm dependencies. Run: npm install');
|
issues.push('Looks like you are missing some npm dependencies. Run: `yarn install`');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (issues.length) {
|
if (issues.length) {
|
||||||
|
@ -46,7 +46,7 @@ if (issues.length) {
|
||||||
try {
|
try {
|
||||||
checkNodeModules = require('./npm/check-node-modules.js');
|
checkNodeModules = require('./npm/check-node-modules.js');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
issues.push('Looks like you are missing some npm dependencies. Run: npm install');
|
issues.push('Looks like you are missing some npm dependencies. Run: `yarn install`');
|
||||||
throw e;
|
throw e;
|
||||||
} finally {
|
} finally {
|
||||||
// print warnings and move on, the next steps will likely fail, but hey, we warned them.
|
// print warnings and move on, the next steps will likely fail, but hey, we warned them.
|
||||||
|
@ -65,46 +65,37 @@ if (require.main === module) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkEnvironment(reqs) {
|
function checkEnvironment(reqs) {
|
||||||
exec('npm --version', function(npmErr, npmStdout) {
|
|
||||||
exec('yarn --version', function(yarnErr, yarnStdout) {
|
exec('yarn --version', function(yarnErr, yarnStdout) {
|
||||||
var foundNodeVersion = process.version;
|
var foundNodeVersion = process.version;
|
||||||
var foundNpmVersion = semver.clean(npmStdout);
|
|
||||||
var foundYarnVersion = !yarnErr && semver.clean(yarnStdout);
|
var foundYarnVersion = !yarnErr && semver.clean(yarnStdout);
|
||||||
var issues = [];
|
var issues = [];
|
||||||
|
|
||||||
|
|
||||||
if (!semver.satisfies(foundNodeVersion, reqs.requiredNodeVersion)) {
|
if (!semver.satisfies(foundNodeVersion, reqs.requiredNodeVersion)) {
|
||||||
issues.push(
|
issues.push(
|
||||||
'You are running unsupported node version. Found: ' + foundNodeVersion + ' Expected: ' +
|
'You are running unsupported node version. Found: ' + foundNodeVersion + ' Expected: ' +
|
||||||
reqs.requiredNodeVersion + '. Use nvm to update your node version.');
|
reqs.requiredNodeVersion + '. Use nvm to update your node version.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!semver.satisfies(foundNpmVersion, reqs.requiredNpmVersion)) {
|
|
||||||
issues.push(
|
|
||||||
'You are running unsupported npm version. Found: ' + foundNpmVersion + ' Expected: ' +
|
|
||||||
reqs.requiredNpmVersion + '. Run: npm update -g npm');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (yarnErr) {
|
if (yarnErr) {
|
||||||
issues.push(
|
issues.push(
|
||||||
'You don\'t have yarn globally installed. This is required if you want to work on ' +
|
'You don\'t have yarn globally installed. This is required because we use yarn to ' +
|
||||||
'certain areas, such as `aio/` and `integration/`. Installation instructions: ' +
|
'ensure that we all use the exact same npm dependencies. Installation instructions: ' +
|
||||||
'https://yarnpkg.com/lang/en/docs/install/');
|
'https://yarnpkg.com/lang/en/docs/install/');
|
||||||
} else if (!semver.satisfies(foundYarnVersion, reqs.requiredYarnVersion)) {
|
} else if (!semver.satisfies(foundYarnVersion, reqs.requiredYarnVersion)) {
|
||||||
issues.push(
|
issues.push(
|
||||||
'You are running unsupported yarn version. Found: ' + foundYarnVersion + ' Expected: ' +
|
'You are running an unsupported yarn version. Found: ' + foundYarnVersion +
|
||||||
reqs.requiredYarnVersion + '. This is required if you want to work on ' +
|
' Expected: ' + reqs.requiredYarnVersion +
|
||||||
'certain areas, such as `aio/` and `integration/`. See: ' +
|
'. This is required because we use yarn to ' +
|
||||||
|
'ensure that we all use the exact same npm dependencies. Installation instructions: ' +
|
||||||
'https://yarnpkg.com/lang/en/docs/install/');
|
'https://yarnpkg.com/lang/en/docs/install/');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!checkNodeModules()) {
|
if (!checkNodeModules()) {
|
||||||
issues.push(
|
issues.push(
|
||||||
'Your node_modules directory is stale or out of sync with npm-shrinkwrap.json. Run: npm install');
|
'Your node_modules directory is stale or out of sync with yarn.lock. Run: yarn install');
|
||||||
}
|
}
|
||||||
|
|
||||||
printWarning(issues);
|
printWarning(issues);
|
||||||
})
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,16 +10,17 @@
|
||||||
|
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
|
var childProcess = require('child_process');
|
||||||
|
|
||||||
var NPM_SHRINKWRAP_FILE = 'npm-shrinkwrap.json';
|
|
||||||
var NPM_SHRINKWRAP_CACHED_FILE = 'node_modules/.npm-shrinkwrap.cached.json';
|
|
||||||
var FS_OPTS = {encoding: 'utf-8'};
|
|
||||||
var PROJECT_ROOT = path.join(__dirname, '../../');
|
var PROJECT_ROOT = path.join(__dirname, '../../');
|
||||||
|
|
||||||
|
|
||||||
function checkNodeModules(logOutput, purgeIfStale) {
|
function checkNodeModules(logOutput, purgeIfStale) {
|
||||||
var nodeModulesOK = _checkCache(NPM_SHRINKWRAP_FILE, NPM_SHRINKWRAP_CACHED_FILE);
|
var yarnCheck = childProcess.spawnSync(
|
||||||
|
'./node_modules/.bin/yarn check --integrity',
|
||||||
|
{shell: true, cwd: path.resolve(__dirname, '../..')});
|
||||||
|
|
||||||
|
var nodeModulesOK = yarnCheck.status === 0;
|
||||||
if (nodeModulesOK) {
|
if (nodeModulesOK) {
|
||||||
if (logOutput) console.log(':-) npm dependencies are looking good!');
|
if (logOutput) console.log(':-) npm dependencies are looking good!');
|
||||||
} else {
|
} else {
|
||||||
|
@ -34,20 +35,6 @@ function checkNodeModules(logOutput, purgeIfStale) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function _checkCache(markerFile, cacheMarkerFile) {
|
|
||||||
var absoluteMarkerFilePath = path.join(PROJECT_ROOT, markerFile);
|
|
||||||
var absoluteCacheMarkerFilePath = path.join(PROJECT_ROOT, cacheMarkerFile);
|
|
||||||
|
|
||||||
|
|
||||||
if (!fs.existsSync(absoluteCacheMarkerFilePath)) return false;
|
|
||||||
|
|
||||||
var markerContent = fs.readFileSync(absoluteMarkerFilePath, FS_OPTS);
|
|
||||||
var cacheMarkerContent = fs.readFileSync(absoluteCacheMarkerFilePath, FS_OPTS);
|
|
||||||
|
|
||||||
return markerContent == cacheMarkerContent;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom implementation of recursive `rm` because we can't rely on the state of node_modules to
|
* Custom implementation of recursive `rm` because we can't rely on the state of node_modules to
|
||||||
* pull in existing module.
|
* pull in existing module.
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
#!/usr/bin/env node
|
|
||||||
/**
|
|
||||||
* @license
|
|
||||||
* Copyright Google Inc. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Use of this source code is governed by an MIT-style license that can be
|
|
||||||
* found in the LICENSE file at https://angular.io/license
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* this script is just a temporary solution to deal with the issue of npm outputting the npm
|
|
||||||
* shrinkwrap file in an unstable manner.
|
|
||||||
*
|
|
||||||
* See: https://github.com/npm/npm/issues/3581
|
|
||||||
*/
|
|
||||||
|
|
||||||
const fs = require('fs');
|
|
||||||
const path = require('path');
|
|
||||||
|
|
||||||
|
|
||||||
function cleanModule(moduleRecord) {
|
|
||||||
// keep `resolve` properties for git dependencies, delete otherwise
|
|
||||||
delete moduleRecord.from;
|
|
||||||
if (!(moduleRecord.resolved && moduleRecord.resolved.match(/^git(\+[a-z]+)?:\/\//))) {
|
|
||||||
delete moduleRecord.resolved;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (moduleRecord.dependencies) {
|
|
||||||
Object.keys(moduleRecord.dependencies)
|
|
||||||
.forEach((name) => cleanModule(moduleRecord.dependencies[name]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// console.log('Reading npm-shrinkwrap.json');
|
|
||||||
const shrinkwrap = require('../../npm-shrinkwrap.json');
|
|
||||||
|
|
||||||
// console.log('Cleaning shrinkwrap object');
|
|
||||||
cleanModule(shrinkwrap);
|
|
||||||
|
|
||||||
const cleanShrinkwrapPath = path.join(__dirname, '..', '..', 'npm-shrinkwrap.clean.json');
|
|
||||||
console.log('writing npm-shrinkwrap.clean.json');
|
|
||||||
fs.writeFileSync(cleanShrinkwrapPath, JSON.stringify(shrinkwrap, null, 2) + '\n');
|
|
|
@ -1,18 +0,0 @@
|
||||||
#!/usr/bin/env node
|
|
||||||
|
|
||||||
var fs = require('fs');
|
|
||||||
var fse = require('fs-extra');
|
|
||||||
var path = require('path');
|
|
||||||
|
|
||||||
var NPM_SHRINKWRAP_FILE = 'npm-shrinkwrap.json';
|
|
||||||
var NPM_SHRINKWRAP_CACHED_FILE = 'node_modules/.npm-shrinkwrap.cached.json';
|
|
||||||
var PROJECT_ROOT = path.join(__dirname, '../../');
|
|
||||||
|
|
||||||
process.chdir(PROJECT_ROOT);
|
|
||||||
|
|
||||||
if (fs.existsSync(NPM_SHRINKWRAP_FILE)) {
|
|
||||||
console.log('copying shrinkwrap fingerprint to', NPM_SHRINKWRAP_CACHED_FILE);
|
|
||||||
fse.copySync(NPM_SHRINKWRAP_FILE, NPM_SHRINKWRAP_CACHED_FILE);
|
|
||||||
} else {
|
|
||||||
console.warn(`${NPM_SHRINKWRAP_FILE} not found. Copy operation will be skipped.`);
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
#!/usr/bin/env node
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
let childProcess = require('child_process');
|
|
||||||
|
|
||||||
childProcess.spawn('npm', ['shrinkwrap', '--dev'], {stdio: 'inherit'}).on('exit', (exitCode) => {
|
|
||||||
if (exitCode !== 0) return;
|
|
||||||
|
|
||||||
childProcess.fork('./tools/npm/clean-shrinkwrap.js').on('exit', (exitCode) => {
|
|
||||||
if (exitCode !== 0) return;
|
|
||||||
|
|
||||||
childProcess.fork('./tools/npm/copy-npm-shrinkwrap');
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
All of our npm dependencies are locked via the `yarn.lock` file for the following reasons:
|
||||||
|
|
||||||
|
- our project has lots of dependencies which update at unpredictable times, so it's important that
|
||||||
|
we update them explicitly once in a while rather than implicitly when any of us runs npm install
|
||||||
|
- locked dependencies allow us to reuse npm cache on travis, significantly speeding up our builds
|
||||||
|
(by 5 minutes or more)
|
||||||
|
- locked dependencies allow us to detect when node_modules folder is out of date after a branch switch
|
||||||
|
which allows us to build the project with the correct dependencies every time
|
||||||
|
|
||||||
|
Before changing a dependency, do the following:
|
||||||
|
|
||||||
|
- make sure you are in sync with `upstream/master`: `git fetch upstream && git rebase upstream/master`
|
||||||
|
- ensure that your `node_modules` directory is not stale by running `yarn install`
|
||||||
|
|
||||||
|
|
||||||
|
To add a new dependency do the following: `yarn add <packagename> --dev`
|
||||||
|
|
||||||
|
To update an existing dependency do the following: run `yarn upgrade <packagename>@<version|latest> --dev`
|
||||||
|
or `yarn upgrade <packagename> --dev` to update to the latest version that matches version constraint
|
||||||
|
in `package.json`
|
||||||
|
|
||||||
|
To Remove an existing dependency do the following: run `yarn remove <packagename>`
|
||||||
|
|
||||||
|
|
||||||
|
Once you've changed the dependency, commit the changes to `package.json` & `yarn.lock`, and you are done.
|
Loading…
Reference in New Issue