SIGN IN SIGN UP

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.

52433 0 1 TypeScript
2018-03-02 23:57:52 -06:00
const path = require('path');
const cwd = process.cwd();
const glob = require('glob');
2018-03-26 16:31:40 -05:00
const fs = require('fs-extra');
2018-03-02 23:57:52 -06:00
2018-03-26 16:31:40 -05:00
const distDir = path.join(__dirname, '../dist');
2018-03-02 23:57:52 -06:00
const distGeneratedNodeModules = path.join(distDir, 'node_modules');
function doGlob(globString) {
return new Promise((resolve, reject) => {
glob(globString, (err, matches) => {
if (err) {
return reject(err);
}
resolve(matches);
})
});
}
function getCodegenedFilesToDelete() {
const ngFactoryGlob = path.join(distDir, '**', '*ngfactory*');
const ngSummaryGlob = path.join(distDir, '**', '*ngsummary*');
const promises = [];
promises.push(doGlob(ngFactoryGlob));
promises.push(doGlob(ngSummaryGlob));
return Promise.all(promises).then(listOfGlobResults => {
const deleteFilePromises = [];
listOfGlobResults.forEach(fileMatches => {
fileMatches.forEach(filePath => {
2018-03-26 16:31:40 -05:00
deleteFilePromises.push(fs.remove(filePath));
2018-03-02 23:57:52 -06:00
})
})
return Promise.all(deleteFilePromises);
});
}
2018-03-26 16:31:40 -05:00
Promise.all([
getCodegenedFilesToDelete(),
fs.remove(distGeneratedNodeModules)
]);