diff --git a/aio/tools/cli-patches/patch.js b/aio/tools/cli-patches/patch.js index e7afdf43fa..a7e6407d7e 100644 --- a/aio/tools/cli-patches/patch.js +++ b/aio/tools/cli-patches/patch.js @@ -1,9 +1,14 @@ -const fs = require('fs'); const sh = require('shelljs'); const PATCH_LOCK = 'node_modules/@angular/cli/.patched'; -if (!fs.existsSync(PATCH_LOCK)) { +sh.set('-e'); +sh.cd(`${__dirname}/../../`); + +if (!sh.test('-f', PATCH_LOCK)) { + sh.ls('-l', __dirname) + .filter(stat => stat.isFile() && /\.patch$/i.test(stat.name)) + .forEach(stat => sh.exec(`patch -p0 -i "${__dirname}/${stat.name}"`)); + sh.touch(PATCH_LOCK); } -