Skip to content

Instantly share code, notes, and snippets.

@nuald nuald/buildCopy.js
Created Sep 28, 2016

What would you like to do?
Cordova gulp build hook
echo "Building Web Project.";
cd ../web/;
cd ../cordova/;
echo "Deleting files in ./www";
rm -rf ./www/*;
echo "Copying files from ./web/dist to ./www";
cp -r ../web/dist/* ./www/;
module.exports = (ctx) => {
var Q = ctx.requireCordovaModule('q'),
shell = ctx.requireCordovaModule('shelljs');
var gulpDeferral = new Q.defer(),
exitDeferral = new Q.defer();
console.log("Building Web Project.");'../web/');
shell.exec('gulp', (error, stdout, stderr) => {
if (!error) {
} else {
exitDeferral.reject('gulp failed!');
gulpDeferral.promise.then(() => {
console.log("Deleting files in ./www");'../cordova/');
shell.rm('-rf', 'www/*');
console.log("Copying files from ../web/dist to ./www");
shell.cp('-Rf', '../web/dist/*', './www/');
return exitDeferral.promise;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.