Skip to content

Instantly share code, notes, and snippets.

@elct9620
Created August 12, 2015 04:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elct9620/c7eae8a7d789be468611 to your computer and use it in GitHub Desktop.
Save elct9620/c7eae8a7d789be468611 to your computer and use it in GitHub Desktop.
Auto generate cordova project and build using android sdk (Empty app)
// File System
var fs = require('fs')
// Cordova Lib
var cordovaLib = require('cordova-lib'),
CordovaError = cordovaLib.CordovaError,
cordova = cordovaLib.cordova,
events = cordovaLib.events;
var opts = {
platforms: 'android',
verbose: true,
options: []
}
cordova.raw.create(
'./app',
'tw.gwao.demo',
'Demo APP',
{}
).done(function() {
process.chdir('./app')
fs.writeFile('./www/index.html', process.env.APP_NAME || "Cordova", function(err) {
if(err) {
return console.log(err)
}
installApp()
})
})
function installApp() {
cordova.raw.platform('add', 'android', null).done(function() {
cordova.raw.run()
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment