version.js 766 B

12345678910111213141516171819202122232425
  1. const fs = require("fs");
  2. const path = require("path");
  3. const ch = require("child_process");
  4. const dirs = fs.readdirSync(path.join(__dirname, "../packages"));
  5. const DOCS_PATH = path.join(__dirname, "../packages", "docs/docs/log");
  6. ch.execSync("pnpm changeset version", { stdio: "inherit" });
  7. dirs.forEach((dir) => {
  8. const context = path.join(__dirname, "../packages", dir);
  9. const CHANGELOG_PATH = context + "\\CHANGELOG.md";
  10. if (fs.existsSync(CHANGELOG_PATH)) {
  11. const target = path.join(DOCS_PATH, `${dir.toUpperCase()}_CHANGELOG.md`);
  12. fs.copyFile(CHANGELOG_PATH, target, (err) => {
  13. if (err) {
  14. console.error(`复制${dir}时出错:`, error);
  15. return;
  16. }
  17. });
  18. }
  19. });
  20. console.log("===== docs 同步 log 完成 =====");