-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.js
60 lines (48 loc) · 1.43 KB
/
build.js
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
53
54
55
56
57
58
59
60
'use strict';
var EmberBuildTask = require('../tasks/ember-build');
var CdvBuildTask = require('../tasks/cordova-build');
var LinkTask = require('../tasks/link-environment');
var HookTask = require('../tasks/run-hook');
var defaultPlatform = require('../utils/default-platform');
var validateLocationType = require('../utils/validate-location-type');
module.exports = {
name: 'cordova:build',
aliases: ['cdv:build'],
description: 'Build ember & cordova applications',
works: 'insideProject',
availableOptions: [{
name: 'environment',
type: String,
default: 'development',
aliases: ['env']
}, {
name: 'platform',
type: String
}],
run: function(options) {
validateLocationType(this.project.config());
var platform = options.platform || defaultPlatform(this.project);
var hook = new HookTask({
project: this.project,
ui: this.ui
});
var emberBuild = new EmberBuildTask({
project: this.project,
ui: this.ui,
buildOptions: options.buildOptions
});
var link = new LinkTask({
project: this.project,
ui: this.ui
});
var cordovaBuild = new CdvBuildTask({
project: this.project,
ui: this.ui
});
return hook.run('beforeBuild')
.then(emberBuild.run(options.environment))
.then(link.run())
.then(cordovaBuild.run(platform))
.then(hook.run('afterBuild'));
}
};