Skip to content

Commit 7549659

Browse files
authored
fix(ci): add script to fix package json from build step (#410)
* fix(ci): add hotfix in built package.json to use proper file patterns in "files" You can read more here: #405 * ci(release): run 'scripts/fix-package-json.js' before release
1 parent 20c6ad2 commit 7549659

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
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

Lines changed: 15 additions & 0 deletions
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)