release: WRNexusJS 0.2.36
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
import { existsSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
|
||||
const version = "0.2.37";
|
||||
|
||||
const dependencyGroups = [
|
||||
"dependencies",
|
||||
"devDependencies",
|
||||
"peerDependencies",
|
||||
"optionalDependencies",
|
||||
];
|
||||
|
||||
for (const entry of readdirSync("packages", {
|
||||
withFileTypes: true,
|
||||
})) {
|
||||
if (!entry.isDirectory()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const packageFile = join("packages", entry.name, "package.json");
|
||||
|
||||
if (!existsSync(packageFile)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const packageJson = JSON.parse(readFileSync(packageFile, "utf8"));
|
||||
|
||||
packageJson.version = version;
|
||||
|
||||
for (const group of dependencyGroups) {
|
||||
const dependencies = packageJson[group];
|
||||
|
||||
if (!dependencies || typeof dependencies !== "object") {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const dependencyName of Object.keys(dependencies)) {
|
||||
if (!dependencyName.startsWith("@wrnexus/")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const currentVersion = dependencies[dependencyName];
|
||||
|
||||
if (typeof currentVersion !== "string") {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (currentVersion.startsWith("workspace:")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (currentVersion.startsWith("^")) {
|
||||
dependencies[dependencyName] = `^${version}`;
|
||||
} else if (currentVersion.startsWith("~")) {
|
||||
dependencies[dependencyName] = `~${version}`;
|
||||
} else {
|
||||
dependencies[dependencyName] = version;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
writeFileSync(packageFile, `${JSON.stringify(packageJson, null, 2)}\n`);
|
||||
}
|
||||
Reference in New Issue
Block a user