diff --git a/package.json b/package.json index ff334d3..c4f95bf 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "test": "node ./scripts/test.js", "prepare": "", - "version": "node ./scripts/update_version.js ; git add purlfy.js" + "version": "node ./scripts/update_version.js" }, "repository": { "type": "git", diff --git a/scripts/update_version.js b/scripts/update_version.js index 97f0c2a..6653ccc 100644 --- a/scripts/update_version.js +++ b/scripts/update_version.js @@ -4,6 +4,7 @@ // And then `git add purlfy.js`. const fs = require('fs'); +const { exec } = require('child_process'); const package = require('../package.json'); const purlfyPath = "./purlfy.js"; @@ -12,3 +13,13 @@ const data = fs.readFileSync(purlfyPath, 'utf8'); const result = data.replace(/return "\d+\.\d+\.\d+";/, `return "${version}";`); fs.writeFileSync(purlfyPath, result, 'utf8'); console.log(`Updated version to ${version}`); + +console.log('Adding purlfy.js to git...'); +exec('git add purlfy.js', (err, stdout, stderr) => { + if (err) { + console.error(err); + return; + } + console.log(`stdout: ${stdout}`); + console.log(`stderr: ${stderr}`); +});