Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 253ab01

Browse files
committed
chore(gulpfile): add install-example-angular task to install build packages
Use build packages: gulp install-example-angular --build Restore release packages: gulp install-example-angular Documented the command in the README
1 parent aacab56 commit 253ab01

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,21 @@ Also, there is a script available for Linux and OSX users that will setup the pr
121121

122122
- `./scripts/install.sh`
123123

124+
### Run with current build instead of release packages
125+
Can switch the `@angular` packages in `~/public/docs/_examples/node_modules` to the current build packages with
126+
```
127+
gulp install-example-angular --build
128+
```
129+
Restore to RELEASE packages with
130+
```
131+
gulp install-example-angular
132+
```
133+
>These commands will fail if something is locking any of the packages ... as an IDE often does.
134+
>
135+
>The symptom typically is an error trying to `rm -rf node_modules/@angular`.
136+
>
137+
>_Solution_: unlock the hold on the package(s). In VS Code, re-load the window (`cmd-P` then enter `>relow`).
138+
124139

125140
## Technology Used
126141
- Angular 1.x: The production ready version of Angular

gulpfile.js

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,34 @@ gulp.task('remove-example-boilerplate', function() {
451451
deleteExampleBoilerPlate();
452452
});
453453

454+
// Npm install Angular libraries into examples/node_modules,
455+
// either release or current build packages
456+
// Examples:
457+
// gulp install-example-angular --build // use current build packages
458+
// gulp install-example-angular // restore release packages
459+
gulp.task('install-example-angular', installExampleAngular);
460+
461+
function installExampleAngular() {
462+
var sources;
463+
var template;
464+
var libs = [
465+
'core', 'common', 'compiler',
466+
'platform-browser', 'platform-browser-dynamic',
467+
'forms', 'http', 'router'];
468+
469+
// Like: "angular/core-builds" or "@angular/core"
470+
sources = libs.map( lib => argv.build ? `angular/${lib}-builds` : `@angular/${lib}`);
471+
472+
gutil.log(`Installing Angular npm packages from ${argv.build ? 'BUILD' : 'RELEASE'}`);
473+
474+
var spawnInfo = spawnExt('rm', ['-rf', 'node_modules/@angular'], { cwd: EXAMPLES_PATH});
475+
return spawnInfo.promise
476+
.then(() => {
477+
spawnInfo = spawnExt('npm', ['install', ...sources], {cwd: EXAMPLES_PATH});
478+
return spawnInfo.promise
479+
});
480+
}
481+
454482
// deletes boilerplate files that were added by copyExampleBoilerplate
455483
// from locations where an example app is found
456484
gulp.task('_delete-example-boilerplate', deleteExampleBoilerPlate);
@@ -602,7 +630,7 @@ gulp.task('link-checker', function(done) {
602630
'*/dart/latest/api/*',
603631
// Somehow the link checker sees ng1 {{...}} in the resource page; ignore it
604632
'resources/%7B%7Bresource.url%7D%7D',
605-
// API docs have links directly into GitHub repo sources; these can
633+
// API docs have links directly into GitHub repo sources; these can
606634
// quickly become invalid, so ignore them for now:
607635
'*/angular/tree/*'
608636
];
@@ -786,7 +814,7 @@ function linkChecker(options) {
786814
var outputFile = path.join(process.cwd(), 'link-checker-results.txt');
787815
var header = 'Link checker results for: ' + siteUrl +
788816
'\nStarted: ' + (new Date()).toLocaleString() +
789-
'\nExcluded links (blc file globs): ' + blcOptions.excludedKeywords +
817+
'\nExcluded links (blc file globs): ' + blcOptions.excludedKeywords +
790818
'\nExcluded links (custom --exclude-bad regex): ' + excludeBad.toString() + '\n\n';
791819
gutil.log(header);
792820
fs.writeFileSync(outputFile, header);

0 commit comments

Comments
 (0)