Skip to content

Instantly share code, notes, and snippets.

@marthakdk
Created June 13, 2017 06:04
Show Gist options
  • Save marthakdk/48b6466f64e26b57a579567bf8d80a15 to your computer and use it in GitHub Desktop.
Save marthakdk/48b6466f64e26b57a579567bf8d80a15 to your computer and use it in GitHub Desktop.
Angular 2 + Cordova hook
const fs = require('fs');
const execSync = require('child_process').execSync;
module.exports = function(context) {
const basePath = context.opts.projectRoot;
const baseWWW = basePath + '/www';
process.chdir('../bmi-surgical-app');
console.log("New directory: ${process.cwd()}");
execSync("ng build --prod --base-href .",{stdio:[0,1,2]});
var files = fs.readdirSync(baseWWW);
for (var i = 0; i < files.length; i++) {
if (files[i].endsWith('.gz')) {
fs.unlinkSync(baseWWW + '/' + files[i]);
}
}
fs.writeFileSync(baseWWW + '/.gitignore');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment