Improve package.json modifications
This commit is contained in:
+2
-3
@@ -18,9 +18,8 @@ console.log(`Publishing version: ${nextVersion}`);
|
|||||||
|
|
||||||
// Set the version in package.json
|
// Set the version in package.json
|
||||||
const packageJsonFile = path.resolve(__dirname, '..', 'package.json');
|
const packageJsonFile = path.resolve(__dirname, '..', 'package.json');
|
||||||
let packageJsonRaw = fs.readFileSync(packageJsonFile).toString();
|
packageJson.version = nextVersion;
|
||||||
packageJsonRaw = packageJsonRaw.replace(/("version": ")[0-9]+\.[0-9]+\.[0-9]+(")/, `$1${nextVersion}$2`);
|
fs.writeFileSync(packageJsonFile, JSON.stringify(packageJson, null, 2));
|
||||||
fs.writeFileSync(packageJsonFile, packageJsonRaw);
|
|
||||||
|
|
||||||
// Publish
|
// Publish
|
||||||
const result = cp.spawn('npm', ['publish', '--tag', tag], {
|
const result = cp.spawn('npm', ['publish', '--tag', tag], {
|
||||||
|
|||||||
Reference in New Issue
Block a user