|
1 | 1 | /*eslint-disable no-console */
|
2 |
| -const cli = require('ember-cli/lib/cli'); |
3 |
| -const path = require('path'); |
4 | 2 |
|
5 | 3 | // This file hooks up on require calls to transpile TypeScript.
|
6 | 4 | const fs = require('fs');
|
@@ -37,6 +35,38 @@ require.extensions['.ts'] = function(m, filename) {
|
37 | 35 | };
|
38 | 36 |
|
39 | 37 |
|
| 38 | +/** |
| 39 | + * Monkey patch `ember-cli/lib/utilities/find-build-file` to find our build |
| 40 | + * file when looking for `ember-cli-build.js`. This needs to be the first |
| 41 | + * thing that happens before we `require()` any ember files. |
| 42 | + * |
| 43 | + * TODO: Remove this hack and replace it with some configuration when/if we |
| 44 | + * move away from ember. Or when ember allows us to configure this in |
| 45 | + * an addon. |
| 46 | + */ |
| 47 | +const findBuildFileRequirePath = 'ember-cli/lib/utilities/find-build-file'; |
| 48 | +const originalFindBuildFile = require(findBuildFileRequirePath); |
| 49 | + |
| 50 | +const mod = require.cache[require.resolve(findBuildFileRequirePath)]; |
| 51 | +mod.exports = function patchedFindBuildFile(name) { |
| 52 | + if (name == 'ember-cli-build.js') { |
| 53 | + const result = originalFindBuildFile.call(this, 'angular-cli-build.js'); |
| 54 | + |
| 55 | + // Fallback to ember-cli-build if angular-cli-build isn't found. |
| 56 | + if (result) { |
| 57 | + return result; |
| 58 | + } |
| 59 | + } |
| 60 | + |
| 61 | + return originalFindBuildFile.apply(this, arguments); |
| 62 | +}; |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | +const cli = require('ember-cli/lib/cli'); |
| 67 | +const path = require('path'); |
| 68 | + |
| 69 | + |
40 | 70 | module.exports = function(options) {
|
41 | 71 | const oldStdoutWrite = process.stdout.write;
|
42 | 72 | process.stdout.write = function (line) {
|
|
0 commit comments