|
| 1 | +import { BuildOptions } from '../models/build-options'; |
| 2 | +import { Version } from '../upgrade/version'; |
| 3 | + |
| 4 | +const Command = require('../ember-cli/lib/models/command'); |
| 5 | + |
| 6 | +// defaults for BuildOptions |
| 7 | +export const baseEjectCommandOptions: any = [ |
| 8 | + { |
| 9 | + name: 'target', |
| 10 | + type: String, |
| 11 | + default: 'development', |
| 12 | + aliases: ['t', { 'dev': 'development' }, { 'prod': 'production' }] |
| 13 | + }, |
| 14 | + { name: 'environment', type: String, aliases: ['e'] }, |
| 15 | + { name: 'output-path', type: 'Path', aliases: ['op'] }, |
| 16 | + { name: 'aot', type: Boolean }, |
| 17 | + { name: 'sourcemap', type: Boolean, aliases: ['sm', 'sourcemaps'] }, |
| 18 | + { name: 'vendor-chunk', type: Boolean, default: true, aliases: ['vc'] }, |
| 19 | + { name: 'base-href', type: String, aliases: ['bh'] }, |
| 20 | + { name: 'deploy-url', type: String, aliases: ['d'] }, |
| 21 | + { name: 'verbose', type: Boolean, default: false, aliases: ['v'] }, |
| 22 | + { name: 'progress', type: Boolean, default: true, aliases: ['pr'] }, |
| 23 | + { name: 'i18n-file', type: String }, |
| 24 | + { name: 'i18n-format', type: String }, |
| 25 | + { name: 'locale', type: String }, |
| 26 | + { name: 'extract-css', type: Boolean, aliases: ['ec'] }, |
| 27 | + { |
| 28 | + name: 'output-hashing', |
| 29 | + type: String, |
| 30 | + values: ['none', 'all', 'media', 'bundles'], |
| 31 | + description: 'define the output filename cache-busting hashing mode', |
| 32 | + aliases: ['oh'] |
| 33 | + }, |
| 34 | + { name: 'force', 'type': Boolean } |
| 35 | +]; |
| 36 | + |
| 37 | +export interface EjectTaskOptions extends BuildOptions { |
| 38 | + force?: boolean; |
| 39 | +} |
| 40 | + |
| 41 | + |
| 42 | +const EjectCommand = Command.extend({ |
| 43 | + name: 'eject', |
| 44 | + description: 'Ejects your app and output the proper webpack configuration and scripts.', |
| 45 | + |
| 46 | + availableOptions: baseEjectCommandOptions, |
| 47 | + |
| 48 | + run: function (commandOptions: EjectTaskOptions) { |
| 49 | + const project = this.project; |
| 50 | + const EjectTask = require('../tasks/eject').default; |
| 51 | + const ejectTask = new EjectTask({ |
| 52 | + cliProject: project, |
| 53 | + ui: this.ui, |
| 54 | + }); |
| 55 | + |
| 56 | + return ejectTask.run(commandOptions); |
| 57 | + } |
| 58 | +}); |
| 59 | + |
| 60 | + |
| 61 | +export default EjectCommand; |
0 commit comments