Skip to content

Commit

Permalink
fix(build): add script to fix package.json before publishing (#475)
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfy1339 authored May 16, 2023
1 parent 6410ab6 commit 9e3a7e1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ jobs:
cache: npm
- run: npm ci
- run: npm run build
# https://github.com/octokit/auth-app.js/pull/475
- 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
18 changes: 18 additions & 0 deletions scripts/fix-package-json.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Script to fix the package.json files map. This is needed because npm changed the file matching behavior in npm@9
// https://github.com/octokit/auth-app.js/pull/475

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 9e3a7e1

Please sign in to comment.