Skip to content

Commit

Permalink
chore: tools/release bumps plj
Browse files Browse the repository at this point in the history
  • Loading branch information
nornagon committed Feb 19, 2020
1 parent c1ef11f commit c2dd809
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tools/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,19 @@ const newVersion = semver.inc(package.version, args.level)
const newPackageJson = {...package, version: newVersion}
fs.writeFileSync(packageJsonPath, JSON.stringify(newPackageJson, null, 2) + "\n")

const packageLockJsonPath = path.join(repositoryRoot, 'package-lock.json')
const packageLock = JSON.parse(fs.readFileSync(packageLockJsonPath))
const newPackageLockJson = {...packageLock, version: newVersion}
fs.writeFileSync(packageLockJsonPath, JSON.stringify(newPackageLockJson, null, 2) + "\n")

function git(args) {
const r = child_process.spawnSync("git", args, {cwd: repositoryRoot})
if (r.status !== 0) {
console.error(r.stderr)
throw new Error(`Command failed: git ${args.join(" ")}`)
}
}
git(["add", "package.json"])
git(["add", "package.json", "package-lock.json"])
git(["commit", "-m", `bump to ${newVersion}`])
git(["tag", `v${newVersion}`])

Expand Down

0 comments on commit c2dd809

Please sign in to comment.