Skip to content

Commit

Permalink
build(scripts): prune package when releasing
Browse files Browse the repository at this point in the history
  • Loading branch information
metonym committed Nov 17, 2024
1 parent ca53b1c commit 78c8e73
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ jobs:
run: bun install

- name: Build package
run: bun prepack
run: |
bun run prepack
bun run build:prune-package
- name: Publish package
env:
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
}
},
"scripts": {
"prepack": "bun test"
"prepack": "bun test",
"build:prune-package": "bun scripts/prune-package.ts"
},
"devDependencies": {
"@carbon/icon-helpers": "latest",
Expand Down
10 changes: 10 additions & 0 deletions scripts/prune-package.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const pkgJson = await Bun.file("./package.json").json();

// Remove unrelated metadata from package.json for publishing.
delete pkgJson.scripts;
delete pkgJson.devDependencies;

await Bun.write("./package.json", JSON.stringify(pkgJson, null, 2) + "\n");

export { };

0 comments on commit 78c8e73

Please sign in to comment.