diff --git a/package.json b/package.json index 5592a9b..d8d248f 100644 --- a/package.json +++ b/package.json @@ -50,6 +50,8 @@ "homepage": "https://github.com/silkimen/cordova-plugin-advanced-http#readme", "devDependencies": { "cordova": "7.0.1", - "umd-tough-cookie": "2.3.2" + "mz": "2.7.0", + "umd-tough-cookie": "2.3.2", + "xml2js": "0.4.19" } } diff --git a/plugin.xml b/plugin.xml index dfbbf7d..7bcd63c 100644 --- a/plugin.xml +++ b/plugin.xml @@ -1,96 +1,67 @@ - - - - Advanced HTTP plugin - - + + + Advanced HTTP plugin + Cordova / Phonegap plugin for communicating with HTTP servers using SSL pinning - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/release.sh b/release.sh index 55baa8b..7596924 100755 --- a/release.sh +++ b/release.sh @@ -4,5 +4,6 @@ set -e VERSION=$(node -e "console.log(require('./package.json').version)") ./scripts/update-tough-cookie.sh +node ./scripts/update-plugin-xml.js $VERSION npm publish git tag "v$VERSION" diff --git a/scripts/update-plugin-xml.js b/scripts/update-plugin-xml.js new file mode 100644 index 0000000..8381856 --- /dev/null +++ b/scripts/update-plugin-xml.js @@ -0,0 +1,31 @@ +const args = process.argv.slice(2); +const fs = require('mz/fs'); +const path = require('path'); +const xml2js = require('xml2js'); +const xmlPath = path.join(__dirname, '..', 'plugin.xml'); + +const parse = xml => new Promise((resolve, reject) => { + const parser = new xml2js.Parser(); + + parser.parseString(xml, (error, result) => { + if (error) { + reject(error); + } else { + resolve(result); + } + }); +}); + +const stringify = obj => { + const builder = new xml2js.Builder(); + + return builder.buildObject(obj); +}; + +fs.readFile(xmlPath, 'utf-8') + .then(xml => parse(xml)) + .then(parsed => { + parsed.plugin.$.version = args[0]; + + return fs.writeFile(xmlPath, stringify(parsed)); + });