@restnfeel/agentc-starter-kit
Version:
한국어 기업용 CMS 모듈 - Task Master AI와 함께 빠르게 웹사이트를 구현할 수 있는 재사용 가능한 컴포넌트 시스템
83 lines (68 loc) • 2.54 kB
JavaScript
/**
* Release script for the chatbot library
* Usage: node scripts/release.js [patch|minor|major]
*/
const fs = require("fs");
const path = require("path");
const { execSync } = require("child_process");
const RELEASE_TYPE = process.argv[2] || "patch";
const VALID_TYPES = ["patch", "minor", "major"];
if (!VALID_TYPES.includes(RELEASE_TYPE)) {
console.error(`❌ Invalid release type: ${RELEASE_TYPE}`);
console.error(` Valid types: ${VALID_TYPES.join(", ")}`);
process.exit(1);
}
console.log(`🚀 Starting ${RELEASE_TYPE} release for chatbot library...`);
try {
// Check if we're in the right directory
const packagePath = path.join(__dirname, "../package.json");
if (!fs.existsSync(packagePath)) {
throw new Error(
"package.json not found. Make sure you're in the chatbot directory."
);
}
// Check git status
console.log("📋 Checking git status...");
const gitStatus = execSync("git status --porcelain", { encoding: "utf-8" });
if (gitStatus.trim()) {
throw new Error(
"Working directory is not clean. Please commit or stash changes first."
);
}
// Run tests
console.log("🧪 Running tests...");
execSync("npm test", { stdio: "inherit" });
// Build the package
console.log("🔨 Building package...");
execSync("npm run build:package", { stdio: "inherit" });
// Update version
console.log(`📦 Updating version (${RELEASE_TYPE})...`);
execSync(`npm version ${RELEASE_TYPE} --no-git-tag-version`, {
stdio: "inherit",
});
// Read new version
const packageJson = JSON.parse(fs.readFileSync(packagePath, "utf-8"));
const newVersion = packageJson.version;
console.log(`✅ Version updated to ${newVersion}`);
// Update changelog
console.log(
"📝 Please update CHANGELOG.md with release notes for version " + newVersion
);
console.log(
' Then run: git add . && git commit -m "Release v' + newVersion + '"'
);
console.log(
" And finally: git tag v" + newVersion + " && git push origin main --tags"
);
console.log(`🎉 Release ${newVersion} prepared successfully!`);
console.log("\n📋 Next steps:");
console.log("1. Update CHANGELOG.md with release notes");
console.log('2. git add . && git commit -m "Release v' + newVersion + '"');
console.log("3. git tag v" + newVersion);
console.log("4. git push origin main --tags");
console.log("5. npm publish (if publishing to npm)");
} catch (error) {
console.error("❌ Release failed:", error.message);
process.exit(1);
}