Skip to content

Commit

Permalink
fix(ci): add script to fix package json from build step (#410)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
oscard0m committed Mar 3, 2023
1 parent 20c6ad2 commit 7549659
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Expand Up @@ -15,6 +15,8 @@ jobs:
cache: npm
- run: npm ci
- run: npm run build
- name: "Fix pkg.files file pattern"
run: node scripts/fix-package-json.js
- run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
15 changes: 15 additions & 0 deletions scripts/fix-package-json.js
@@ -0,0 +1,15 @@
const fs = require("fs");
const path = require("path");
const {EOL} = require("os");

const pkgPath = path.join(__dirname, "../pkg/package.json");
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));

pkg.files = pkg.files.map((file) => {
if (file.endsWith("/")) {
return file + "**";
}
return file;
});

fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + EOL, "utf8");

0 comments on commit 7549659

Please sign in to comment.