feat: semantic-prepare.js

This commit is contained in:
2025-06-23 15:58:24 +03:00
parent b94dc15daf
commit 726e7f0826
3 changed files with 15 additions and 14 deletions

View File

@@ -7,6 +7,9 @@
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
[
[
"./scripts/semantic-prepare.js"
],
"@semantic-release/git",
{
"assets": [

View File

@@ -0,0 +1,12 @@
const fs = require("fs");
const path = require("path");
module.exports = async ({ nextRelease }) => {
const manifestPath = path.resolve(__dirname, "../manifest.json");
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
manifest.version = nextRelease.version;
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
console.log(`✅ Updated manifest.json to version ${nextRelease.version}`);
};

View File

@@ -1,14 +0,0 @@
const fs = require("fs");
const path = "./manifest.json";
const version = process.env.npm_package_version;
if (!version) {
console.error("Version not found in npm_package_version.");
process.exit(1);
}
const manifest = JSON.parse(fs.readFileSync(path, "utf8"));
manifest.version = version;
fs.writeFileSync(path, JSON.stringify(manifest, null, 2));
console.log(`Updated manifest.json to version ${version}`);