@node-core/utils 5.14.0 → 5.14.1

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.
@@ -11,12 +11,16 @@ export default class CherryPick {
11
11
  constructor(prid, dir, cli, {
12
12
  owner,
13
13
  repo,
14
+ upstream,
15
+ gpgSign,
14
16
  lint,
15
17
  includeCVE
16
18
  } = {}) {
17
19
  this.prid = prid;
18
20
  this.cli = cli;
19
21
  this.dir = dir;
22
+ this.upstream = upstream;
23
+ this.gpgSign = gpgSign;
20
24
  this.options = { owner, repo, lint, includeCVE };
21
25
  }
22
26
 
@@ -88,14 +92,15 @@ export default class CherryPick {
88
92
  } else if (cleanLint === LINT_RESULTS.SUCCESS) {
89
93
  cli.ok('Lint passed cleanly');
90
94
  }
91
- return this.amend(metadata.metadata, commitInfo);
95
+ this.metadata = metadata.metadata;
96
+ return this.amend(commitInfo);
92
97
  } catch (e) {
93
98
  cli.error(e.message);
94
99
  return false;
95
100
  }
96
101
  }
97
102
 
98
- async amend(metadata, commitInfo) {
103
+ async amend(commitInfo) {
99
104
  const { cli } = this;
100
105
  const subjects = await runAsync('git',
101
106
  ['log', '--pretty=format:%s', `${commitInfo.base}..${commitInfo.head}`],
@@ -116,7 +121,7 @@ export default class CherryPick {
116
121
  await runAsync('git', ['commit', '--amend', '--no-edit']);
117
122
  }
118
123
 
119
- return LandingSession.prototype.amend.call(this, metadata);
124
+ return LandingSession.prototype.amend.call(this);
120
125
  }
121
126
 
122
127
  readyToAmend() {
@@ -7,6 +7,7 @@ import Session from './session.js';
7
7
  import {
8
8
  shortSha, isGhAvailable, getEditor
9
9
  } from './utils.js';
10
+ import { debuglog, isDebugVerbosity } from './verbosity.js';
10
11
 
11
12
  const isWindows = process.platform === 'win32';
12
13
 
@@ -27,9 +28,6 @@ export default class LandingSession extends Session {
27
28
  this.lint = lint;
28
29
  this.autorebase = autorebase;
29
30
  this.fixupAll = fixupAll;
30
- this.gpgSign = argv?.['gpg-sign']
31
- ? (argv['gpg-sign'] === true ? ['-S'] : ['-S', argv['gpg-sign']])
32
- : [];
33
31
  this.oneCommitMax = oneCommitMax;
34
32
  this.expectedCommitShas = [];
35
33
  this.checkCI = !!checkCI;
@@ -120,6 +118,9 @@ export default class LandingSession extends Session {
120
118
  ['cherry-pick', '--allow-empty', ...this.gpgSign, `${base}..${head}`],
121
119
  { ignoreFailure: false });
122
120
  } catch (ex) {
121
+ if (isDebugVerbosity()) {
122
+ debuglog('[LandingSession] Got error', ex);
123
+ }
123
124
  cli.error('Failed to apply patches');
124
125
  process.exit(1);
125
126
  }
@@ -70,6 +70,8 @@ export default class ReleasePreparation extends Session {
70
70
  const cp = new CherryPick(pr.number, this.dir, cli, {
71
71
  owner: this.owner,
72
72
  repo: this.repo,
73
+ gpgSign: this.gpgSign,
74
+ upstream: this.isSecurityRelease ? `https://${this.username}:${this.config.token}@github.com/${this.owner}/${this.repo}.git` : this.upstream,
73
75
  lint: false,
74
76
  includeCVE: true
75
77
  });
@@ -17,13 +17,10 @@ const dryRunMessage = 'You are running in dry-run mode, meaning NCU will not run
17
17
 
18
18
  export default class ReleasePromotion extends Session {
19
19
  constructor(argv, req, cli, dir) {
20
- super(cli, dir);
20
+ super(cli, dir, null, argv);
21
21
  this.req = req;
22
22
  this.dryRun = !argv.run;
23
23
  this.proposalUpstreamRemote = argv.fetchFrom ?? this.upstream;
24
- this.gpgSign = argv?.['gpg-sign']
25
- ? (argv['gpg-sign'] === true ? ['-S'] : ['-S', argv['gpg-sign']])
26
- : [];
27
24
  }
28
25
 
29
26
  get branch() {
package/lib/request.js CHANGED
@@ -43,7 +43,11 @@ export default class Request {
43
43
  }
44
44
 
45
45
  async text(url, options = {}) {
46
- return this.fetch(url, options).then(res => res.text());
46
+ const res = await this.fetch(url, options);
47
+ if (isDebugVerbosity()) {
48
+ debuglog('[Request] Got response from', url, ':\n', res.status, ' ', res.statusText);
49
+ }
50
+ return res.text();
47
51
  }
48
52
 
49
53
  async json(url, options = {}) {
package/lib/session.js CHANGED
@@ -20,6 +20,9 @@ export default class Session {
20
20
  this.dir = dir;
21
21
  this.prid = prid;
22
22
  this.config = { ...getMergedConfig(this.dir), ...argv };
23
+ this.gpgSign = argv?.['gpg-sign']
24
+ ? (argv['gpg-sign'] === true ? ['-S'] : ['-S', argv['gpg-sign']])
25
+ : [];
23
26
 
24
27
  if (warnForMissing) {
25
28
  const { upstream, owner, repo } = this;
@@ -29,7 +29,6 @@ export default class VotingSession extends Session {
29
29
  this.abstain = abstain;
30
30
  this.closeVote = argv['decrypt-key-part'];
31
31
  this.postComment = argv['post-comment'];
32
- this.gpgSign = argv['gpg-sign'];
33
32
  }
34
33
 
35
34
  get argv() {
@@ -111,7 +110,7 @@ export default class VotingSession extends Session {
111
110
  out.toString('base64') +
112
111
  '\n-----END SHAMIR KEY PART-----';
113
112
  this.cli.log('Your key part is:');
114
- this.cli.log(keyPart);
113
+ console.log(keyPart); // Using `console.log` so this gets output to stdout, not stderr.
115
114
  const body = 'I would like to close this vote, and for this effect, I\'m revealing my ' +
116
115
  `key part:\n\n${'```'}\n${keyPart}\n${'```'}\n`;
117
116
  if (this.postComment) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-core/utils",
3
- "version": "5.14.0",
3
+ "version": "5.14.1",
4
4
  "description": "Utilities for Node.js core collaborators",
5
5
  "type": "module",
6
6
  "engines": {