Added auto shell

This commit is contained in:
chris
2022-05-24 15:23:43 +08:00
parent 617bb370dc
commit a679b28955
2 changed files with 27 additions and 1 deletions

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash
node update-version.js $1
git tag -a $1 -m $1 git tag -a $1 -m $1
git push origin $1 git push origin $1

26
update-version.js Normal file
View File

@@ -0,0 +1,26 @@
// update package.json version
import fs from 'fs';
const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
console.log(packageJson.version);
// get node args
const args = process.argv.slice(2);
packageJson.version = args[0];
console.log(packageJson.version);
// write package.json
fs.writeFileSync('./package.json', JSON.stringify(packageJson, null, 2));
// read manifest.json
const manifestJson = JSON.parse(fs.readFileSync('./manifest.json', 'utf8'));
manifestJson.version = args[0];
// write manifest.json
fs.writeFileSync('./manifest.json', JSON.stringify(manifestJson, null, 2));