Skip to content

Commit d6874b9

Browse files
committed
build: cronjob cannot install angular snapshot builds
Apparently the script that also ran on `TravisCI` does not work on MacOS, nor on CircleCI because it's not guaranteed that the default `awk` supports storing `match()` results in an array that can print individual match groups.
1 parent 0b19b58 commit d6874b9

File tree

3 files changed

+31
-13
lines changed

3 files changed

+31
-13
lines changed

.circleci/config.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ jobs:
279279
- *restore_cache
280280
- *yarn_install
281281

282-
- run: ./scripts/install-angular-snapshots.sh
282+
- run: node ./scripts/install-angular-snapshots.js
283283
- run: ./scripts/circleci/run-local-browser-tests.sh
284284

285285
# ----------------------------------------------------------------------------------------
@@ -303,6 +303,8 @@ workflows:
303303
- tests_local_browsers
304304
- tests_browserstack
305305
- tests_saucelabs
306+
# Testing
307+
- snapshot_tests_local_browsers
306308

307309
integration_tests:
308310
jobs:

scripts/install-angular-snapshots.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Script that re-installs all Angular dependencies using the GitHub build snapshots. We need to
3+
* do this after the locked node modules have been installed because otherwise `--frozen-lockfile`
4+
* would complain about outdated lock files.
5+
*/
6+
7+
const join = require('path').join;
8+
const execSync = require('child_process').execSync;
9+
const packageJson = require('../package.json');
10+
11+
// List of Angular packages that are specified in the "package.json". Packages will be listed
12+
// without the "@angular/" scope.
13+
const angularPackages = Object
14+
.keys({...packageJson.dependencies, ...packageJson.devDependencies})
15+
.filter(depName => depName.startsWith('@angular/'))
16+
.map(depName => depName.split('/').slice(1));
17+
18+
// List of URLs that refer to the Github snapshot builds for all Angular packages.
19+
const githubBuildUrls = angularPackages.map(name => `github:angular/${name}-builds`);
20+
21+
// Run yarn add {URLs}, so that it replaces the Angular npm packages with the Github builds.
22+
execSync(`yarn add ${githubBuildUrls.join(' ')}`, {
23+
stdio: 'inherit',
24+
shell: true,
25+
cwd: join(__dirname, '../')
26+
});
27+
28+
console.log('Finished installing the Angular snapshot builds.');

scripts/install-angular-snapshots.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)