| 16 | } |
| 17 | |
| 18 | async run(options) { |
| 19 | let { ui } = this; |
| 20 | |
| 21 | ui.startProgress(chalk.green('Building'), chalk.green('.')); |
| 22 | |
| 23 | this._runDeferred = pDefer(); |
| 24 | |
| 25 | let builder = (this._builder = |
| 26 | options._builder || |
| 27 | new Builder({ |
| 28 | ui, |
| 29 | outputPath: options.outputPath, |
| 30 | environment: options.environment, |
| 31 | project: this.project, |
| 32 | })); |
| 33 | |
| 34 | ui.writeLine(`Environment: ${options.environment}`); |
| 35 | |
| 36 | let watcher = |
| 37 | options._watcher || |
| 38 | ( |
| 39 | await Watcher.build({ |
| 40 | ui, |
| 41 | builder, |
| 42 | options, |
| 43 | ignored: [path.resolve(this.project.root, options.outputPath)], |
| 44 | }) |
| 45 | ).watcher; |
| 46 | |
| 47 | await watcher; |
| 48 | // Run until failure or signal to exit |
| 49 | return this._runDeferred.promise; |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Exit silently |