Skip to content

Commit

Permalink
chore(tooling): Use more robust tool for manifest version bumps
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Nov 19, 2024
1 parent 488661b commit adb1ca2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
11 changes: 8 additions & 3 deletions build-aux/cargo-updater.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
const TOML = require('@iarna/toml')
const { exec } = require('node:child_process')

module.exports.readVersion = function (contents) {
const data = TOML.parse(contents)
return data.package.version
}

module.exports.writeVersion = function (contents, version) {
const data = TOML.parse(contents)
data.package.version = version
return TOML.stringify(data)
exec('cargo-set-version set-version ' + version, (err, output) => {
if (err) {
console.error("Could not run Cargo subcommand to set version: ", err)
return
}
})
return contents
}
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ AM_COND_IF([FONT_DOWNLOAD_TOOLS], [

AM_COND_IF([DEVELOPER_MODE], [
QUE_PROGVAR([busted])
QUE_PROGVAR([cargosetversion], [cargo-set-version])
QUE_PROGVAR([curl])
QUE_PROGVAR([delta])
QUE_PROGVAR([diff])
Expand All @@ -189,6 +190,7 @@ AM_COND_IF([DEVELOPER_MODE], [
QUE_PROGVAR([npm])
QUE_PROGVAR([perl])
QUE_PROGVAR([stylua])
QUE_PROGVAR([taplo])
QUE_PROGVAR([tr])
QUE_PROGVAR([typos])
])
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
}
],
"scripts": {
"postbump": "cargo generate-lockfile --offline",
"postbump": "taplo format Cargo.toml && cargo generate-lockfile --offline",
"postcommit": "git add -u Cargo.lock && git commit --amend --no-edit"
},
"infile": "CHANGELOG.md",
Expand Down

0 comments on commit adb1ca2

Please sign in to comment.