|
1 | 1 | import * as path from 'path';
|
2 |
| -import { Tree, Builder as Broccoli, BuildResults } from 'broccoli'; |
| 2 | +// import { Tree, Builder as Broccoli, BuildResults } from 'broccoli'; |
3 | 3 | import * as rimraf from 'rimraf';
|
4 | 4 | import printSlowNodes from 'broccoli-slow-trees';
|
5 | 5 | import { sync as copyDereferenceSync } from 'copy-dereference';
|
@@ -81,11 +81,12 @@ export default class Project {
|
81 | 81 | }
|
82 | 82 |
|
83 | 83 | // TODO build descriptions
|
84 |
| - async _build(tree: Tree, destDir: string): Promise<void> { |
| 84 | + async _build(tree: any, destDir: string): Promise<void> { |
85 | 85 | try {
|
86 | 86 | debug('building project');
|
87 | 87 | let timer = startTimer();
|
88 | 88 | spinner.start(`Building ...`);
|
| 89 | + const Broccoli = require('broccoli').Builder; |
89 | 90 | let broccoli = new Broccoli(tree);
|
90 | 91 | let results = await broccoli.build();
|
91 | 92 | await this.finishBuild(results, destDir);
|
@@ -116,9 +117,10 @@ export default class Project {
|
116 | 117 | /**
|
117 | 118 | * Build the project and start watching the source files for changes, rebuilding when they occur
|
118 | 119 | */
|
119 |
| - async _watch(tree: Tree, options: WatchOptions = {}) { |
| 120 | + async _watch(tree: any, options: WatchOptions = {}) { |
120 | 121 | spinner.start(`Watching ...`);
|
121 | 122 | let timer = startTimer();
|
| 123 | + const Broccoli = require('broccoli').Builder; |
122 | 124 | let broccoli = new Broccoli(tree);
|
123 | 125 | let watcher = new Watcher(broccoli, { beforeRebuild: options.beforeRebuild, interval: 100 });
|
124 | 126 | let destDir = options.destDir || path.join(this.dir, 'dist');
|
@@ -192,7 +194,7 @@ export default class Project {
|
192 | 194 | * After a build completes, this method cleans up the result. It copies the results out of tmp and
|
193 | 195 | * into the output directory, and kicks off any optional behaviors post-build.
|
194 | 196 | */
|
195 |
| - finishBuild(results: BuildResults, destDir: string) { |
| 197 | + finishBuild(results: { directory: string, graph: any }, destDir: string) { |
196 | 198 | debug(`copying broccoli build output to dist`);
|
197 | 199 | rimraf.sync(destDir);
|
198 | 200 | copyDereferenceSync(path.resolve(results.directory), destDir);
|
|
0 commit comments