Skip to content

Commit

Permalink
feat: show the number of packages in PR body (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
ybiquitous committed Jul 17, 2020
1 parent 7227b66 commit 7011bef
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8268,7 +8268,7 @@ module.exports = function buildPullRequestBody(report) {
const lines = [];
if (report.updated.length > 0) {
lines.push("");
lines.push("### Updated");
lines.push(`### Updated (${report.updated.length})`);
lines.push("");
lines.push(...header);

Expand All @@ -8284,7 +8284,7 @@ module.exports = function buildPullRequestBody(report) {
}
if (report.added.length > 0) {
lines.push("");
lines.push("### Added");
lines.push(`### Added (${report.added.length})`);
lines.push("");
lines.push(...header);
report.added.forEach(({ name, version }) => {
Expand All @@ -8293,7 +8293,7 @@ module.exports = function buildPullRequestBody(report) {
}
if (report.removed.length > 0) {
lines.push("");
lines.push("### Removed");
lines.push(`### Removed (${report.removed.length})`);
lines.push("");
lines.push(...header);
report.removed.forEach(({ name, version }) => {
Expand Down
6 changes: 3 additions & 3 deletions lib/__tests__/buildPullRequestBody.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ const report = require("./report.json");
test("buildPullRequestBody()", () => {
expect(buildPullRequestBody(report)).toBe(
`
### Updated
### Updated (2)
| Package | Version | Detail |
|:--------|:-------:|:-------|
| [minimist](https://npm.im/minimist) ([github](https://github.com/substack/minimist)) | \`1.2.1\` → \`1.2.4\` | - |
| [mocha](https://npm.im/mocha) ([github](https://github.com/mochajs/mocha)) | \`1.3.0\` → \`1.4.3\` | **[Low]** Prototype Pollution ([ref](https://npmjs.com/advisories/1179)) |
### Added
### Added (1)
| Package | Version | Detail |
|:--------|:-------:|:-------|
| [xo](https://npm.im/xo) | \`0.1.1\` | - |
### Removed
### Removed (1)
| Package | Version | Detail |
|:--------|:-------:|:-------|
Expand Down
6 changes: 3 additions & 3 deletions lib/buildPullRequestBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports = function buildPullRequestBody(report) {
const lines = [];
if (report.updated.length > 0) {
lines.push("");
lines.push("### Updated");
lines.push(`### Updated (${report.updated.length})`);
lines.push("");
lines.push(...header);

Expand All @@ -57,7 +57,7 @@ module.exports = function buildPullRequestBody(report) {
}
if (report.added.length > 0) {
lines.push("");
lines.push("### Added");
lines.push(`### Added (${report.added.length})`);
lines.push("");
lines.push(...header);
report.added.forEach(({ name, version }) => {
Expand All @@ -66,7 +66,7 @@ module.exports = function buildPullRequestBody(report) {
}
if (report.removed.length > 0) {
lines.push("");
lines.push("### Removed");
lines.push(`### Removed (${report.removed.length})`);
lines.push("");
lines.push(...header);
report.removed.forEach(({ name, version }) => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"test": "jest --testTimeout 30000",
"test:watch": "jest --testTimeout 30000 --watch",
"test:coverage": "echo \"unsupported.\" && exit 1",
"prettier": "prettier --ignore-path .gitignore .",
"prettier": "prettier .",
"prettier:check": "npm run prettier -- --check",
"prettier:write": "npm run prettier -- --write",
"format": "npm-run-all --print-label --parallel lint:*:fix prettier:write",
Expand Down

0 comments on commit 7011bef

Please sign in to comment.