Skip to content

Add auto update contributors list for package.json in release.js #947

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions scripts/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,19 @@ const path = require("path");
const pkg = require("../package.json");

console.log("Updating package.json ...");

delete pkg.dependencies["ts-node"]; // doesn't need ts-node
delete pkg.dependencies.typescript; // or typescript
delete pkg.devDependencies; // or development dependencies
delete pkg.scripts; // or scripts
pkg.files = pkg["files.release"]; // but specifies files
delete pkg["files.release"]; //

// Parse contributors from NOTICE and put into contributors's array in package.json
const notice = fs.readFileSync(path.join(__dirname, "..", "NOTICE"));
const contributors = notice.match(/(?![\s.]+)([\p{L}\s.]+<[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+>)/ug);
pkg.contributors = contributors;

fs.writeFileSync(path.join(__dirname, "..", "package.json"), [
JSON.stringify(pkg, null, 2), '\n'
].join(""));
Expand Down