1- import { CliConfig } from '../models/config' ;
21import { BuildOptions } from '../models/build-options' ;
32import { Version } from '../upgrade/version' ;
4- import { oneLine } from 'common-tags' ;
53import { getAppFromConfig } from '../utilities/app-utils' ;
64import { join } from 'path' ;
75import { RenderUniversalTaskOptions } from '../tasks/render-universal' ;
86
97const Command = require ( '../ember-cli/lib/models/command' ) ;
108const SilentError = require ( 'silent-error' ) ;
119
12- const config = CliConfig . fromProject ( ) || CliConfig . fromGlobal ( ) ;
13- const buildConfigDefaults = config . getPaths ( 'defaults.build' , [
14- 'sourcemaps' , 'baseHref' , 'progress' , 'poll' , 'deleteOutputPath' , 'preserveSymlinks' ,
15- 'showCircularDependencies' , 'commonChunk' , 'namedChunks'
16- ] ) ;
17-
1810// defaults for BuildOptions
19- export const baseBuildCommandOptions : any = [
20- {
21- name : 'target' ,
22- type : String ,
23- default : 'development' ,
24- aliases : [ 't' , { 'dev' : 'development' } , { 'prod' : 'production' } ] ,
25- description : 'Defines the build target.'
26- } ,
27- {
28- name : 'environment' ,
29- type : String ,
30- aliases : [ 'e' ] ,
31- description : 'Defines the build environment.'
32- } ,
33- {
34- name : 'output-path' ,
35- type : 'Path' ,
36- aliases : [ 'op' ] ,
37- description : 'Path where output will be placed.'
38- } ,
39- {
40- name : 'aot' ,
41- type : Boolean ,
42- description : 'Build using Ahead of Time compilation.'
43- } ,
44- {
45- name : 'sourcemaps' ,
46- type : Boolean ,
47- aliases : [ 'sm' , 'sourcemap' ] ,
48- description : 'Output sourcemaps.' ,
49- default : buildConfigDefaults [ 'sourcemaps' ]
50- } ,
51- {
52- name : 'vendor-chunk' ,
53- type : Boolean ,
54- aliases : [ 'vc' ] ,
55- description : 'Use a separate bundle containing only vendor libraries.'
56- } ,
57- {
58- name : 'common-chunk' ,
59- type : Boolean ,
60- default : buildConfigDefaults [ 'commonChunk' ] ,
61- aliases : [ 'cc' ] ,
62- description : 'Use a separate bundle containing code used across multiple bundles.'
63- } ,
64- {
65- name : 'base-href' ,
66- type : String ,
67- aliases : [ 'bh' ] ,
68- description : 'Base url for the application being built.' ,
69- default : buildConfigDefaults [ 'baseHref' ]
70- } ,
71- {
72- name : 'deploy-url' ,
73- type : String ,
74- aliases : [ 'd' ] ,
75- description : 'URL where files will be deployed.'
76- } ,
77- {
78- name : 'verbose' ,
79- type : Boolean ,
80- default : false ,
81- aliases : [ 'v' ] ,
82- description : 'Adds more details to output logging.'
83- } ,
84- {
85- name : 'progress' ,
86- type : Boolean ,
87- aliases : [ 'pr' ] ,
88- description : 'Log progress to the console while building.' ,
89- default : typeof buildConfigDefaults [ 'progress' ] !== 'undefined'
90- ? buildConfigDefaults [ 'progress' ]
91- : process . stdout . isTTY === true
92- } ,
93- {
94- name : 'i18n-file' ,
95- type : String ,
96- description : 'Localization file to use for i18n.'
97- } ,
98- {
99- name : 'i18n-format' ,
100- type : String ,
101- description : 'Format of the localization file specified with --i18n-file.'
102- } ,
103- {
104- name : 'locale' ,
105- type : String ,
106- description : 'Locale to use for i18n.'
107- } ,
108- {
109- name : 'missing-translation' ,
110- type : String ,
111- description : 'How to handle missing translations for i18n.'
112- } ,
113- {
114- name : 'extract-css' ,
115- type : Boolean ,
116- aliases : [ 'ec' ] ,
117- description : 'Extract css from global styles onto css files instead of js ones.'
118- } ,
119- {
120- name : 'watch' ,
121- type : Boolean ,
122- default : false ,
123- aliases : [ 'w' ] ,
124- description : 'Run build when files change.'
125- } ,
126- {
127- name : 'output-hashing' ,
128- type : String ,
129- values : [ 'none' , 'all' , 'media' , 'bundles' ] ,
130- description : 'Define the output filename cache-busting hashing mode.' ,
131- aliases : [ 'oh' ]
132- } ,
133- {
134- name : 'poll' ,
135- type : Number ,
136- description : 'Enable and define the file watching poll time period (milliseconds).' ,
137- default : buildConfigDefaults [ 'poll' ]
138- } ,
139- {
140- name : 'app' ,
141- type : String ,
142- aliases : [ 'a' ] ,
143- description : 'Specifies app name or index to use.'
144- } ,
145- {
146- name : 'delete-output-path' ,
147- type : Boolean ,
148- aliases : [ 'dop' ] ,
149- description : 'Delete output path before build.' ,
150- default : buildConfigDefaults [ 'deleteOutputPath' ] ,
151- } ,
152- {
153- name : 'preserve-symlinks' ,
154- type : Boolean ,
155- description : 'Do not use the real path when resolving modules.' ,
156- default : buildConfigDefaults [ 'preserveSymlinks' ]
157- } ,
158- {
159- name : 'extract-licenses' ,
160- type : Boolean ,
161- description : 'Extract all licenses in a separate file, in the case of production builds only.'
162- } ,
163- {
164- name : 'show-circular-dependencies' ,
165- type : Boolean ,
166- aliases : [ 'scd' ] ,
167- description : 'Show circular dependency warnings on builds.' ,
168- default : buildConfigDefaults [ 'showCircularDependencies' ]
169- } ,
170- {
171- name : 'build-optimizer' ,
172- type : Boolean ,
173- description : 'Enables @angular-devkit/build-optimizer optimizations when using `--aot`.'
174- } ,
175- {
176- name : 'named-chunks' ,
177- type : Boolean ,
178- aliases : [ 'nc' ] ,
179- description : 'Use file name for lazy loaded chunks.' ,
180- default : buildConfigDefaults [ 'namedChunks' ]
181- } ,
182- {
183- name : 'subresource-integrity' ,
184- type : Boolean ,
185- default : false ,
186- aliases : [ 'sri' ] ,
187- description : 'Enables the use of subresource integrity validation.'
188- } ,
189- {
190- name : 'bundle-dependencies' ,
191- type : [ 'none' , 'all' ] ,
192- default : 'none' ,
193- description : 'Available on server platform only. Which external dependencies to bundle into '
194- + 'the module. By default, all of node_modules will be kept as requires.'
195- } ,
196- {
197- name : 'service-worker' ,
198- type : Boolean ,
199- default : true ,
200- aliases : [ 'sw' ] ,
201- description : 'Generates a service worker config for production builds, if the app has '
202- + 'service worker enabled.'
203- } ,
204- {
205- name : 'skip-app-shell' ,
206- type : Boolean ,
207- description : 'Flag to prevent building an app shell' ,
208- default : false
209- }
210- ] ;
11+ export const baseBuildCommandOptions : any = [ ] ;
21112
21213export interface BuildTaskOptions extends BuildOptions {
21314 statsJson ?: boolean ;
@@ -218,15 +19,7 @@ const BuildCommand = Command.extend({
21819 description : 'Builds your app and places it into the output path (dist/ by default).' ,
21920 aliases : [ 'b' ] ,
22021
221- availableOptions : baseBuildCommandOptions . concat ( [
222- {
223- name : 'stats-json' ,
224- type : Boolean ,
225- default : false ,
226- description : oneLine `Generates a \`stats.json\` file which can be analyzed using tools
227- such as: \`webpack-bundle-analyzer\` or https://webpack.github.io/analyse.`
228- }
229- ] ) ,
22+ availableOptions : [ ] ,
23023
23124 run : function ( commandOptions : BuildTaskOptions ) {
23225 // Check Angular and TypeScript versions.
0 commit comments