This commit is contained in:
bipproduction
2025-11-17 17:42:03 +08:00
parent 77190ff363
commit ea210b0ed9
5 changed files with 34 additions and 6 deletions

View File

@@ -83,6 +83,5 @@ async function build() {
execSync("git add -A", { stdio: 'inherit' })
execSync("git commit -m 'build'", { stdio: 'inherit' })
execSync("cd src && npm version patch", { stdio: 'inherit' })
build()

27
bin/version_update.ts Normal file
View File

@@ -0,0 +1,27 @@
import { execSync } from "node:child_process";
import fs from "node:fs";
const NAMESPACE = process.env.NAMESPACE
if (!NAMESPACE) {
throw new Error('NAMESPACE is required')
}
// 1. Ambil versi remote dari npm
const remoteVersion = execSync(`npm view n8n-nodes-${NAMESPACE} version`)
.toString()
.trim();
console.log("🔍 Remote version:", remoteVersion);
// 2. Pecah versi → major.minor.patch
const [major, minor, patch] = remoteVersion.split(".").map(Number);
// 3. Generate versi baru: remote + 1 patch
const newLocalVersion = `${major}.${minor}.${patch + 1}`;
const pkgPath = "src/package.json";
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
pkg.version = newLocalVersion;
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));