@holisticon/nativescript-buildhelper
Advanced tools
Comparing version 0.1.0-develop-4 to 0.1.0-develop-5
@@ -6,17 +6,13 @@ #!/usr/bin/env node | ||
var path = require("path"); | ||
var child_process_1 = require("child_process"); | ||
// Adds the build number to app versioning | ||
// e.g. release_notes.js 42 -> uses 42 as build number | ||
var ARGS = process.argv.slice(2); | ||
var xmlParser = new xml2js.Parser(), builder = new xml2js.Builder(); | ||
var manifestPath = path.resolve('.', 'app/App_Resources/Android/AndroidManifest.xml'), buildNo = ARGS[0] || process.env['BUILD_NUMBER'] || 1, packageJSON = require(path.resolve('.', 'package.json')), manifestXML = fs.readFileSync(manifestPath); | ||
var xmlParser = new xml2js.Parser(), builder = new xml2js.Builder(), manifestPath = path.resolve('.', 'app/App_Resources/Android/AndroidManifest.xml'), buildNo = ARGS[0] || process.env['BUILD_NUMBER'] || 1, packageJSON = require(path.resolve('.', 'package.json')), manifestXML = fs.readFileSync(manifestPath); | ||
console.log('Updating with build number: ' + buildNo); | ||
xmlParser.parseString(manifestXML, function (err, manifestData) { | ||
var appId = packageJSON.nativescript.id; | ||
var version = packageJSON.version; | ||
console.log('buildNo: ' + buildNo); | ||
console.log('appId: ' + appId); | ||
console.log('version: ' + version); | ||
var appId = packageJSON.nativescript.id, version = packageJSON.version; | ||
manifestData.manifest.$['android:versionCode'] = buildNo; | ||
manifestData.manifest.$['android:versionName'] = version; | ||
var xml = builder.buildObject(manifestData); | ||
fs.writeFile(manifestPath, xml, function (err) { | ||
fs.writeFile(manifestPath, builder.buildObject(manifestData), function (err) { | ||
if (err) | ||
@@ -26,1 +22,6 @@ throw err; | ||
}); | ||
child_process_1.exec('/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ' + buildNo + '" ' + __dirname + '"/../app/App_Resources/iOS/Info.plist"', function (err) { | ||
if (err) { | ||
throw err; | ||
} | ||
}); |
{ | ||
"name": "@holisticon/nativescript-buildhelper", | ||
"version": "0.1.0-develop-4", | ||
"version": "0.1.0-develop-5", | ||
"description": "Basic NPM package for helping on automate releasing of NativeScript Apps", | ||
@@ -5,0 +5,0 @@ "bin": { |
9572
105
2