Replacing Grunt-zipstream
We will use Grunt-contrib-compress instead with the following configuration:var compressConfig = {and with a sub-directory using a variable for Yeoman
main: {
options: {
archive: 'app.zip'
},
expand: true,
src: ['*.html', 'styles/**/*.css', 'srcipts/**/*.js', 'favicon.ico', 'images/**/*'],
}
};
var compressConfig = {You can replace "zip" with "compress" in the documentation, or make a separate task like I did:
main: {
options: {
archive: 'app.zip'
},
expand: true,
cwd: '<%= yeoman.app %>/',
src: ['*.html', 'styles/**/*.css', 'srcipts/**/*.js', 'favicon.ico', 'images/**/*'],
}
};
grunt.registerTask('remote_build', [
'compress',
'phonegap-build:debug'
]);
Blackberry and Windows Phone builds
Wondering how to make Windows Phone Builds with Grunt-phonegap-build? To build out for iOS, Android, Blackberry, and Windows Phone you can do your setup this way:var phonegapBuildConfig = {
debug: {
options: {
archive: 'app.zip',
'appId': 'XXXXXX',
'user': {
'email': 'myemail@server.com',
'password': 'password1234'
},
keys: {
//ios: { 'password': password1234' },
android: { 'key_pw': 'password1234', 'keystore_pw': 'password1234' },
blackberry: { 'password': 'password1234'}
},
download: {
ios: 'dist/ios.ipa',
android: 'dist/android.apk',
blackberry: 'dist/blackberry.ota',
winphone: 'dist/winphone.xap'
}
}
}
};
No need for the iOS password anymore, see how to specify the key for Blackberry, and the attribute name for Windows Phone is "winphone"!
Here is everything in total:
module.exports = function (grunt) {
// show elapsed time at the end
require('time-grunt')(grunt);
// load all grunt tasks
require('load-grunt-tasks')(grunt);
//REMOTE (build.phonegap.com) phonegap (for devices) builds
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-phonegap-build');
// configurable paths
var yeomanConfig = {
app: 'app',
dist: 'dist'
};
var phonegapBuildConfig = {
debug: {
options: {
archive: 'app.zip',
'appId': 'XXXXXX',
'user': {
'email': 'myemail@server.com',
'password': 'password1234'
},
keys: {
//ios: { 'password': password1234' },
android: { 'key_pw': 'password1234', 'keystore_pw': 'password1234' },
blackberry: { 'password': 'password1234'}
},
download: {
ios: 'dist/ios.ipa',
android: 'dist/android.apk',
blackberry: 'dist/blackberry.ota',
winphone: 'dist/winphone.xap'
}
}
};
var compressConfig = {
main: {
options: {
archive: 'app.zip'
},
expand: true,
cwd: '<%= yeoman.app %>/',
src: ['*.html', 'styles/**/*.css', 'srcipts/**/*.js', 'favicon.ico', 'images/**/*'],
}
};
grunt.initConfig({
'phonegap-build': phonegapBuildConfig,
compress: compressConfig
});
grunt.registerTask('remote_build', [
'compress',
'phonegap-build:debug'
]);
};