pyewjn/scripts/standard-version/pyproject-updater.js
Deepak Mallubhotla 6231ecc203
All checks were successful
gitea-physics/pynam/pipeline/head This commit looks good
feat!: big breaking change set
2022-03-28 18:51:52 -05:00

12 lines
367 B
JavaScript

const pattern = /(\[tool\.poetry\]\nname = "pytest"\nversion = ")(?<vers>\d+\.\d+\.\d)(")/mg;
module.exports.readVersion = function (contents) {
const result = pattern.exec(contents);
return result.groups.vers;
}
module.exports.writeVersion = function (contents, version) {
const newContents = contents.replace(pattern, `$1${version}$3`);
return newContents;
}