Skip to content

Commit a3c5768

Browse files
committed
Add firebase deploy task
1 parent ea40615 commit a3c5768

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

tools/gulp/tasks/development.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import {
77
import {join} from 'path';
88
import {copyFiles} from '../util/copy-files';
99

10+
// These imports don't have any typings provided.
11+
const firebaseTools = require('firebase-tools');
12+
1013
const appDir = join(SOURCE_ROOT, 'demo-app');
1114
const outDir = join(DIST_ROOT, 'packages', 'demo-app');
1215

@@ -39,8 +42,19 @@ task('serve:devapp', ['build:devapp'], sequenceTask(
3942
));
4043

4144
/** 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'], () => {
4346
copyFiles(join(PROJECT_ROOT, 'node_modules'), vendorGlob, join(outDir, 'node_modules'));
4447
copyFiles(DIST_BUNDLES, '*.+(js|map)', join(outDir, 'dist/bundles'));
4548
copyFiles(DIST_MATERIAL, '**/prebuilt/*.+(css|map)', join(outDir, 'dist/packages/material'));
4649
});
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

Comments
 (0)