Skip to content

Commit e7f99d0

Browse files
authoredApr 21, 2023
fix(build): add script to fix package.json from build step (#584)
Fixes #583
1 parent ec5b66e commit e7f99d0

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed
 

‎.github/workflows/release.yml

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515
cache: npm
1616
- run: npm ci
1717
- run: npm run build
18+
- name: "Fix pkg.files file pattern"
19+
run: node scripts/fix-package-json.js
1820
- run: npx semantic-release
1921
env:
2022
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

‎scripts/fix-package-json.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const fs = require("fs");
2+
const path = require("path");
3+
const { EOL } = require("os");
4+
5+
const pkgPath = path.join(__dirname, "../pkg/package.json");
6+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
7+
8+
pkg.files = pkg.files.map((file) => {
9+
if (file.endsWith("/")) {
10+
return file + "**";
11+
}
12+
return file;
13+
});
14+
15+
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + EOL, "utf8");

0 commit comments

Comments
 (0)
Please sign in to comment.