| 7 | module.exports = class BuildTask extends Task { |
| 8 | // Options: String outputPath |
| 9 | async run(options) { |
| 10 | let ui = this.ui; |
| 11 | |
| 12 | let builder = new Builder({ |
| 13 | ui, |
| 14 | outputPath: options.outputPath, |
| 15 | environment: options.environment, |
| 16 | project: this.project, |
| 17 | }); |
| 18 | |
| 19 | try { |
| 20 | ui.startProgress(chalk.green('Building'), chalk.green('.')); |
| 21 | |
| 22 | ui.writeLine(`Environment: ${options.environment}`); |
| 23 | |
| 24 | let annotation = { |
| 25 | type: 'initial', |
| 26 | reason: 'build', |
| 27 | primaryFile: null, |
| 28 | changedFiles: [], |
| 29 | }; |
| 30 | |
| 31 | await builder.build(null, annotation); |
| 32 | } finally { |
| 33 | ui.stopProgress(); |
| 34 | await builder.cleanup(); |
| 35 | } |
| 36 | |
| 37 | ui.writeLine(chalk.green(`Built project successfully. Stored in "${options.outputPath}".`)); |
| 38 | } |
| 39 | }; |