1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const config_1 = require("../models/config");
|
4 | const version_1 = require("../upgrade/version");
|
5 | const common_tags_1 = require("common-tags");
|
6 | const Command = require('../ember-cli/lib/models/command');
|
7 | const config = config_1.CliConfig.fromProject() || config_1.CliConfig.fromGlobal();
|
8 | const pollDefault = config.config.defaults && config.config.defaults.poll;
|
9 |
|
10 | exports.baseBuildCommandOptions = [
|
11 | {
|
12 | name: 'target',
|
13 | type: String,
|
14 | default: 'development',
|
15 | aliases: ['t', { 'dev': 'development' }, { 'prod': 'production' }],
|
16 | description: 'Defines the build target.'
|
17 | },
|
18 | {
|
19 | name: 'environment',
|
20 | type: String,
|
21 | aliases: ['e'],
|
22 | description: 'Defines the build environment.'
|
23 | },
|
24 | {
|
25 | name: 'output-path',
|
26 | type: 'Path',
|
27 | aliases: ['op'],
|
28 | description: 'Path where output will be placed.'
|
29 | },
|
30 | {
|
31 | name: 'aot',
|
32 | type: Boolean,
|
33 | description: 'Build using Ahead of Time compilation.'
|
34 | },
|
35 | {
|
36 | name: 'sourcemap',
|
37 | type: Boolean,
|
38 | aliases: ['sm', 'sourcemaps'],
|
39 | description: 'Output sourcemaps.'
|
40 | },
|
41 | {
|
42 | name: 'vendor-chunk',
|
43 | type: Boolean,
|
44 | default: true,
|
45 | aliases: ['vc'],
|
46 | description: 'Use a separate bundle containing only vendor libraries.'
|
47 | },
|
48 | {
|
49 | name: 'base-href',
|
50 | type: String,
|
51 | aliases: ['bh'],
|
52 | description: 'Base url for the application being built.'
|
53 | },
|
54 | {
|
55 | name: 'deploy-url',
|
56 | type: String,
|
57 | aliases: ['d'],
|
58 | description: 'URL where files will be deployed.'
|
59 | },
|
60 | {
|
61 | name: 'verbose',
|
62 | type: Boolean,
|
63 | default: false,
|
64 | aliases: ['v'],
|
65 | description: 'Adds more details to output logging.'
|
66 | },
|
67 | {
|
68 | name: 'progress',
|
69 | type: Boolean,
|
70 | default: true,
|
71 | aliases: ['pr'],
|
72 | description: 'Log progress to the console while building.'
|
73 | },
|
74 | {
|
75 | name: 'i18n-file',
|
76 | type: String,
|
77 | description: 'Localization file to use for i18n.'
|
78 | },
|
79 | {
|
80 | name: 'i18n-format',
|
81 | type: String,
|
82 | description: 'Format of the localization file specified with --i18n-file.'
|
83 | },
|
84 | {
|
85 | name: 'locale',
|
86 | type: String,
|
87 | description: 'Locale to use for i18n.'
|
88 | },
|
89 | {
|
90 | name: 'extract-css',
|
91 | type: Boolean,
|
92 | aliases: ['ec'],
|
93 | description: 'Extract css from global styles onto css files instead of js ones.'
|
94 | },
|
95 | {
|
96 | name: 'watch',
|
97 | type: Boolean, default: false,
|
98 | aliases: ['w'],
|
99 | description: 'Run build when files change.'
|
100 | },
|
101 | {
|
102 | name: 'output-hashing',
|
103 | type: String,
|
104 | values: ['none', 'all', 'media', 'bundles'],
|
105 | description: 'Define the output filename cache-busting hashing mode.',
|
106 | aliases: ['oh']
|
107 | },
|
108 | {
|
109 | name: 'poll',
|
110 | type: Number,
|
111 | default: pollDefault,
|
112 | description: 'Enable and define the file watching poll time period (milliseconds).'
|
113 | },
|
114 | {
|
115 | name: 'app',
|
116 | type: String,
|
117 | aliases: ['a'],
|
118 | description: 'Specifies app name to use.'
|
119 | }
|
120 | ];
|
121 | const BuildCommand = Command.extend({
|
122 | name: 'build',
|
123 | description: 'Builds your app and places it into the output path (dist/ by default).',
|
124 | aliases: ['b'],
|
125 | availableOptions: exports.baseBuildCommandOptions.concat([
|
126 | {
|
127 | name: 'stats-json',
|
128 | type: Boolean,
|
129 | default: false,
|
130 | description: common_tags_1.oneLine `Generates a \`stats.json\` file which can be analyzed using tools
|
131 | such as: \`webpack-bundle-analyzer\` or https://webpack.github.io/analyse.`
|
132 | }
|
133 | ]),
|
134 | run: function (commandOptions) {
|
135 | const project = this.project;
|
136 |
|
137 | version_1.Version.assertAngularVersionIs2_3_1OrHigher(project.root);
|
138 | const BuildTask = require('../tasks/build').default;
|
139 | const buildTask = new BuildTask({
|
140 | cliProject: project,
|
141 | ui: this.ui,
|
142 | });
|
143 | return buildTask.run(commandOptions);
|
144 | }
|
145 | });
|
146 | BuildCommand.overrideCore = true;
|
147 | exports.default = BuildCommand;
|
148 |
|
\ | No newline at end of file |