-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(build): add script to fix
package.json
before publishing (#475)
- Loading branch information
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); |