@node-core/utils 5.10.0 → 5.11.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/bin/git-node.js CHANGED
@@ -27,4 +27,6 @@ Promise.all(commandFiles.map(importCommand)).then((commands) => {
27
27
  .epilogue(epilogue)
28
28
  .help('help')
29
29
  .parse();
30
+ }).catch((err) => {
31
+ throw err;
30
32
  });
@@ -90,5 +90,6 @@ export function handler(argv) {
90
90
  if (status === false) {
91
91
  throw new Error(IGNORE);
92
92
  }
93
+ return undefined;
93
94
  }));
94
95
  }
@@ -20,10 +20,10 @@ class Health {
20
20
  formatAsMarkdown() {
21
21
  const { success, pending, aborted, failed, unstable, count } = this;
22
22
  const rate = `${(success / (count - pending - aborted) * 100).toFixed(2)}%`;
23
- // eslint-disable-next-line max-len
24
- let result = '| UTC Time | RUNNING | SUCCESS | UNSTABLE | ABORTED | FAILURE | Green Rate |\n';
25
- // eslint-disable-next-line max-len
26
- result += '| ---------------- | ------- | ------- | -------- | ------- | ------- | ---------- |\n';
23
+ let result =
24
+ '| UTC Time | RUNNING | SUCCESS | UNSTABLE | ABORTED | FAILURE | Green Rate |\n';
25
+ result +=
26
+ '| ---------------- | ------- | ------- | -------- | ------- | ------- | ---------- |\n';
27
27
  const time = new Date().toISOString().slice(0, 16).replace('T', ' ');
28
28
  result += `| ${time} | ${pad(pending, 7)} | ${pad(success, 8)}|`;
29
29
  result += ` ${pad(unstable, 8)} | ${pad(aborted, 7)} | ${pad(failed, 7)} |`;
@@ -76,6 +76,8 @@ export class TestBuild extends Job {
76
76
  return result;
77
77
  }
78
78
  }
79
+
80
+ return undefined;
79
81
  }
80
82
 
81
83
  get commit() {
@@ -204,7 +204,6 @@ const FAILURE_FILTERS = [{
204
204
  context: { index: 0, contextBefore: 0, contextAfter: 0 }
205
205
  }, {
206
206
  pattern:
207
- // eslint-disable-next-line max-len
208
207
  /error: Your local changes to the following files[\s\S]+Failed to merge in the changes./g,
209
208
  context: { index: 0, contextBefore: 0, contextAfter: 0 }
210
209
  }, {
package/lib/cli.js CHANGED
@@ -81,6 +81,7 @@ export default class CLI {
81
81
  return defaultAnswer;
82
82
  }
83
83
 
84
+ // eslint-disable-next-line import/namespace -- Plugin can't validate computed reference here
84
85
  const answer = await inquirer[questionType]({
85
86
  message: question,
86
87
  default: defaultAnswer
@@ -105,7 +105,6 @@ function parseCollaborators(readme, cli) {
105
105
 
106
106
  // We also assume that TSC & TSC Emeriti are also listed as collaborators
107
107
  CONTACT_RE.lastIndex = tscIndex;
108
- // eslint-disable-next-line no-cond-assign
109
108
  while ((m = CONTACT_RE.exec(readme)) && CONTACT_RE.lastIndex < tscrIndex) {
110
109
  const login = m[1].toLowerCase();
111
110
  const user = new Collaborator(m[1], m[2], m[3], TSC);
@@ -113,7 +112,6 @@ function parseCollaborators(readme, cli) {
113
112
  }
114
113
 
115
114
  CONTACT_RE.lastIndex = clIndex;
116
- // eslint-disable-next-line no-cond-assign
117
115
  while ((m = CONTACT_RE.exec(readme)) &&
118
116
  CONTACT_RE.lastIndex < cleIndex) {
119
117
  const login = m[1].toLowerCase();
@@ -40,7 +40,7 @@ export default class ReleasePreparation extends Session {
40
40
  const { cli } = this;
41
41
 
42
42
  cli.warn(`PR#${pr.number} - ${pr.title} is not 'MERGEABLE'.
43
- So, it will be skipped. Status: ${pr.mergeable}`);
43
+ Status: ${pr.mergeable}`);
44
44
  }
45
45
 
46
46
  async getOpenPRs(filterLabels) {
@@ -66,7 +66,6 @@ export default class ReleasePreparation extends Session {
66
66
  for (const pr of prs) {
67
67
  if (pr.mergeable !== 'MERGEABLE') {
68
68
  this.warnForNonMergeablePR(pr);
69
- continue;
70
69
  }
71
70
  const cp = new CherryPick(pr.number, this.dir, cli, {
72
71
  owner: this.owner,
@@ -486,7 +485,7 @@ export default class ReleasePreparation extends Session {
486
485
  let releaseHeader = `## ${date}, Version ${newVersion}` +
487
486
  ` ${releaseInfo}, @${username}\n`;
488
487
  if (isSecurityRelease) {
489
- releaseHeader += '\nThis is a security release.';
488
+ releaseHeader += '\nThis is a security release.\n';
490
489
  }
491
490
 
492
491
  const topHeader =
@@ -52,24 +52,27 @@ export default class PrepareSecurityRelease extends SecurityRelease {
52
52
  await this.closeAndRequestDisclosure(vulnerabilityJSON.reports);
53
53
 
54
54
  this.cli.info('Closing pull requests');
55
- // For now, close the ones with vN.x label
56
- await this.closePRWithLabel(this.getAffectedVersions(vulnerabilityJSON));
55
+ // For now, close the ones with Security Release label
56
+ await this.closePRWithLabel('Security Release');
57
57
 
58
- const updateFolder = this.cli.prompt(
59
- // eslint-disable-next-line max-len
60
- `Would you like to update the next-security-release folder to ${vulnerabilityJSON.releaseDate}?`,
58
+ const updateFolder = await this.cli.prompt(
59
+ `Would you like to update the next-security-release folder to ${
60
+ vulnerabilityJSON.releaseDate}?`,
61
61
  { defaultAnswer: true });
62
62
  if (updateFolder) {
63
- const newFolder = this.updateReleaseFolder(vulnerabilityJSON.releaseDate);
63
+ this.updateReleaseFolder(
64
+ vulnerabilityJSON.releaseDate.replaceAll('/', '-')
65
+ );
66
+ const securityReleaseFolder = path.join(process.cwd(), 'security-release');
64
67
  commitAndPushVulnerabilitiesJSON(
65
- newFolder,
68
+ securityReleaseFolder,
66
69
  'chore: change next-security-release folder',
67
70
  { cli: this.cli, repository: this.repository }
68
71
  );
69
72
  }
70
73
  this.cli.info(`Merge pull request with:
71
74
  - git checkout main
72
- - git merge --squash ${NEXT_SECURITY_RELEASE_BRANCH}
75
+ - git merge ${NEXT_SECURITY_RELEASE_BRANCH} --no-ff -m "chore: add latest security release"
73
76
  - git push origin main`);
74
77
  this.cli.ok('Done!');
75
78
  }
@@ -306,16 +309,17 @@ export default class PrepareSecurityRelease extends SecurityRelease {
306
309
  labels = [labels];
307
310
  }
308
311
 
309
- const url = 'https://github.com/nodejs-private/node-private/pulls';
312
+ const url = 'https://github.com/nodejs-private/node-private/pull';
310
313
  this.cli.startSpinner('Closing GitHub Pull Requests...');
311
314
  // At this point, GitHub does not provide filters through their REST API
312
- const prs = this.req.getPullRequest(url);
315
+ const prs = await this.req.getPullRequest(url);
313
316
  for (const pr of prs) {
314
- if (pr.labels.some((l) => labels.includes(l))) {
315
- this.cli.updateSpinner(`Closing Pull Request: ${pr.id}`);
316
- await this.req.closePullRequest(pr.id);
317
+ if (pr.labels.some((l) => labels.includes(l.name))) {
318
+ this.cli.updateSpinner(`Closing Pull Request: ${pr.number}`);
319
+ await this.req.closePullRequest(pr.number,
320
+ { owner: 'nodejs-private', repo: 'node-private' });
317
321
  }
318
322
  }
319
- this.cli.startSpinner('Closed GitHub Pull Requests.');
323
+ this.cli.stopSpinner('Closed GitHub Pull Requests.');
320
324
  }
321
325
  }
@@ -21,12 +21,10 @@ export function getStartLTSBlurb({ date, ltsCodename, versionComponents }) {
21
21
  const eol = eolDate.toLocaleString('en-US', dateFormat);
22
22
  const { major } = versionComponents;
23
23
  return [
24
- /* eslint-disable max-len */
25
24
  `This release marks the transition of Node.js ${major}.x into Long Term Support (LTS)`,
26
25
  `with the codename '${ltsCodename}'. The ${major}.x release line now moves into "Active LTS"`,
27
26
  `and will remain so until ${mainStart}. After that time, it will move into`,
28
27
  `"Maintenance" until end of life in ${eol}.`
29
- /* eslint-enable */
30
28
  ].join('\n');
31
29
  }
32
30
 
package/lib/request.js CHANGED
@@ -109,14 +109,15 @@ export default class Request {
109
109
  return this.json(url, options);
110
110
  }
111
111
 
112
- async closePullRequest({ owner, repo }) {
113
- const url = `https://api.github.com/repos/${owner}/${repo}/pulls`;
112
+ async closePullRequest(id, { owner, repo }) {
113
+ const url = `https://api.github.com/repos/${owner}/${repo}/pulls/${id}`;
114
114
  const options = {
115
115
  method: 'POST',
116
116
  headers: {
117
117
  Authorization: `Basic ${this.credentials.github}`,
118
118
  'User-Agent': 'node-core-utils',
119
- Accept: 'application/vnd.github+json'
119
+ Accept: 'application/vnd.github+json',
120
+ 'Content-Type': 'application/json'
120
121
  },
121
122
  body: JSON.stringify({
122
123
  state: 'closed'
@@ -230,7 +231,8 @@ export default class Request {
230
231
  headers: {
231
232
  Authorization: `Basic ${this.credentials.h1}`,
232
233
  'User-Agent': 'node-core-utils',
233
- Accept: 'application/json'
234
+ Accept: 'application/json',
235
+ 'Content-Type': 'application/json'
234
236
  },
235
237
  body: JSON.stringify({
236
238
  data: {
@@ -252,11 +254,13 @@ export default class Request {
252
254
  headers: {
253
255
  Authorization: `Basic ${this.credentials.h1}`,
254
256
  'User-Agent': 'node-core-utils',
255
- Accept: 'application/json'
257
+ Accept: 'application/json',
258
+ 'Content-Type': 'application/json'
256
259
  },
257
260
  body: JSON.stringify({
258
261
  data: {
259
262
  attributes: {
263
+ message: 'Requesting disclosure',
260
264
  // default to limited version
261
265
  substate: 'no-content'
262
266
  }
@@ -236,7 +236,7 @@ export class SecurityRelease {
236
236
  updateReleaseFolder(releaseDate) {
237
237
  const folder = path.join(process.cwd(),
238
238
  NEXT_SECURITY_RELEASE_FOLDER);
239
- const newFolder = path.join(process.cwd(), releaseDate);
239
+ const newFolder = path.join(process.cwd(), 'security-release', releaseDate);
240
240
  fs.renameSync(folder, newFolder);
241
241
  return newFolder;
242
242
  }
package/lib/team_info.js CHANGED
@@ -67,7 +67,6 @@ TeamInfo.update = async function(cli, request, content) {
67
67
 
68
68
  const blocks = new Map();
69
69
  let m;
70
- // eslint-disable-next-line no-cond-assign
71
70
  while ((m = RE.exec(content))) {
72
71
  const [, org, team] = m;
73
72
  const mapKey = key(org, team);
@@ -127,5 +127,11 @@ export const v8Deps = [
127
127
  replace: highwayIgnore
128
128
  },
129
129
  since: 134
130
+ },
131
+ {
132
+ name: 'simdutf',
133
+ repo: 'third_party/simdutf',
134
+ gitignore: '!/third_party/simdutf',
135
+ since: 134
130
136
  }
131
137
  ];
@@ -119,7 +119,6 @@ function updateV8Deps() {
119
119
  path: v8Dep.repo
120
120
  })), newV8Version);
121
121
  if (deps.length === 0) return;
122
- /* eslint-disable no-await-in-loop */
123
122
  for (const dep of deps) {
124
123
  if (dep.gitignore) {
125
124
  if (typeof dep.gitignore === 'string') {
@@ -132,7 +131,6 @@ function updateV8Deps() {
132
131
  const thePath = path.join(ctx.nodeDir, 'deps/v8', dep.path);
133
132
  await fetchFromGit(thePath, repo, commit);
134
133
  }
135
- /* eslint-enable */
136
134
  }
137
135
  };
138
136
  }
@@ -10,6 +10,7 @@ import {
10
10
  getEditor, isGhAvailable
11
11
  } from './utils.js';
12
12
 
13
+ // eslint-disable-next-line import/no-unresolved
13
14
  import voteUsingGit from '@node-core/caritat/voteUsingGit';
14
15
  import * as yaml from 'js-yaml';
15
16
 
@@ -97,7 +98,7 @@ export default class VotingSession extends Session {
97
98
  cp.stdin.end(share);
98
99
  const [code] = await Promise.race([
99
100
  once(cp, 'exit'),
100
- once(cp, 'error').then((er) => Promise.reject(er))
101
+ once(cp, 'error').then((er) => { throw er; })
101
102
  ]);
102
103
  if (code !== 0) throw new Error('failed', { cause: code });
103
104
  return Buffer.concat(await stdout);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-core/utils",
3
- "version": "5.10.0",
3
+ "version": "5.11.0",
4
4
  "description": "Utilities for Node.js core collaborators",
5
5
  "type": "module",
6
6
  "engines": {
@@ -40,7 +40,7 @@
40
40
  "@pkgjs/nv": "^0.2.2",
41
41
  "branch-diff": "^3.1.1",
42
42
  "chalk": "^5.4.1",
43
- "changelog-maker": "^4.3.1",
43
+ "changelog-maker": "^4.3.2",
44
44
  "cheerio": "^1.0.0",
45
45
  "clipboardy": "^4.0.0",
46
46
  "core-validate-commit": "^4.1.0",
@@ -53,18 +53,21 @@
53
53
  "log-symbols": "^7.0.0",
54
54
  "ora": "^8.1.1",
55
55
  "replace-in-file": "^8.3.0",
56
- "undici": "^7.2.2",
56
+ "semver": "^7.6.3",
57
+ "undici": "^7.3.0",
57
58
  "which": "^5.0.0",
58
59
  "yargs": "^17.7.2"
59
60
  },
60
61
  "devDependencies": {
62
+ "@eslint/js": "^9.19.0",
61
63
  "@reporters/github": "^1.7.2",
62
64
  "c8": "^10.1.3",
63
- "eslint": "^8.57.1",
64
- "eslint-config-standard": "^17.1.0",
65
+ "eslint": "^9.19.0",
65
66
  "eslint-plugin-import": "^2.31.0",
66
- "eslint-plugin-n": "^16.6.2",
67
- "eslint-plugin-promise": "^6.6.0",
67
+ "eslint-plugin-n": "^17.15.1",
68
+ "eslint-plugin-promise": "^7.2.1",
69
+ "globals": "^15.14.0",
70
+ "neostandard": "^0.12.0",
68
71
  "sinon": "^19.0.2"
69
72
  }
70
73
  }