dont use xml2js xml writer as we lose comments. instead, use sed to rewrite the plugin.xml versions.
Project: http://git-wip-us.apache.org/repos/asf/cordova-coho/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-coho/commit/52abc162 Tree: http://git-wip-us.apache.org/repos/asf/cordova-coho/tree/52abc162 Diff: http://git-wip-us.apache.org/repos/asf/cordova-coho/diff/52abc162 Branch: refs/heads/master Commit: 52abc1622d1a0057e39096d82910e5f3abb3c0ab Parents: e7051aa Author: filmaj <[email protected]> Authored: Wed Mar 1 15:46:55 2017 -0800 Committer: filmaj <[email protected]> Committed: Tue Apr 25 17:28:08 2017 -0700 ---------------------------------------------------------------------- src/versionutil.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/52abc162/src/versionutil.js ---------------------------------------------------------------------- diff --git a/src/versionutil.js b/src/versionutil.js index cbb8e99..5937684 100644 --- a/src/versionutil.js +++ b/src/versionutil.js @@ -152,11 +152,8 @@ exports.updateRepoVersion = function *updateRepoVersion(repo, version, opts) { if (err) throw err; xml2js.parseString(data, function(err, xml) { if (err) throw err; - xml.plugin['$'].version = version; - // TODO: writing out the xml in this way causes us to lose the comments, which means we lose the apache license header :( - var xmlWriter = new xml2js.Builder(); - var xmlOutput = xmlWriter.buildObject(xml); - fs.writeFileSync(xmlFile, xmlOutput + '\n'); + var prev_version = xml.plugin['$'].version; + shelljs.sed('-i', new RegExp('version="' + prev_version + '"','i'), 'version="' + version + '"', xmlFile); }); }); } else { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
