Skip to content

Commit

Permalink
git add right inside update_version.js
Browse files Browse the repository at this point in the history
  • Loading branch information
PRO-2684 committed Aug 1, 2024
1 parent 446fc6e commit b3c978d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 11 additions & 0 deletions scripts/update_version.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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}`);
});

0 comments on commit b3c978d

Please sign in to comment.