2018-02-08 11:59:25 -05:00
|
|
|
/**
|
|
|
|
* @license
|
|
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
*/
|
|
|
|
|
2018-06-25 14:22:23 -04:00
|
|
|
try {
|
|
|
|
require.resolve('shelljs');
|
|
|
|
} catch (e) {
|
|
|
|
// We are in an bazel managed external node_modules repository
|
|
|
|
// and the resolve has failed because node did not preserve the symlink
|
|
|
|
// when loading the script.
|
|
|
|
// This can be fixed using the --preserve-symlinks-main flag which
|
|
|
|
// is introduced in node 10.2.0
|
|
|
|
console.warn(
|
2018-12-11 19:52:03 -05:00
|
|
|
`Running postinstall-patches.js script in an external repository requires --preserve-symlinks-main node flag introduced in node 10.2.0. ` +
|
|
|
|
`Current node version is ${process.version}. Node called with '${process.argv.join(" ")}'.`);
|
2018-06-25 14:22:23 -04:00
|
|
|
process.exit(0);
|
|
|
|
}
|
|
|
|
|
2019-10-16 23:09:45 -04:00
|
|
|
const {set, cd, sed, rm} = require('shelljs');
|
2018-03-08 23:23:33 -05:00
|
|
|
const path = require('path');
|
2018-02-08 11:59:25 -05:00
|
|
|
const log = console.log;
|
2018-03-08 23:23:33 -05:00
|
|
|
|
2018-12-12 01:49:14 -05:00
|
|
|
// COMMENTED OUT BECAUSE WE CURRENTLY REQUIRE NO PATCHES
|
|
|
|
// UNCOMMENT TO REENABLE PATCHING AND LOG OUTPUT
|
|
|
|
//
|
2019-05-15 23:01:50 -04:00
|
|
|
log('===== about to run the postinstall-patches.js script =====');
|
|
|
|
// fail on first error
|
|
|
|
set('-e');
|
|
|
|
// print commands as being executed
|
|
|
|
set('-v');
|
|
|
|
// jump to project root
|
|
|
|
cd(path.join(__dirname, '../'));
|
2018-03-08 23:23:33 -05:00
|
|
|
|
2019-05-15 23:01:50 -04:00
|
|
|
/* EXAMPLE PATCH:
|
|
|
|
// https://github.com/ReactiveX/rxjs/pull/3302
|
|
|
|
// make node_modules/rxjs compilable with Typescript 2.7
|
|
|
|
// remove when we update to rxjs v6
|
|
|
|
log('\n# patch: reactivex/rxjs#3302 make node_modules/rxjs compilable with Typescript 2.7');
|
|
|
|
sed('-i', '(\'response\' in xhr)', '(\'response\' in (xhr as any))',
|
|
|
|
'node_modules/rxjs/src/observable/dom/AjaxObservable.ts');
|
|
|
|
*/
|
2018-03-08 23:39:41 -05:00
|
|
|
|
2019-05-15 23:01:50 -04:00
|
|
|
// make chrome 74 work on OSX with karma under bazel
|
|
|
|
// remove when we update to the next @bazel/karma release
|
|
|
|
log('\n# patch: @bazel/karma 0.29.0 to disable chrome sandbox for OSX');
|
|
|
|
sed('-i', 'process.platform !== \'linux\'',
|
|
|
|
'process.platform !== \'linux\' && process.platform !== \'darwin\'',
|
|
|
|
'node_modules/@bazel/karma/karma.conf.js');
|
|
|
|
|
|
|
|
log('===== finished running the postinstall-patches.js script =====');
|