Last active
December 6, 2016 00:12
-
-
Save rodrigograca31/49f3cf066b21eb523c0e5085e145cd84 to your computer and use it in GitHub Desktop.
Cordova hook that displays the .apk size and opens the folder containing it.
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
#!/usr/bin/env node | |
// make sure android platform is part of build | |
// if (ctx.opts.platforms.indexOf('android') < 0) { | |
// return; | |
// } | |
var fs = require('fs'); | |
var path = require('path'); | |
var exec = require('child_process').exec; | |
//var apkFileLocation = path.resolve(__dirname, '../../platforms/android/build/outputs/apk/android-release.apk'); | |
fs.stat('./platforms/android/build/outputs/apk/android-release.apk', function(err,stats) { | |
if (err) { | |
console.log('\nAn error has occurred\n'); | |
} else { | |
console.log('\nSize of "android-release.apk" is ' + ((stats.size/1024)/1024).toFixed(2) + 'M\n'); | |
} | |
}); | |
// It should detect the file explorer.... | |
exec('nemo ./platforms/android/build/outputs/apk/', function(error, stdout, stderr) {}); |
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
#!/usr/bin/env node | |
// make sure android platform is part of build | |
// if (ctx.opts.platforms.indexOf('android') < 0) { | |
// return; | |
// } | |
var fs = require('fs'); | |
var path = require('path'); | |
var exec = require('child_process').exec; | |
//var apkFileLocation = path.resolve(__dirname, '../../platforms/android/build/outputs/apk/android-release.apk'); | |
fs.stat('./platforms/android/build/outputs/apk/android-debug.apk', function(err,stats) { | |
if (err) { | |
console.log('\nAn error has occurred\n'); | |
} else { | |
console.log('\nSize of "android-debug.apk" is ' + ((stats.size/1024)/1024).toFixed(2) + 'M\n'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This hooks should be inside the
after_build
andafter_run
folders accordingly...(Note the file names)