@node-core/utils 5.5.1 → 5.6.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.
@@ -17,6 +17,10 @@ const releaseOptions = {
17
17
  describe: 'Promote new release of Node.js',
18
18
  type: 'boolean'
19
19
  },
20
+ releaseDate: {
21
+ describe: 'Default relase date when --prepare is used. It must be YYYY-MM-DD',
22
+ type: 'string'
23
+ },
20
24
  security: {
21
25
  describe: 'Demarcate the new security release as a security release',
22
26
  type: 'boolean'
@@ -32,6 +36,11 @@ const releaseOptions = {
32
36
  startLTS: {
33
37
  describe: 'Mark the release as the transition from Current to LTS',
34
38
  type: 'boolean'
39
+ },
40
+ yes: {
41
+ type: 'boolean',
42
+ default: false,
43
+ describe: 'Skip all prompts and run non-interactively'
35
44
  }
36
45
  };
37
46
 
@@ -66,6 +75,10 @@ function release(state, argv) {
66
75
  const cli = new CLI(logStream);
67
76
  const dir = process.cwd();
68
77
 
78
+ if (argv.yes) {
79
+ cli.setAssumeYes();
80
+ }
81
+
69
82
  return runPromise(main(state, argv, cli, dir)).catch((err) => {
70
83
  if (cli.spinner.enabled) {
71
84
  cli.spinner.fail();
@@ -22,6 +22,7 @@ export function builder(yargs) {
22
22
  default: 'lkgr'
23
23
  });
24
24
  yargs.option('version-bump', {
25
+ type: 'boolean',
25
26
  describe: 'Bump the NODE_MODULE_VERSION constant',
26
27
  default: true
27
28
  });
@@ -39,10 +40,12 @@ export function builder(yargs) {
39
40
  builder: (yargs) => {
40
41
  yargs
41
42
  .option('bump', {
43
+ type: 'boolean',
42
44
  describe: 'Bump V8 embedder version number or patch version',
43
45
  default: true
44
46
  })
45
47
  .option('squash', {
48
+ type: 'boolean',
46
49
  describe:
47
50
  'If multiple commits are backported, squash them into one',
48
51
  default: false
@@ -62,8 +65,8 @@ export function builder(yargs) {
62
65
  describe: 'Directory of an existing V8 clone'
63
66
  })
64
67
  .option('verbose', {
68
+ type: 'boolean',
65
69
  describe: 'Enable verbose output',
66
- boolean: true,
67
70
  default: false
68
71
  });
69
72
  }
package/lib/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import ora from 'ora';
2
2
  import chalk from 'chalk';
3
- import inquirer from 'inquirer';
3
+ import * as inquirer from '@inquirer/prompts';
4
4
 
5
5
  import { warning, error, info, success } from './figures.js';
6
6
 
@@ -81,12 +81,10 @@ export default class CLI {
81
81
  return defaultAnswer;
82
82
  }
83
83
 
84
- const { answer } = await inquirer.prompt([{
85
- type: questionType,
86
- name: 'answer',
84
+ const answer = await inquirer[questionType]({
87
85
  message: question,
88
86
  default: defaultAnswer
89
- }]);
87
+ });
90
88
 
91
89
  if (isSpinning) {
92
90
  this.spinner.start(spinningMessage);
@@ -25,6 +25,7 @@ export default class ReleasePreparation extends Session {
25
25
  this.isLTS = false;
26
26
  this.isLTSTransition = argv.startLTS;
27
27
  this.runBranchDiff = !argv.skipBranchDiff;
28
+ this.defaultReleaseDate = argv.releaseDate ?? new Date().toISOString().slice(0, 10);
28
29
  this.ltsCodename = '';
29
30
  this.date = '';
30
31
  this.filterLabels = argv.filterLabel && argv.filterLabel.split(',');
@@ -241,9 +242,8 @@ export default class ReleasePreparation extends Session {
241
242
  cli.stopSpinner('Updated REPLACEME items in docs');
242
243
 
243
244
  // Fetch date to use in release commit & changelogs.
244
- const todayDate = new Date().toISOString().split('T')[0];
245
245
  this.date = await cli.prompt('Enter release date in YYYY-MM-DD format:',
246
- { questionType: 'input', defaultAnswer: todayDate });
246
+ { questionType: 'input', defaultAnswer: this.defaultReleaseDate });
247
247
 
248
248
  cli.startSpinner('Updating CHANGELOG.md');
249
249
  await this.updateMainChangelog();
@@ -253,9 +253,6 @@ export default class ReleasePreparation extends Session {
253
253
  await this.updateMajorChangelog();
254
254
  cli.stopSpinner(`Updated CHANGELOG_V${versionComponents.major}.md`);
255
255
 
256
- await cli.prompt('Finished editing the changelogs?',
257
- { defaultAnswer: false });
258
-
259
256
  // Create release commit.
260
257
  const shouldCreateReleaseCommit = await cli.prompt(
261
258
  'Create release commit?');
@@ -272,9 +269,7 @@ export default class ReleasePreparation extends Session {
272
269
  cli.warn(`Please manually edit commit ${lastCommitSha} by running ` +
273
270
  '`git commit --amend` before proceeding.');
274
271
 
275
- await cli.prompt(
276
- 'Finished editing the release commit?',
277
- { defaultAnswer: false });
272
+ await cli.prompt('Finished editing the release commit?');
278
273
  }
279
274
 
280
275
  cli.separator();
@@ -625,8 +620,7 @@ export default class ReleasePreparation extends Session {
625
620
  ]);
626
621
 
627
622
  cli.log(`${messageTitle}\n\n${messageBody.join('')}`);
628
- const useMessage = await cli.prompt(
629
- 'Continue with this commit message?', { defaultAnswer: false });
623
+ const useMessage = await cli.prompt('Continue with this commit message?');
630
624
  return useMessage;
631
625
  }
632
626
 
package/lib/request.js CHANGED
@@ -158,7 +158,13 @@ export default class Request {
158
158
  Accept: 'application/json'
159
159
  }
160
160
  };
161
- return this.json(url, options);
161
+ const data = await this.json(url, options);
162
+ if (data?.errors) {
163
+ throw new Error(
164
+ `Request to fetch triaged reports failed with: ${JSON.stringify(data.errors)}`
165
+ );
166
+ }
167
+ return data;
162
168
  }
163
169
 
164
170
  async getPrograms() {
@@ -3,7 +3,7 @@ import {
3
3
  promises as fs
4
4
  } from 'node:fs';
5
5
 
6
- import inquirer from 'inquirer';
6
+ import { confirm } from '@inquirer/prompts';
7
7
  import { ListrEnquirerPromptAdapter } from '@listr2/prompt-adapter-enquirer';
8
8
 
9
9
  import { shortSha } from '../utils.js';
@@ -12,14 +12,12 @@ import { getCurrentV8Version } from './common.js';
12
12
 
13
13
  export async function checkOptions(options) {
14
14
  if (options.sha.length > 1 && options.squash) {
15
- const { wantSquash } = await inquirer.prompt([{
16
- type: 'confirm',
17
- name: 'wantSquash',
15
+ const wantSquash = await confirm({
18
16
  message: 'Squashing commits should be avoided if possible, because it ' +
19
17
  'can make git bisection difficult. Only squash commits if they would ' +
20
18
  'break the build when applied individually. Are you sure?',
21
19
  default: false
22
- }]);
20
+ });
23
21
 
24
22
  if (!wantSquash) {
25
23
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-core/utils",
3
- "version": "5.5.1",
3
+ "version": "5.6.0",
4
4
  "description": "Utilities for Node.js core collaborators",
5
5
  "type": "module",
6
6
  "engines": {
@@ -34,36 +34,36 @@
34
34
  ],
35
35
  "license": "MIT",
36
36
  "dependencies": {
37
- "@listr2/prompt-adapter-enquirer": "^2.0.10",
37
+ "@inquirer/prompts": "^6.0.1",
38
+ "@listr2/prompt-adapter-enquirer": "^2.0.11",
38
39
  "@node-core/caritat": "^1.6.0",
39
40
  "@pkgjs/nv": "^0.2.2",
40
- "branch-diff": "^3.0.4",
41
+ "branch-diff": "^3.1.1",
41
42
  "chalk": "^5.3.0",
42
43
  "changelog-maker": "^4.1.1",
43
- "cheerio": "^1.0.0-rc.12",
44
+ "cheerio": "^1.0.0",
44
45
  "clipboardy": "^4.0.0",
45
- "core-validate-commit": "^4.0.0",
46
+ "core-validate-commit": "^4.1.0",
46
47
  "figures": "^6.1.0",
47
- "ghauth": "^6.0.5",
48
- "inquirer": "^9.3.2",
48
+ "ghauth": "^6.0.7",
49
49
  "js-yaml": "^4.1.0",
50
- "listr2": "^8.2.3",
50
+ "listr2": "^8.2.4",
51
51
  "lodash": "^4.17.21",
52
- "log-symbols": "^6.0.0",
53
- "ora": "^8.0.1",
54
- "replace-in-file": "^8.0.2",
55
- "undici": "^6.19.2",
52
+ "log-symbols": "^7.0.0",
53
+ "ora": "^8.1.0",
54
+ "replace-in-file": "^8.2.0",
55
+ "undici": "^6.19.8",
56
56
  "which": "^4.0.0",
57
57
  "yargs": "^17.7.2"
58
58
  },
59
59
  "devDependencies": {
60
- "@reporters/github": "^1.7.0",
60
+ "@reporters/github": "^1.7.1",
61
61
  "c8": "^10.1.2",
62
- "eslint": "^8.57.0",
62
+ "eslint": "^8.57.1",
63
63
  "eslint-config-standard": "^17.1.0",
64
- "eslint-plugin-import": "^2.29.1",
64
+ "eslint-plugin-import": "^2.30.0",
65
65
  "eslint-plugin-n": "^16.6.2",
66
- "eslint-plugin-promise": "^6.4.0",
67
- "sinon": "^18.0.0"
66
+ "eslint-plugin-promise": "^6.6.0",
67
+ "sinon": "^19.0.2"
68
68
  }
69
69
  }