npm-update-package 0.50.0 → 0.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -0
- package/dist/package.json +1 -1
- package/dist/src/github/pull-request/creator/PullRequestBodyCreator.js +1 -1
- package/dist/src/options/OptionType.js +1 -0
- package/dist/src/options/Options.js +1 -0
- package/dist/src/options/cliOptions.js +7 -0
- package/dist/src/options/parseBooleanOption.js +15 -0
- package/dist/src/options/parseNumberOption.js +12 -0
- package/dist/src/options/toCommanderOption.js +8 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -63,6 +63,24 @@ npx npm-update-package \
|
|
|
63
63
|
--commit-message "chore({{{dependencyType}}}): {{{level}}} update {{{packageName}}} from {{{currentVersion}}} to v{{{newVersion}}}"
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
+
### `--fetch-release-notes`
|
|
67
|
+
|
|
68
|
+
Whether to fetch release notes.
|
|
69
|
+
|
|
70
|
+
|Name|Value|
|
|
71
|
+
|---|---|
|
|
72
|
+
|type|boolean|
|
|
73
|
+
|required|false|
|
|
74
|
+
|default|`true`|
|
|
75
|
+
|
|
76
|
+
#### Example
|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
npx npm-update-package \
|
|
80
|
+
--github-token $GITHUB_TOKEN \
|
|
81
|
+
--fetch-release-notes false
|
|
82
|
+
```
|
|
83
|
+
|
|
66
84
|
### `--fetch-sleep-time`
|
|
67
85
|
|
|
68
86
|
Sleep time between fetching (ms).
|
package/dist/package.json
CHANGED
|
@@ -25,7 +25,7 @@ class PullRequestBodyCreator {
|
|
|
25
25
|
gitRepo
|
|
26
26
|
});
|
|
27
27
|
sections.push(diffSection);
|
|
28
|
-
if ((gitRepo === null || gitRepo === void 0 ? void 0 : gitRepo.isGitHub) === true) {
|
|
28
|
+
if (this.options.fetchReleaseNotes && (gitRepo === null || gitRepo === void 0 ? void 0 : gitRepo.isGitHub) === true) {
|
|
29
29
|
const releases = await this.releasesFetcher.fetch({
|
|
30
30
|
gitRepo,
|
|
31
31
|
packageName: outdatedPackage.name,
|
|
@@ -7,6 +7,7 @@ const package_manager_1 = require("../package-manager");
|
|
|
7
7
|
const Options = (0, io_ts_1.intersection)([
|
|
8
8
|
(0, io_ts_1.type)({
|
|
9
9
|
commitMessage: io_ts_1.string,
|
|
10
|
+
fetchReleaseNotes: io_ts_1.boolean,
|
|
10
11
|
fetchSleepTime: io_ts_1.number,
|
|
11
12
|
githubToken: io_ts_1.string,
|
|
12
13
|
logLevel: (0, io_ts_1.union)([
|
|
@@ -18,6 +18,13 @@ exports.cliOptions = [
|
|
|
18
18
|
required: false,
|
|
19
19
|
default: 'chore(deps): {{{level}}} update {{{packageName}}} to v{{{newVersion}}}'
|
|
20
20
|
},
|
|
21
|
+
{
|
|
22
|
+
name: 'fetch-release-notes',
|
|
23
|
+
description: 'Whether to fetch release notes',
|
|
24
|
+
type: OptionType_1.OptionType.Boolean,
|
|
25
|
+
required: false,
|
|
26
|
+
default: true
|
|
27
|
+
},
|
|
21
28
|
{
|
|
22
29
|
name: 'fetch-sleep-time',
|
|
23
30
|
description: 'Sleep time between fetching (ms)',
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseBooleanOption = void 0;
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const parseBooleanOption = (value) => {
|
|
6
|
+
switch (value) {
|
|
7
|
+
case 'true':
|
|
8
|
+
return true;
|
|
9
|
+
case 'false':
|
|
10
|
+
return false;
|
|
11
|
+
default:
|
|
12
|
+
throw new commander_1.InvalidArgumentError('Not a boolean.');
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
exports.parseBooleanOption = parseBooleanOption;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseNumberOption = void 0;
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const parseNumberOption = (value) => {
|
|
6
|
+
const number = Number(value);
|
|
7
|
+
if (Number.isNaN(number)) {
|
|
8
|
+
throw new commander_1.InvalidArgumentError('Not a number.');
|
|
9
|
+
}
|
|
10
|
+
return number;
|
|
11
|
+
};
|
|
12
|
+
exports.parseNumberOption = parseNumberOption;
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.toCommanderOption = void 0;
|
|
4
4
|
const commander_1 = require("commander");
|
|
5
5
|
const OptionType_1 = require("./OptionType");
|
|
6
|
+
const parseBooleanOption_1 = require("./parseBooleanOption");
|
|
7
|
+
const parseNumberOption_1 = require("./parseNumberOption");
|
|
6
8
|
const toCommanderOption = (cliOption) => {
|
|
7
9
|
const argument = createArgumentString(cliOption);
|
|
8
10
|
const option = new commander_1.Option(`--${cliOption.name} ${argument}`, cliOption.description);
|
|
@@ -12,8 +14,11 @@ const toCommanderOption = (cliOption) => {
|
|
|
12
14
|
if (!cliOption.required && cliOption.default !== undefined) {
|
|
13
15
|
option.default(cliOption.default);
|
|
14
16
|
}
|
|
17
|
+
if (cliOption.type === OptionType_1.OptionType.Boolean) {
|
|
18
|
+
option.argParser(parseBooleanOption_1.parseBooleanOption);
|
|
19
|
+
}
|
|
15
20
|
if (cliOption.type === OptionType_1.OptionType.Number) {
|
|
16
|
-
option.argParser(
|
|
21
|
+
option.argParser(parseNumberOption_1.parseNumberOption);
|
|
17
22
|
}
|
|
18
23
|
return option;
|
|
19
24
|
};
|
|
@@ -24,6 +29,8 @@ const createArgumentString = (cliOption) => {
|
|
|
24
29
|
};
|
|
25
30
|
const createArgumentNameString = (optionType) => {
|
|
26
31
|
switch (optionType) {
|
|
32
|
+
case OptionType_1.OptionType.Boolean:
|
|
33
|
+
return 'boolean';
|
|
27
34
|
case OptionType_1.OptionType.Number:
|
|
28
35
|
return 'number';
|
|
29
36
|
case OptionType_1.OptionType.String:
|