MCPcopy Create free account
hub / github.com/CoderLine/alphaTab / updateNpmVersion

Function updateNpmVersion

scripts/update-version.mjs:10–26  ·  view source on GitHub ↗
(packageJsonFilePath)

Source from the content-addressed store, hash-verified

8const currentNpmVersion = rootPkg.version.match(/([0-9]+\.[0-9]+\.[0-9]+)/)[0];
9
10function updateNpmVersion(packageJsonFilePath) {
11 let version = currentNpmVersion;
12 if (process.argv.length === 4) {
13 // node update-version.js alpha 37
14 // -> "version": "1.0.0-alpha37",
15 version = `${version}-${process.argv[2]}.${process.argv[3]}`;
16 }
17
18 console.log(`NPM Path: ${packageJsonFilePath}`);
19 console.log(`Updating version to ${version}`);
20
21 let packageJson = fs.readFileSync(packageJsonFilePath, 'utf-8');
22 packageJson = packageJson
23 .replace(/"version": "[^"]+"/, `"version": "${version}"`)
24 .replaceAll(/("@coderline\/alphatab[^"]*"): "\^[^"]+"/g, `$1: "^${version}"`);
25 fs.writeFileSync(packageJsonFilePath, packageJson);
26}
27
28function updateCSharpVersion(propsPath) {
29 let version = currentNpmVersion;

Callers 1

update-version.mjsFile · 0.85

Calls 2

logMethod · 0.80
replaceMethod · 0.80

Tested by

no test coverage detected