Skip to content

Commit

Permalink
ci: update post-changeset
Browse files Browse the repository at this point in the history
Signed-off-by: Logan McAnsh <[email protected]>

ci: update post-changeset

Signed-off-by: Logan McAnsh <[email protected]>

ci: update post-changeset

Signed-off-by: Logan McAnsh <[email protected]>

ci: update post-changeset

Signed-off-by: Logan McAnsh <[email protected]>
  • Loading branch information
mcansh committed Apr 25, 2024
1 parent 9a6c5fe commit 5c87dd5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions scripts/post-changeset.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
import fs from "node:fs";
import path from "node:path";
import url from "node:url";
import { glob } from "glob";
import PackageJson from "@npmcli/package-json";

let __dirname = path.dirname(url.fileURLToPath(import.meta.url));
let __dirname = path.dirname(new URL(import.meta.url).pathname);
let rootDir = path.resolve(__dirname, "..");

// 1. remove CHANGELOG.md from './examples/*'
let changelogs = glob.sync("./examples/*/CHANGELOG.md", { cwd: rootDir });

for (let file of changelogs) {
fs.rmSync(path.resolve(rootDir, file));
console.log(`✅ Removed ${file}`);
}

// 2. remove `version: null` from './examples/*/package.json'
let packageJsons = glob.sync("./examples/*/package.json", { cwd: rootDir });

for (let file of packageJsons) {
let pkg = await PackageJson.load(path.dirname(file));
if (pkg.content.version === null) {
if (!pkg.content.version) {
delete pkg.content.version;
await pkg.fix({ changes: true });
await pkg.save();
}
}

0 comments on commit 5c87dd5

Please sign in to comment.