forked from angular/components
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(): add gulp task to create a systemjs bundle
* Gulp task to create a bundle, which includes all components and all Angular 2 packages * Designed to run inside of the Plunker Template * Task to deploy to firebase (as per angular#913) Closes angular#913
- Loading branch information
1 parent
1cd3a3c
commit 1810961
Showing
4 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import {task} from 'gulp'; | ||
import { | ||
DIST_ROOT, PROJECT_ROOT, DIST_BUNDLES_OUTPUT_FILE, DIST_BUNDLES_ROOT, | ||
PLUNKER_FIREBASE_NAME, PLUNKER_FIREBASE_TOKEN | ||
} from '../constants'; | ||
import * as path from 'path'; | ||
|
||
const systemjsBuilder = require('systemjs-builder'); | ||
const firebase = require('firebase-tools'); | ||
|
||
const ANGULAR_PACKAGES = [ | ||
'@angular/core/', | ||
'@angular/common', | ||
'@angular/compiler', | ||
'@angular/forms', | ||
'@angular/http', | ||
'@angular/platform-browser', | ||
'@angular/platform-browser-dynamic', | ||
]; | ||
|
||
task('build:bundle', ['build:components', ':build:devapp:vendor', ':build:devapp:ts'], () => { | ||
|
||
const entryPoints = ANGULAR_PACKAGES.concat('@angular/material'); | ||
const builder = new systemjsBuilder(path.relative(PROJECT_ROOT, DIST_ROOT)); | ||
|
||
// Load the SystemJS config of the demo-app, because it already includes all mappings. | ||
builder.loadConfigSync(path.join(DIST_ROOT, 'system-config.js')); | ||
|
||
// Create a bundle for all specified entry points. | ||
return builder.bundle(entryPoints.join(' + '), DIST_BUNDLES_OUTPUT_FILE, { | ||
minify: true, | ||
sourceMaps: false | ||
}); | ||
}); | ||
|
||
|
||
task('deploy:bundle:plunker', ['build:bundle'], () => { | ||
return firebase.deploy({ | ||
firebase: PLUNKER_FIREBASE_NAME, | ||
token: PLUNKER_FIREBASE_TOKEN, | ||
public: path.relative(PROJECT_ROOT, DIST_BUNDLES_ROOT) | ||
}).then(() => { | ||
console.log('Firebase: Successfully deployed bundle to firebase.'); | ||
process.exit(0); // Manually exit the process, because the CLI keeps the process alive. | ||
}).catch((error: any) => { | ||
console.error(error.message || error); | ||
process.exit(1); // Manually exit the process, because the CLI keeps the process alive. | ||
}); | ||
}); |