|
| 1 | +import { BuildOptions } from '../models/webpack-config'; |
| 2 | + |
1 | 3 | const Command = require('../ember-cli/lib/models/command');
|
2 | 4 |
|
3 |
| -export interface BuildOptions { |
4 |
| - target?: string; |
5 |
| - environment?: string; |
6 |
| - outputPath?: string; |
| 5 | +// defaults for BuildOptions |
| 6 | +export const BaseBuildCommandOptions: any = [ |
| 7 | + { |
| 8 | + name: 'target', |
| 9 | + type: String, |
| 10 | + default: 'development', |
| 11 | + aliases: ['t', { 'dev': 'development' }, { 'prod': 'production' }] |
| 12 | + }, |
| 13 | + { name: 'environment', type: String, aliases: ['e'] }, |
| 14 | + { name: 'output-path', type: 'Path', aliases: ['op'] }, |
| 15 | + { name: 'aot', type: Boolean, default: false }, |
| 16 | + { name: 'sourcemap', type: Boolean, aliases: ['sm'] }, |
| 17 | + { name: 'vendor-chunk', type: Boolean, default: true, aliases: ['vc'] }, |
| 18 | + { name: 'base-href', type: String, default: '/', aliases: ['bh'] }, |
| 19 | + { name: 'deploy-url', type: String, aliases: ['d'] }, |
| 20 | + { name: 'verbose', type: Boolean, default: false, aliases: ['v'] }, |
| 21 | + { name: 'progress', type: Boolean, default: true, aliases: ['pr'] }, |
| 22 | + { name: 'i18n-file', type: String }, |
| 23 | + { name: 'i18n-format', type: String }, |
| 24 | + { name: 'locale', type: String }, |
| 25 | + { name: 'extract-css', type: Boolean, aliases: ['ec']}, |
| 26 | + { |
| 27 | + name: 'output-hashing', |
| 28 | + type: String, |
| 29 | + values: ['none', 'all', 'media', 'bundles'], |
| 30 | + description: 'define the output filename cache-busting hashing mode', |
| 31 | + aliases: ['oh'] |
| 32 | + }, |
| 33 | +]; |
| 34 | + |
| 35 | +export interface BuildTaskOptions extends BuildOptions { |
7 | 36 | watch?: boolean;
|
8 |
| - watcher?: string; |
9 |
| - supressSizes: boolean; |
10 |
| - baseHref?: string; |
11 |
| - aot?: boolean; |
12 |
| - sourcemap?: boolean; |
13 |
| - vendorChunk?: boolean; |
14 |
| - verbose?: boolean; |
15 |
| - progress?: boolean; |
16 |
| - i18nFile?: string; |
17 |
| - i18nFormat?: string; |
18 |
| - locale?: string; |
19 |
| - deployUrl?: string; |
20 |
| - outputHashing?: string; |
21 |
| - extractCss?: boolean | null; |
22 | 37 | }
|
23 | 38 |
|
24 | 39 | const BuildCommand = Command.extend({
|
25 | 40 | name: 'build',
|
26 | 41 | description: 'Builds your app and places it into the output path (dist/ by default).',
|
27 | 42 | aliases: ['b'],
|
28 | 43 |
|
29 |
| - availableOptions: [ |
30 |
| - { |
31 |
| - name: 'target', |
32 |
| - type: String, |
33 |
| - default: 'development', |
34 |
| - aliases: ['t', { 'dev': 'development' }, { 'prod': 'production' }] |
35 |
| - }, |
36 |
| - { name: 'environment', type: String, default: '', aliases: ['e'] }, |
37 |
| - { name: 'output-path', type: 'Path', default: null, aliases: ['o'] }, |
38 |
| - { name: 'watch', type: Boolean, default: false, aliases: ['w'] }, |
39 |
| - { name: 'watcher', type: String }, |
40 |
| - { name: 'suppress-sizes', type: Boolean, default: false }, |
41 |
| - { name: 'base-href', type: String, default: null, aliases: ['bh'] }, |
42 |
| - { name: 'aot', type: Boolean, default: false }, |
43 |
| - { name: 'sourcemap', type: Boolean, aliases: ['sm'] }, |
44 |
| - { name: 'vendor-chunk', type: Boolean, default: true }, |
45 |
| - { name: 'verbose', type: Boolean, default: false }, |
46 |
| - { name: 'progress', type: Boolean, default: true }, |
47 |
| - { name: 'i18n-file', type: String, default: null }, |
48 |
| - { name: 'i18n-format', type: String, default: null }, |
49 |
| - { name: 'locale', type: String, default: null }, |
50 |
| - { name: 'deploy-url', type: String, default: null, aliases: ['d'] }, |
51 |
| - { |
52 |
| - name: 'output-hashing', |
53 |
| - type: String, |
54 |
| - values: ['none', 'all', 'media', 'bundles'], |
55 |
| - description: 'define the output filename cache-busting hashing mode' |
56 |
| - }, |
57 |
| - { name: 'extract-css', type: Boolean, default: true } |
58 |
| - ], |
| 44 | + availableOptions: BaseBuildCommandOptions.concat([ |
| 45 | + { name: 'watch', type: Boolean, default: false, aliases: ['w'] } |
| 46 | + ]), |
59 | 47 |
|
60 |
| - run: function (commandOptions: BuildOptions) { |
| 48 | + run: function (commandOptions: BuildTaskOptions) { |
61 | 49 | return require('./build.run').default.call(this, commandOptions);
|
62 | 50 | }
|
63 | 51 | });
|
|
0 commit comments