forked from ibroadfo/ember-cli-deploy-firebase
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
52 lines (45 loc) · 1.6 KB
/
index.js
File metadata and controls
52 lines (45 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* eslint-env node */
'use strict';
var BasePlugin = require('ember-cli-deploy-plugin');
var fbTools = require('firebase-tools');
module.exports = {
name: 'ember-cli-deploy-firebase',
createDeployPlugin: function(options) {
var DeployPlugin = BasePlugin.extend({
name: options.name,
defaultConfig: {
projectName: function(context) {
return context.projectName || context.appName;
},
deployToken: function(context) {
return context.deployToken || process.env.FIREBASE_TOKEN || undefined;
},
deployTargets: ['hosting', 'database', 'firestore', 'functions', 'storage']
},
upload: function(context) {
this.log("Starting deploy process...");
var project = this.readConfig('projectName');
var build = this.readConfig('outputPath');
var message = this.readConfig('revisionKey');
var verbose = context.ui.verbose;
var token = this.readConfig('deployToken');
var targets = this.readConfig('deployTargets');
var options = {
project: project,
public: build, //context.config.build.outputPath,
message: message,
verbose: verbose,
token: token
};
return fbTools.deploy(targets, options).then(() => {
this.log('Successful deploy!', { color: green });
}).catch((err) => {
this.log('There was an error during deployment:', { color: 'red' });
this.log(err, { color: 'red' });
this.log(err.stack, { color: 'red' });
});
}
});
return new DeployPlugin();
}
};