minify-html/version

25 lines
841 B
JavaScript
Executable File

#!/usr/bin/env node
"use strict";
const {readFileSync, writeFileSync} = require("fs");
const NEW_VERSION = process.argv[2];
const replaceInFile = (path, pattern, replacement) => writeFileSync(path, readFileSync(path, "utf8").replace(pattern, replacement));
for (const f of ["Cargo.toml", "nodejs/native/Cargo.toml"]) {
replaceInFile(f, /^version = "\d+\.\d+\.\d+"\s*$/m, `version = "${NEW_VERSION}"`);
}
for (const f of ["README.md", "nodejs/native/Cargo.toml"]) {
replaceInFile(f, /^hyperbuild = "\d+\.\d+\.\d+"\s*$/m, `hyperbuild = "${NEW_VERSION}"`);
}
for (const f of ["nodejs/package.json"]) {
replaceInFile(f, /^(\s*)"version": "\d+\.\d+\.\d+",\s*$/m, `$1"version": "${NEW_VERSION}",`);
}
for (const f of ["README.md"]) {
replaceInFile(f, /(wilsonl\.in\/hyperbuild\/bin\/)\d+\.\d+\.\d+/g, `$1${NEW_VERSION}`);
}