release-it 19.0.1 → 19.0.3

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 CHANGED
@@ -162,7 +162,7 @@ GitLab projects can have releases attached to Git tags, containing release notes
162
162
  releases][32]:
163
163
 
164
164
  - Configure `gitlab.release: true`
165
- - Obtain a [personal access token][33] (release-it only needs the "api" scope).
165
+ - Obtain a [personal access token][33] (release-it needs the `api` and `self_rotate` scopes).
166
166
  - Make sure the token is [available as an environment variable][34].
167
167
 
168
168
  → See [GitLab Releases][35] for more details.
@@ -63,7 +63,7 @@
63
63
  "tokenRef": "GITLAB_TOKEN",
64
64
  "tokenHeader": "Private-Token",
65
65
  "certificateAuthorityFile": null,
66
- "secure": null,
66
+ "secure": false,
67
67
  "assets": null,
68
68
  "useIdsForUrls": false,
69
69
  "useGenericPackageRepositoryForAssets": false,
@@ -1,5 +1,5 @@
1
1
  import { EOL } from 'node:os';
2
- import { x } from 'tinyexec';
2
+ import { spawn } from 'node:child_process';
3
3
  import matcher from 'wildcard-match';
4
4
  import { format, e, fixArgs, once, castArray } from '../../util.js';
5
5
  import GitBase from '../GitBase.js';
@@ -11,11 +11,13 @@ const options = { write: false };
11
11
 
12
12
  const docs = 'https://git.io/release-it-git';
13
13
 
14
- const isGitRepo = () =>
15
- x('git', ['rev-parse', '--git-dir'], { throwOnError: true }).then(
16
- () => true,
17
- () => false
18
- );
14
+ async function isGitRepo() {
15
+ return await new Promise(resolve => {
16
+ const process = spawn('git', ['rev-parse', '--git-dir']);
17
+ process.on('close', code => resolve(code === 0));
18
+ process.on('error', () => resolve(false));
19
+ });
20
+ }
19
21
 
20
22
  class Git extends GitBase {
21
23
  constructor(...args) {
@@ -14,6 +14,7 @@ const DEFAULT_TAG = 'latest';
14
14
  const DEFAULT_TAG_PRERELEASE = 'next';
15
15
  const NPM_BASE_URL = 'https://www.npmjs.com';
16
16
  const NPM_PUBLIC_PATH = '/package';
17
+ const DEFAULT_TIMEOUT = 10;
17
18
 
18
19
  class npm extends Plugin {
19
20
  static isEnabled(options) {
@@ -32,7 +33,7 @@ class npm extends Plugin {
32
33
 
33
34
  const { publish, skipChecks } = this.options;
34
35
 
35
- const timeout = Number(this.options.timeout) * 1000;
36
+ const timeout = Number(this.options.timeout ?? DEFAULT_TIMEOUT) * 1000;
36
37
 
37
38
  if (publish === false || isPrivate) return;
38
39
 
package/lib/shell.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import util from 'node:util';
2
- import childProcess from 'node:child_process';
3
- import { x } from 'tinyexec';
2
+ import { spawn, exec } from 'node:child_process';
4
3
  import { format } from './util.js';
5
4
 
6
5
  const debug = util.debug('release-it:shell');
@@ -53,7 +52,7 @@ class Shell {
53
52
 
54
53
  execStringCommand(command, options, { isExternal }) {
55
54
  return new Promise((resolve, reject) => {
56
- const proc = childProcess.exec(command, (err, stdout, stderr) => {
55
+ const proc = exec(command, (err, stdout, stderr) => {
57
56
  stdout = stdout.toString().trimEnd();
58
57
  const code = !err ? 0 : err === 'undefined' ? 1 : err.code;
59
58
  debug({ command, options, code, stdout, stderr });
@@ -68,21 +67,52 @@ class Shell {
68
67
  });
69
68
  }
70
69
 
71
- async execWithArguments(command, options, { isExternal }) {
70
+ async execWithArguments(command, options = {}, { isExternal } = {}) {
72
71
  const [program, ...programArgs] = command;
73
72
 
74
73
  try {
75
- const { stdout: out, stderr } = await x(program, programArgs, { throwOnError: true });
76
- const stdout = out === '""' ? '' : out;
77
- this.log.verbose(stdout, { isExternal });
78
- debug({ command, options, stdout, stderr });
79
- return Promise.resolve((stdout || stderr).trim());
74
+ return await new Promise((resolve, reject) => {
75
+ const proc = spawn(program, programArgs, {
76
+ // we want to capture all output from the process so the extra 2 pipe
77
+ stdio: ['inherit', 'pipe', 'pipe'],
78
+ ...options
79
+ });
80
+
81
+ let stdout = '';
82
+ let stderr = '';
83
+
84
+ proc.stdout.on('data', data => {
85
+ stdout += data.toString();
86
+ });
87
+
88
+ proc.stderr.on('data', data => {
89
+ stderr += data.toString();
90
+ });
91
+
92
+ proc.on('close', code => {
93
+ stdout = stdout === '""' ? '' : stdout;
94
+ this.log.verbose(stdout, { isExternal });
95
+ debug({ command, options, stdout, stderr });
96
+
97
+ if (code === 0) {
98
+ resolve((stdout || stderr).trim());
99
+ } else {
100
+ if (stdout) {
101
+ this.log.log(`\n${stdout}`);
102
+ }
103
+ debug({ code, command, options, stdout, stderr });
104
+ reject(new Error(stderr || stdout || `Process exited with code ${code}`));
105
+ }
106
+ });
107
+
108
+ proc.on('error', err => {
109
+ debug(err);
110
+ reject(new Error(err.message));
111
+ });
112
+ });
80
113
  } catch (err) {
81
- if (err.output.stdout) {
82
- this.log.log(`\n${err.output.stdout}`);
83
- }
84
114
  debug(err);
85
- return Promise.reject(new Error(err.output.stderr || err.output.stdout || err.message));
115
+ return Promise.reject(err);
86
116
  }
87
117
  }
88
118
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "release-it",
3
- "version": "19.0.1",
3
+ "version": "19.0.3",
4
4
  "description": "Generic CLI tool to automate versioning and package publishing-related tasks.",
5
5
  "keywords": [
6
6
  "build",
@@ -80,42 +80,41 @@
80
80
  "dependencies": {
81
81
  "@nodeutils/defaults-deep": "1.1.0",
82
82
  "@octokit/rest": "21.1.1",
83
- "@phun-ky/typeof": "1.2.5",
83
+ "@phun-ky/typeof": "1.2.8",
84
84
  "async-retry": "1.3.3",
85
- "c12": "3.0.3",
85
+ "c12": "3.0.4",
86
86
  "ci-info": "^4.2.0",
87
87
  "eta": "3.5.0",
88
88
  "git-url-parse": "16.1.0",
89
- "inquirer": "12.5.2",
89
+ "inquirer": "12.6.3",
90
90
  "issue-parser": "7.0.1",
91
91
  "lodash.get": "4.4.2",
92
92
  "lodash.merge": "4.6.2",
93
93
  "mime-types": "3.0.1",
94
94
  "new-github-release-url": "2.0.0",
95
- "open": "10.1.1",
95
+ "open": "10.1.2",
96
96
  "ora": "8.2.0",
97
- "os-name": "6.0.0",
97
+ "os-name": "6.1.0",
98
98
  "proxy-agent": "6.5.0",
99
- "semver": "7.7.1",
100
- "tinyexec": "1.0.1",
101
- "tinyglobby": "0.2.12",
99
+ "semver": "7.7.2",
100
+ "tinyglobby": "0.2.14",
102
101
  "undici": "6.21.2",
103
102
  "url-join": "5.0.0",
104
103
  "wildcard-match": "5.1.4",
105
104
  "yargs-parser": "21.1.1"
106
105
  },
107
106
  "devDependencies": {
108
- "@eslint/compat": "1.2.8",
107
+ "@eslint/compat": "1.2.9",
109
108
  "@eslint/eslintrc": "3.3.1",
110
- "@eslint/js": "9.24.0",
109
+ "@eslint/js": "9.27.0",
111
110
  "@octokit/request-error": "6.1.8",
112
- "@types/node": "20.17.30",
113
- "eslint": "9.24.0",
114
- "eslint-plugin-import-x": "4.10.5",
115
- "globals": "16.0.0",
111
+ "@types/node": "20.17.32",
112
+ "eslint": "9.27.0",
113
+ "eslint-plugin-import-x": "4.13.3",
114
+ "globals": "16.2.0",
116
115
  "installed-check": "9.3.0",
117
- "knip": "5.50.5",
118
- "mentoss": "0.9.2",
116
+ "knip": "5.59.1",
117
+ "mentoss": "0.11.0",
119
118
  "mock-stdio": "1.0.3",
120
119
  "prettier": "3.5.3",
121
120
  "remark-cli": "12.0.1",
@@ -128,7 +127,7 @@
128
127
  "socks": "2.8.3"
129
128
  },
130
129
  "engines": {
131
- "node": "^20.9.0 || >=22.0.0"
130
+ "node": "^20.12.0 || >=22.0.0"
132
131
  },
133
132
  "remarkConfig": {
134
133
  "plugins": [
@@ -51,7 +51,7 @@
51
51
  "default": "CI_SERVER_TLS_CA_FILE"
52
52
  },
53
53
  "secure": {
54
- "default": null
54
+ "default": false
55
55
  },
56
56
  "assets": {
57
57
  "default": null
package/types/config.d.ts CHANGED
@@ -181,7 +181,7 @@ export interface Config {
181
181
  /** @default null */
182
182
  certificateAuthorityFile?: any;
183
183
 
184
- /** @default null */
184
+ /** @default false */
185
185
  secure?: boolean;
186
186
 
187
187
  /** @default null */