mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-24 08:06:17 +08:00
chore: monkey patch findBuildFile to use our angular-cli-build file.
This commit is contained in:
parent
7bc20ff766
commit
12ee1ef446
@ -1,6 +1,4 @@
|
||||
/*eslint-disable no-console */
|
||||
const cli = require('ember-cli/lib/cli');
|
||||
const path = require('path');
|
||||
|
||||
// This file hooks up on require calls to transpile TypeScript.
|
||||
const fs = require('fs');
|
||||
@ -37,6 +35,38 @@ require.extensions['.ts'] = function(m, filename) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Monkey patch `ember-cli/lib/utilities/find-build-file` to find our build
|
||||
* file when looking for `ember-cli-build.js`. This needs to be the first
|
||||
* thing that happens before we `require()` any ember files.
|
||||
*
|
||||
* TODO: Remove this hack and replace it with some configuration when/if we
|
||||
* move away from ember. Or when ember allows us to configure this in
|
||||
* an addon.
|
||||
*/
|
||||
const findBuildFileRequirePath = 'ember-cli/lib/utilities/find-build-file';
|
||||
const originalFindBuildFile = require(findBuildFileRequirePath);
|
||||
|
||||
const mod = require.cache[require.resolve(findBuildFileRequirePath)];
|
||||
mod.exports = function patchedFindBuildFile(name) {
|
||||
if (name == 'ember-cli-build.js') {
|
||||
const result = originalFindBuildFile.call(this, 'angular-cli-build.js');
|
||||
|
||||
// Fallback to ember-cli-build if angular-cli-build isn't found.
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return originalFindBuildFile.apply(this, arguments);
|
||||
};
|
||||
|
||||
|
||||
|
||||
const cli = require('ember-cli/lib/cli');
|
||||
const path = require('path');
|
||||
|
||||
|
||||
module.exports = function(options) {
|
||||
const oldStdoutWrite = process.stdout.write;
|
||||
process.stdout.write = function (line) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user