version.mjs 694 B

12345678910111213141516171819202122232425262728
  1. import fs from "fs";
  2. const rootPkg = JSON.parse(fs.readFileSync("./package.json"), "utf-8");
  3. const version = rootPkg.version;
  4. const targets = [
  5. "./lib/typescript/package.json",
  6. "./lib/module/package.json"
  7. ];
  8. targets.forEach(target => {
  9. if (fs.existsSync(target)) {
  10. const pkg = JSON.parse(fs.readFileSync(target, "utf-8"));
  11. pkg.version = version;
  12. fs.writeFileSync(target, JSON.stringify(pkg, null, 2));
  13. console.log(`✅ ${target} güncellendi: version ${version} eklendi.`);
  14. }
  15. });
  16. fs.writeFileSync("./lib/package.json", JSON.stringify({
  17. version: version,
  18. type: "module"
  19. }, null, 4));
  20. console.log(`✅ Main package.json eklendi.`);