Created
June 13, 2017 06:04
-
-
Save marthakdk/48b6466f64e26b57a579567bf8d80a15 to your computer and use it in GitHub Desktop.
Angular 2 + Cordova hook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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