@holisticon/nativescript-buildhelper
Advanced tools
Comparing version 0.1.0-develop-1 to 0.1.0-develop-10
@@ -5,20 +5,48 @@ #!/usr/bin/env node | ||
var xml2js = require("xml2js"); | ||
var path = require("path"); | ||
var util = require("util"); | ||
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 = __dirname + '/../app/App_Resources/Android/AndroidManifest.xml', buildNo = ARGS[0] || process.env['BUILD_NUMBER'] || 1, packageJSON = require(__dirname + '/../package.json'), manifestXML = fs.readFileSync(manifestPath); | ||
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); | ||
manifestData.manifest.$['android:versionCode'] = buildNo; | ||
manifestData.manifest.$['android:versionName'] = version; | ||
var xml = builder.buildObject(manifestData); | ||
fs.writeFile(manifestPath, xml, function (err) { | ||
if (err) | ||
throw err; | ||
}); | ||
var DEBUG_ENV = 'holisticon_tns'; | ||
var debugLog = util.debuglog(DEBUG_ENV); | ||
var xmlParser = new xml2js.Parser(), builder = new xml2js.Builder(), manifestPath = 'app/App_Resources/Android/AndroidManifest.xml', plistPath = 'app/App_Resources/iOS/Info.plist', buildNo = ARGS[0] || process.env['BUILD_NUMBER'] || 1, packageJSON = require(path.resolve('.', 'package.json')), version = packageJSON.version; | ||
console.log('Updating with build number: ' + buildNo); | ||
fs.stat(manifestPath, function (error) { | ||
if (!error) { | ||
var manifestXML_1 = fs.readFileSync(manifestPath); | ||
debugLog('Using following manifest: ', manifestXML_1); | ||
xmlParser.parseString(manifestXML_1, function (err, manifestData) { | ||
var appId = packageJSON.nativescript.id; | ||
manifestData.manifest.$['android:versionCode'] = buildNo; | ||
manifestData.manifest.$['android:versionName'] = version; | ||
var updatedManifest = builder.buildObject(manifestData); | ||
debugLog('Updating manifest with: ', manifestXML_1); | ||
fs.writeFile(manifestPath, updatedManifest, function (err) { | ||
if (err) | ||
throw err; | ||
}); | ||
}); | ||
} | ||
else { | ||
console.log('Skipping platform Android'); | ||
} | ||
}); | ||
fs.stat(plistPath, function (error) { | ||
if (!error) { | ||
child_process_1.exec('/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ' + buildNo + '" ' + path.resolve('.', plistPath), function (err) { | ||
if (err) { | ||
throw err; | ||
} | ||
}); | ||
child_process_1.exec('/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ' + version + '" ' + path.resolve('.', plistPath), function (err) { | ||
if (err) { | ||
throw err; | ||
} | ||
}); | ||
} | ||
else { | ||
console.log('Skipping platform iOS'); | ||
} | ||
}); |
{ | ||
"name": "@holisticon/nativescript-buildhelper", | ||
"version": "0.1.0-develop-1", | ||
"version": "0.1.0-develop-10", | ||
"description": "Basic NPM package for helping on automate releasing of NativeScript Apps", | ||
"bin": { | ||
"tns-buildnumbering": "tns-buildnumbering.js", | ||
"tns-release": "tns-release.js", | ||
@@ -16,2 +17,4 @@ "tns-changelog": "tns-changelog.js", | ||
"postclean": "", | ||
"debug": "node --debug-brk node_modules/jasmine-node/lib/jasmine-node/cli.js test/specs/*.spec.js", | ||
"e2e": "jasmine-node test/e2e/*.spec.js --junitreport --output target/e2e-reports/ --verbose --color", | ||
"jsdoc": "jsdoc -c ./jsdoc.json -t ./node_modules/ink-docstrap/template -R README.md ./etc", | ||
@@ -30,2 +33,4 @@ "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0", | ||
"devDependencies": { | ||
"@types/core-js": "0.9.37", | ||
"@types/jasmine": "2.5.46", | ||
"@types/node": "8.0.7", | ||
@@ -32,0 +37,0 @@ "conventional-changelog-cli": "1.2.0", |
# NativeScript Build Helper | ||
[![Build Status](https://travis-ci.org/holisticon/nativescript-buildhelper.svg?branch=master)](https://travis-ci.org/holisticon/nativescript-buildhelper) | ||
[![npm version](https://badge.fury.io/js/%40holisticon%2Fnativescript-buildhelper.svg)](https://badge.fury.io/js/%40holisticon%2Fnativescript-buildhelper) | ||
@@ -42,1 +43,19 @@ [![Issue Count](https://codeclimate.com/github/holisticon/nativescript-buildhelper/badges/issue_count.svg)](https://codeclimate.com/github/holisticon/nativescript-buildhelper) | ||
Unset = Snapshots only in Release mode | ||
### Advanced Usage | ||
#### Debugging | ||
If you need to debug the tests use the node-inspector: | ||
``` | ||
npm run debug | ||
node-inspector --web-port=8282 | ||
``` | ||
You can then open chrome at *http://127.0.0.1:8282/?port=5858* for debugging. | ||
If you want to have verbose logging add NODE_DEBUG=holisticon_tns: | ||
``` | ||
NODE_DEBUG=holisticon_tns node tns-buldnumbering | ||
``` |
@@ -6,2 +6,2 @@ #!/usr/bin/env node | ||
require('./lib/buildnumbering')(); | ||
require('./lib/buildnumbering'); |
@@ -16,2 +16,3 @@ { | ||
"types": [ | ||
"jasmine", | ||
"node" | ||
@@ -18,0 +19,0 @@ ] |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
12264
13
161
61
16
3