|
7 | 7 | import {join} from 'path';
|
8 | 8 | import {copyFiles} from '../util/copy-files';
|
9 | 9 |
|
| 10 | +// These imports don't have any typings provided. |
| 11 | +const firebaseTools = require('firebase-tools'); |
| 12 | + |
10 | 13 | const appDir = join(SOURCE_ROOT, 'demo-app');
|
11 | 14 | const outDir = join(DIST_ROOT, 'packages', 'demo-app');
|
12 | 15 |
|
@@ -39,8 +42,19 @@ task('serve:devapp', ['build:devapp'], sequenceTask(
|
39 | 42 | ));
|
40 | 43 |
|
41 | 44 | /** Task that copies all vendors into the demo-app package. Allows hosting the app on firebase. */
|
42 |
| -task('build-deploy:devapp', ['build:devapp'], () => { |
| 45 | +task('prepare-deploy:devapp', ['build:devapp'], () => { |
43 | 46 | copyFiles(join(PROJECT_ROOT, 'node_modules'), vendorGlob, join(outDir, 'node_modules'));
|
44 | 47 | copyFiles(DIST_BUNDLES, '*.+(js|map)', join(outDir, 'dist/bundles'));
|
45 | 48 | copyFiles(DIST_MATERIAL, '**/prebuilt/*.+(css|map)', join(outDir, 'dist/packages/material'));
|
46 | 49 | });
|
| 50 | + |
| 51 | +/** |
| 52 | + * Task that deploys the demo-app to Firebase. Firebase project will be the one that is |
| 53 | + * set for project directory using the Firebase CLI. |
| 54 | + */ |
| 55 | +task('deploy:devapp', ['build:devapp'], () => { |
| 56 | + return firebaseTools.deploy({cwd: PROJECT_ROOT, only: 'hosting'}) |
| 57 | + // Firebase tools opens a persistent websocket connection and the process will never exit. |
| 58 | + .then(() => { console.log('Successfully deployed the demo-app to firebase'); process.exit(0); }) |
| 59 | + .catch((err: any) => { console.log(err); process.exit(1); }); |
| 60 | +}); |
0 commit comments