release-it 19.0.0-next.3 → 19.0.0-next.4

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/bin/release-it.js CHANGED
@@ -1,38 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import updater from 'update-notifier';
4
- import parseArgs from 'yargs-parser';
5
4
  import release from '../lib/cli.js';
6
5
  import { readJSON } from '../lib/util.js';
6
+ import { parseCliArguments } from '../lib/args.js';
7
7
 
8
8
  const pkg = readJSON(new URL('../package.json', import.meta.url));
9
9
 
10
- const aliases = {
11
- c: 'config',
12
- d: 'dry-run',
13
- h: 'help',
14
- i: 'increment',
15
- v: 'version',
16
- V: 'verbose'
17
- };
18
-
19
- const parseCliArguments = args => {
20
- const options = parseArgs(args, {
21
- boolean: ['dry-run', 'ci'],
22
- alias: aliases,
23
- configuration: {
24
- 'parse-numbers': false,
25
- 'camel-case-expansion': false
26
- }
27
- });
28
- if (options.V) {
29
- options.verbose = typeof options.V === 'boolean' ? options.V : options.V.length;
30
- delete options.V;
31
- }
32
- options.increment = options._[0] || options.i;
33
- return options;
34
- };
35
-
36
10
  const options = parseCliArguments([].slice.call(process.argv, 2));
37
11
 
38
12
  updater({ pkg: pkg }).notify();
package/lib/args.js ADDED
@@ -0,0 +1,64 @@
1
+ import parseArgs from 'yargs-parser';
2
+
3
+ const aliases = {
4
+ c: 'config',
5
+ d: 'dry-run',
6
+ h: 'help',
7
+ i: 'increment',
8
+ v: 'version',
9
+ V: 'verbose'
10
+ };
11
+
12
+ const booleanOptions = [
13
+ 'dry-run',
14
+ 'ci',
15
+ 'git',
16
+ 'npm',
17
+ 'github',
18
+ 'gitlab',
19
+ 'git.addUntrackedFiles',
20
+ 'git.requireCleanWorkingDir',
21
+ 'git.requireUpstream',
22
+ 'git.requireCommits',
23
+ 'git.requireCommitsFail',
24
+ 'git.commit',
25
+ 'git.tag',
26
+ 'git.push',
27
+ 'git.getLatestTagFromAllRefs',
28
+ 'git.skipChecks',
29
+ 'github.release',
30
+ 'github.autoGenerate',
31
+ 'github.preRelease',
32
+ 'github.draft',
33
+ 'github.skipChecks',
34
+ 'github.web',
35
+ 'github.comments.submit',
36
+ 'gitlab.release',
37
+ 'gitlab.autoGenerate',
38
+ 'gitlab.preRelease',
39
+ 'gitlab.draft',
40
+ 'gitlab.useIdsForUrls',
41
+ 'gitlab.useGenericPackageRepositoryForAssets',
42
+ 'gitlab.skipChecks',
43
+ 'npm.publish',
44
+ 'npm.ignoreVersion',
45
+ 'npm.allowSameVersion',
46
+ 'npm.skipChecks'
47
+ ];
48
+
49
+ export const parseCliArguments = args => {
50
+ const options = parseArgs(args, {
51
+ boolean: booleanOptions,
52
+ alias: aliases,
53
+ configuration: {
54
+ 'parse-numbers': false,
55
+ 'camel-case-expansion': false
56
+ }
57
+ });
58
+ if (options.V) {
59
+ options.verbose = typeof options.V === 'boolean' ? options.V : options.V.length;
60
+ delete options.V;
61
+ }
62
+ options.increment = options._[0] || options.i;
63
+ return options;
64
+ };
@@ -131,7 +131,7 @@ class Git extends GitBase {
131
131
  async getCommitsSinceLatestTag(commitsPath = '') {
132
132
  const latestTagName = await this.getLatestTagName();
133
133
  const ref = latestTagName ? `${latestTagName}..HEAD` : 'HEAD';
134
- return this.exec(`git rev-list ${ref} --count ${commitsPath}`, { options }).then(Number);
134
+ return this.exec(`git rev-list ${ref} --count ${commitsPath ? `-- ${commitsPath}` : ''}`, { options }).then(Number);
135
135
  }
136
136
 
137
137
  async getUpstreamArgs(pushRepo) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "release-it",
3
- "version": "19.0.0-next.3",
3
+ "version": "19.0.0-next.4",
4
4
  "description": "Generic CLI tool to automate versioning and package publishing-related tasks.",
5
5
  "keywords": [
6
6
  "build",
@@ -81,7 +81,7 @@
81
81
  "@iarna/toml": "2.2.5",
82
82
  "@nodeutils/defaults-deep": "1.1.0",
83
83
  "@octokit/rest": "21.1.1",
84
- "@phun-ky/typeof": "1.2.3",
84
+ "@phun-ky/typeof": "1.2.4",
85
85
  "async-retry": "1.3.3",
86
86
  "ci-info": "^4.2.0",
87
87
  "cosmiconfig": "9.0.0",
@@ -89,7 +89,7 @@
89
89
  "execa": "9.5.2",
90
90
  "git-url-parse": "16.0.1",
91
91
  "globby": "14.1.0",
92
- "inquirer": "12.5.0",
92
+ "inquirer": "12.5.2",
93
93
  "issue-parser": "7.0.1",
94
94
  "lodash.get": "4.4.2",
95
95
  "lodash.merge": "4.6.2",
@@ -107,22 +107,22 @@
107
107
  "yargs-parser": "21.1.1"
108
108
  },
109
109
  "devDependencies": {
110
- "@eslint/compat": "1.2.7",
110
+ "@eslint/compat": "1.2.8",
111
111
  "@eslint/eslintrc": "3.3.1",
112
- "@eslint/js": "9.23.0",
112
+ "@eslint/js": "9.24.0",
113
113
  "@octokit/request-error": "6.1.7",
114
114
  "@types/node": "20.17.28",
115
- "eslint": "9.23.0",
116
- "eslint-plugin-import-x": "4.9.4",
115
+ "eslint": "9.24.0",
116
+ "eslint-plugin-import-x": "4.10.2",
117
117
  "globals": "16.0.0",
118
118
  "installed-check": "9.3.0",
119
- "knip": "5.46.3",
119
+ "knip": "5.48.0",
120
120
  "mentoss": "0.9.0",
121
121
  "mock-stdio": "1.0.3",
122
122
  "prettier": "3.5.3",
123
123
  "remark-cli": "12.0.1",
124
124
  "remark-preset-webpro": "1.1.1",
125
- "typescript": "5.8.2"
125
+ "typescript": "5.8.3"
126
126
  },
127
127
  "overrides": {
128
128
  "pac-resolver": "7.0.1",
package/schema/git.json CHANGED
@@ -38,8 +38,8 @@
38
38
  "default": ""
39
39
  },
40
40
  "addUntrackedFiles": {
41
- "type": "string",
42
- "default": ""
41
+ "type": "boolean",
42
+ "default": false
43
43
  },
44
44
  "commit": {
45
45
  "type": "boolean",
@@ -53,6 +53,10 @@
53
53
  },
54
54
  "default": []
55
55
  },
56
+ "commitMessage": {
57
+ "type": "string",
58
+ "default": null
59
+ },
56
60
  "tag": {
57
61
  "type": "boolean",
58
62
  "default": true
package/test/args.js ADDED
@@ -0,0 +1,27 @@
1
+ import test from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { parseCliArguments } from '../lib/args.js';
4
+
5
+ test("should parse boolean arguments", () => {
6
+ const args = [
7
+ '--dry-run=false',
8
+ '--ci',
9
+ '--github=false',
10
+ '--no-npm',
11
+ '--git.addUntrackedFiles=true',
12
+ '--git.commit=false',
13
+ '--no-git.tag',
14
+ '--git.commitMessage=test',
15
+ ]
16
+
17
+ const result = parseCliArguments(args);
18
+
19
+ assert.equal(result['dry-run'], false);
20
+ assert.equal(result.ci, true);
21
+ assert.equal(result.github, false);
22
+ assert.equal(result.npm, false);
23
+ assert.equal(result.git.addUntrackedFiles, true);
24
+ assert.equal(result.git.commit, false);
25
+ assert.equal(result.git.tag, false);
26
+ assert.equal(result.git.commitMessage, 'test');
27
+ });