@node-core/utils 4.0.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.
Files changed (98) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +158 -0
  3. package/bin/get-metadata.js +11 -0
  4. package/bin/git-node.js +30 -0
  5. package/bin/ncu-ci.js +600 -0
  6. package/bin/ncu-config.js +101 -0
  7. package/bin/ncu-team.js +76 -0
  8. package/components/git/backport.js +70 -0
  9. package/components/git/epilogue.js +18 -0
  10. package/components/git/land.js +223 -0
  11. package/components/git/metadata.js +94 -0
  12. package/components/git/release.js +99 -0
  13. package/components/git/security.js +35 -0
  14. package/components/git/status.js +32 -0
  15. package/components/git/sync.js +24 -0
  16. package/components/git/v8.js +121 -0
  17. package/components/git/vote.js +84 -0
  18. package/components/git/wpt.js +87 -0
  19. package/components/metadata.js +49 -0
  20. package/lib/auth.js +133 -0
  21. package/lib/backport_session.js +302 -0
  22. package/lib/cache.js +107 -0
  23. package/lib/cherry_pick.js +304 -0
  24. package/lib/ci/build-types/benchmark_run.js +72 -0
  25. package/lib/ci/build-types/citgm_build.js +194 -0
  26. package/lib/ci/build-types/citgm_comparison_build.js +174 -0
  27. package/lib/ci/build-types/commit_build.js +112 -0
  28. package/lib/ci/build-types/daily_build.js +24 -0
  29. package/lib/ci/build-types/fanned_build.js +87 -0
  30. package/lib/ci/build-types/health_build.js +63 -0
  31. package/lib/ci/build-types/job.js +114 -0
  32. package/lib/ci/build-types/linter_build.js +35 -0
  33. package/lib/ci/build-types/normal_build.js +89 -0
  34. package/lib/ci/build-types/pr_build.js +101 -0
  35. package/lib/ci/build-types/test_build.js +186 -0
  36. package/lib/ci/build-types/test_run.js +41 -0
  37. package/lib/ci/ci_failure_parser.js +325 -0
  38. package/lib/ci/ci_type_parser.js +203 -0
  39. package/lib/ci/ci_utils.js +106 -0
  40. package/lib/ci/failure_aggregator.js +152 -0
  41. package/lib/ci/jenkins_constants.js +28 -0
  42. package/lib/ci/run_ci.js +120 -0
  43. package/lib/cli.js +192 -0
  44. package/lib/collaborators.js +140 -0
  45. package/lib/config.js +72 -0
  46. package/lib/figures.js +7 -0
  47. package/lib/file.js +43 -0
  48. package/lib/github/templates/next-security-release.md +97 -0
  49. package/lib/github/tree.js +162 -0
  50. package/lib/landing_session.js +506 -0
  51. package/lib/links.js +123 -0
  52. package/lib/mergeable_state.js +3 -0
  53. package/lib/metadata_gen.js +61 -0
  54. package/lib/pr_checker.js +605 -0
  55. package/lib/pr_data.js +115 -0
  56. package/lib/pr_summary.js +62 -0
  57. package/lib/prepare_release.js +772 -0
  58. package/lib/prepare_security.js +117 -0
  59. package/lib/proxy.js +21 -0
  60. package/lib/queries/DefaultBranchRef.gql +8 -0
  61. package/lib/queries/LastCommit.gql +16 -0
  62. package/lib/queries/PR.gql +37 -0
  63. package/lib/queries/PRComments.gql +27 -0
  64. package/lib/queries/PRCommits.gql +45 -0
  65. package/lib/queries/PRs.gql +25 -0
  66. package/lib/queries/Reviews.gql +23 -0
  67. package/lib/queries/SearchIssue.gql +51 -0
  68. package/lib/queries/Team.gql +22 -0
  69. package/lib/queries/TreeEntries.gql +12 -0
  70. package/lib/queries/VotePRInfo.gql +28 -0
  71. package/lib/release/utils.js +53 -0
  72. package/lib/request.js +185 -0
  73. package/lib/review_state.js +5 -0
  74. package/lib/reviews.js +178 -0
  75. package/lib/run.js +106 -0
  76. package/lib/session.js +415 -0
  77. package/lib/sync_session.js +15 -0
  78. package/lib/team_info.js +95 -0
  79. package/lib/update-v8/applyNodeChanges.js +49 -0
  80. package/lib/update-v8/backport.js +258 -0
  81. package/lib/update-v8/commitUpdate.js +26 -0
  82. package/lib/update-v8/common.js +35 -0
  83. package/lib/update-v8/constants.js +86 -0
  84. package/lib/update-v8/index.js +56 -0
  85. package/lib/update-v8/majorUpdate.js +171 -0
  86. package/lib/update-v8/minorUpdate.js +105 -0
  87. package/lib/update-v8/updateMaintainingDependencies.js +34 -0
  88. package/lib/update-v8/updateV8Clone.js +53 -0
  89. package/lib/update-v8/updateVersionNumbers.js +122 -0
  90. package/lib/update-v8/util.js +62 -0
  91. package/lib/user.js +4 -0
  92. package/lib/user_status.js +5 -0
  93. package/lib/utils.js +66 -0
  94. package/lib/verbosity.js +26 -0
  95. package/lib/voting_session.js +136 -0
  96. package/lib/wpt/index.js +243 -0
  97. package/lib/wpt/templates/README.md +16 -0
  98. package/package.json +69 -0
@@ -0,0 +1,95 @@
1
+ import { readFile, writeFile } from './file.js';
2
+ import { ascending } from './utils.js';
3
+
4
+ const TEAM_QUERY = 'Team';
5
+
6
+ function byLogin(a, b) {
7
+ return ascending(a.login.toLowerCase(), b.login.toLowerCase());
8
+ }
9
+
10
+ function getContact({ login, url, name, email }) {
11
+ if (!name) return `* [@${login}](${url})`;
12
+ return `* [@${login}](${url}) - ${name}`;
13
+ }
14
+
15
+ function key(org, team) {
16
+ return `${org}/${team}`;
17
+ }
18
+
19
+ export default class TeamInfo {
20
+ constructor(cli, request, org, team) {
21
+ this.cli = cli;
22
+ this.request = request;
23
+ this.org = org;
24
+ this.team = team;
25
+ this.members = [];
26
+ }
27
+
28
+ async getMembers() {
29
+ const { cli, request, org, team } = this;
30
+ cli.startSpinner(`Getting member information of ${org}/${team}`);
31
+ const members = await request.gql(TEAM_QUERY, { org, team }, [
32
+ 'organization', 'team', 'members'
33
+ ]);
34
+ cli.stopSpinner(`Received member information of ${org}/${team}`);
35
+ const sorted = members.sort(byLogin);
36
+ this.members = sorted;
37
+ return sorted;
38
+ }
39
+
40
+ async getMemberContacts() {
41
+ const members = await this.getMembers();
42
+ return members.map(getContact).join('\n');
43
+ }
44
+
45
+ async listMembers() {
46
+ const contacts = await this.getMemberContacts();
47
+ this.cli.log(contacts);
48
+ }
49
+ }
50
+
51
+ TeamInfo.syncFile = async function(cli, request, input, output) {
52
+ output = output || input;
53
+ const content = readFile(input);
54
+ if (content === '') {
55
+ cli.error('input file `' + input + '` is empty or missing');
56
+ process.exit(1);
57
+ }
58
+ const newContent = await TeamInfo.update(cli, request, content);
59
+ writeFile(output, newContent);
60
+ cli.log(`Updated ${output}`);
61
+ };
62
+
63
+ TeamInfo.update = async function(cli, request, content) {
64
+ const RE = new RegExp('<!-- ncu-team-sync\\.team\\((.+)\\/(.+)\\) -->' +
65
+ '[\\s\\S]+?' +
66
+ '<!-- ncu-team-sync end -->', 'mg');
67
+
68
+ const blocks = new Map();
69
+ let m;
70
+ // eslint-disable-next-line no-cond-assign
71
+ while ((m = RE.exec(content))) {
72
+ const [, org, team] = m;
73
+ const mapKey = key(org, team);
74
+ if (!blocks.get(mapKey)) {
75
+ const info = new TeamInfo(cli, request, org, team);
76
+ const teamData = await info.getMemberContacts();
77
+ const opening = `<!-- ncu-team-sync.team(${org}/${team}) -->`;
78
+ const ending = '<!-- ncu-team-sync end -->';
79
+ blocks.set(mapKey, `${opening}\n\n${teamData}\n\n${ending}`);
80
+ };
81
+ }
82
+
83
+ if (blocks.size === 0) {
84
+ throw new Error(
85
+ 'Could not find blocks matching <!-- ncu-team-sync.team($org/$team)>'
86
+ );
87
+ }
88
+
89
+ const RE_CLONE = new RegExp(RE.source, 'mg');
90
+ const newContent = content.replace(RE_CLONE,
91
+ (match, org, team, offset, string) => blocks.get(key(org, team))
92
+ );
93
+
94
+ return newContent;
95
+ };
@@ -0,0 +1,49 @@
1
+ import path from 'node:path';
2
+
3
+ import Enquirer from 'enquirer';
4
+ import { Listr } from 'listr2';
5
+
6
+ import {
7
+ getNodeV8Version,
8
+ filterForVersion,
9
+ replaceGitignore,
10
+ removeDirectory
11
+ } from './util.js';
12
+
13
+ const nodeChanges = [
14
+ {
15
+ since: 66,
16
+ task: removeEuStrip
17
+ }
18
+ ];
19
+
20
+ export default function applyNodeChanges() {
21
+ return {
22
+ title: 'Apply Node-specific changes',
23
+ task: async(ctx) => {
24
+ const v8Version = await getNodeV8Version(ctx.nodeDir);
25
+ const list = filterForVersion(nodeChanges, v8Version);
26
+ return new Listr(list.map((change) => change.task()), {
27
+ injectWrapper: {
28
+ enquirer: new Enquirer()
29
+ }
30
+ });
31
+ }
32
+ };
33
+ }
34
+
35
+ // Ref: https://github.com/nodejs/node/pull/20304
36
+ function removeEuStrip() {
37
+ return {
38
+ title: 'Remove eu-strip binary',
39
+ task: async(ctx) => {
40
+ await replaceGitignore(ctx.nodeDir, {
41
+ match: '!/third_party/eu-strip\n',
42
+ replace: ''
43
+ });
44
+ await removeDirectory(
45
+ path.join(ctx.nodeDir, 'deps/v8/third_party/eu-strip')
46
+ );
47
+ }
48
+ };
49
+ }
@@ -0,0 +1,258 @@
1
+ import path from 'node:path';
2
+ import {
3
+ promises as fs
4
+ } from 'node:fs';
5
+
6
+ import Enquirer from 'enquirer';
7
+ import inquirer from 'inquirer';
8
+ import { Listr } from 'listr2';
9
+
10
+ import { shortSha } from '../utils.js';
11
+
12
+ import { getCurrentV8Version } from './common.js';
13
+
14
+ export async function checkOptions(options) {
15
+ if (options.sha.length > 1 && options.squash) {
16
+ const { wantSquash } = await inquirer.prompt([{
17
+ type: 'confirm',
18
+ name: 'wantSquash',
19
+ message: 'Squashing commits should be avoided if possible, because it ' +
20
+ 'can make git bisection difficult. Only squash commits if they would ' +
21
+ 'break the build when applied individually. Are you sure?',
22
+ default: false
23
+ }]);
24
+
25
+ if (!wantSquash) {
26
+ return true;
27
+ }
28
+ }
29
+ };
30
+
31
+ export function doBackport(options) {
32
+ const todo = [
33
+ getCurrentV8Version(),
34
+ generatePatches()
35
+ ];
36
+
37
+ if (options.squash) {
38
+ todo.push(applyPatches());
39
+ if (options.bump !== false) {
40
+ if (options.nodeMajorVersion < 9) {
41
+ todo.push(incrementV8Version());
42
+ } else {
43
+ todo.push(incrementEmbedderVersion());
44
+ }
45
+ }
46
+ todo.push(commitSquashedBackport());
47
+ } else {
48
+ todo.push(applyAndCommitPatches());
49
+ }
50
+
51
+ return {
52
+ title: 'V8 commit backport',
53
+ task: () => {
54
+ return new Listr(todo, {
55
+ injectWrapper: {
56
+ enquirer: new Enquirer()
57
+ }
58
+ });
59
+ }
60
+ };
61
+ };
62
+
63
+ function commitSquashedBackport() {
64
+ return {
65
+ title: 'Commit backport',
66
+ task: async(ctx) => {
67
+ const { patches } = ctx;
68
+ const messageTitle = formatMessageTitle(patches);
69
+ let messageBody;
70
+ if (patches.length === 1) {
71
+ const [patch] = patches;
72
+ messageBody = formatMessageBody(patch, false);
73
+ } else {
74
+ messageBody = '';
75
+ for (const patch of patches) {
76
+ const formatted = formatMessageBody(patch, true);
77
+ messageBody += formatted + '\n\n';
78
+ }
79
+ }
80
+ await ctx.execGitNode('add', ['deps/v8']);
81
+ await ctx.execGitNode('commit', ['-m', messageTitle, '-m', messageBody]);
82
+ }
83
+ };
84
+ };
85
+
86
+ function commitPatch(patch) {
87
+ return {
88
+ title: 'Commit patch',
89
+ task: async(ctx) => {
90
+ const messageTitle = formatMessageTitle([patch]);
91
+ const messageBody = formatMessageBody(patch, false);
92
+ await ctx.execGitNode('add', ['deps/v8']);
93
+ await ctx.execGitNode('commit', ['-m', messageTitle, '-m', messageBody]);
94
+ }
95
+ };
96
+ }
97
+
98
+ function formatMessageTitle(patches) {
99
+ const action =
100
+ patches.some(patch => patch.hadConflicts) ? 'backport' : 'cherry-pick';
101
+ if (patches.length === 1) {
102
+ return `deps: V8: ${action} ${shortSha(patches[0].sha)}`;
103
+ } else if (patches.length === 2) {
104
+ return `deps: V8: ${action} ${shortSha(patches[0].sha)} and ${
105
+ shortSha(patches[1].sha)
106
+ }`;
107
+ } else if (patches.length === 3) {
108
+ return `deps: V8: ${action} ${shortSha(patches[0].sha)}, ${
109
+ shortSha(patches[1].sha)
110
+ } and ${shortSha(patches[2].sha)}`;
111
+ } else {
112
+ return `deps: V8: ${action} ${patches.length} commits`;
113
+ }
114
+ }
115
+
116
+ function formatMessageBody(patch, prefixTitle) {
117
+ const indentedMessage = patch.message.replace(/\n/g, '\n ');
118
+ const body =
119
+ 'Original commit message:\n\n' +
120
+ ` ${indentedMessage}\n\n` +
121
+ `Refs: https://github.com/v8/v8/commit/${patch.sha}`;
122
+
123
+ if (prefixTitle) {
124
+ const action = patch.hadConflicts ? 'Backport' : 'Cherry-pick';
125
+ return `${action} ${shortSha(patch.sha)}.\n` + body;
126
+ }
127
+ return body;
128
+ }
129
+
130
+ function generatePatches() {
131
+ return {
132
+ title: 'Generate patches',
133
+ task: async(ctx) => {
134
+ const shas = ctx.sha;
135
+ const fullShas = await Promise.all(
136
+ shas.map(async(sha) => {
137
+ const stdout = await ctx.execGitV8('rev-parse', sha);
138
+ return stdout.trim();
139
+ })
140
+ );
141
+ ctx.patches = await Promise.all(fullShas.map(async(sha) => {
142
+ const [patch, message] = await Promise.all([
143
+ ctx.execGitV8('format-patch', '--stdout', `${sha}^..${sha}`),
144
+ ctx.execGitV8('log', '--format=%B', '-n', '1', sha)
145
+ ]);
146
+ return {
147
+ sha,
148
+ data: patch,
149
+ message
150
+ };
151
+ }));
152
+ }
153
+ };
154
+ }
155
+
156
+ function applyPatches() {
157
+ return {
158
+ title: 'Apply patches to deps/v8',
159
+ task: async(ctx, task) => {
160
+ const { patches } = ctx;
161
+ for (const patch of patches) {
162
+ await applyPatch(ctx, task, patch);
163
+ }
164
+ }
165
+ };
166
+ }
167
+
168
+ function applyAndCommitPatches() {
169
+ return {
170
+ title: 'Apply and commit patches to deps/v8',
171
+ task: (ctx) => {
172
+ return new Listr(ctx.patches.map(applyPatchTask), {
173
+ injectWrapper: {
174
+ enquirer: new Enquirer()
175
+ }
176
+ });
177
+ }
178
+ };
179
+ }
180
+
181
+ function applyPatchTask(patch) {
182
+ return {
183
+ title: `Commit ${shortSha(patch.sha)}`,
184
+ task: (ctx) => {
185
+ const todo = [
186
+ {
187
+ title: 'Apply patch',
188
+ task: (ctx, task) => applyPatch(ctx, task, patch)
189
+ }
190
+ ];
191
+ if (ctx.bump !== false) {
192
+ if (ctx.nodeMajorVersion < 9) {
193
+ todo.push(incrementV8Version());
194
+ } else {
195
+ todo.push(incrementEmbedderVersion());
196
+ }
197
+ }
198
+ todo.push(commitPatch(patch));
199
+ return new Listr(todo, {
200
+ injectWrapper: {
201
+ enquirer: new Enquirer()
202
+ }
203
+ });
204
+ }
205
+ };
206
+ }
207
+
208
+ async function applyPatch(ctx, task, patch) {
209
+ try {
210
+ await ctx.execGitNode(
211
+ 'apply',
212
+ ['-p1', '--3way', '--directory=deps/v8'],
213
+ patch.data /* input */
214
+ );
215
+ } catch (e) {
216
+ patch.hadConflicts = true;
217
+ return task.prompt({
218
+ type: 'input',
219
+ message: "Resolve merge conflicts and enter 'RESOLVED'",
220
+ validate: value => value.toUpperCase() === 'RESOLVED'
221
+ });
222
+ }
223
+ }
224
+
225
+ function incrementV8Version() {
226
+ return {
227
+ title: 'Increment V8 version',
228
+ task: async(ctx) => {
229
+ const incremented = ++ctx.currentVersion.patch;
230
+ const versionHPath = `${ctx.nodeDir}/deps/v8/include/v8-version.h`;
231
+ let versionH = await fs.readFile(versionHPath, 'utf8');
232
+ versionH = versionH.replace(
233
+ /V8_PATCH_LEVEL (\d+)/,
234
+ `V8_PATCH_LEVEL ${incremented}`
235
+ );
236
+ await fs.writeFile(versionHPath, versionH);
237
+ }
238
+ };
239
+ }
240
+
241
+ const embedderRegex = /'v8_embedder_string': '-node\.(\d+)'/;
242
+ function incrementEmbedderVersion() {
243
+ return {
244
+ title: 'Increment embedder version number',
245
+ task: async(ctx) => {
246
+ const commonGypiPath = path.join(ctx.nodeDir, 'common.gypi');
247
+ const commonGypi = await fs.readFile(commonGypiPath, 'utf8');
248
+ const embedderValue = parseInt(embedderRegex.exec(commonGypi)[1], 10);
249
+ const embedderString = `'v8_embedder_string': '-node.${embedderValue +
250
+ 1}'`;
251
+ await fs.writeFile(
252
+ commonGypiPath,
253
+ commonGypi.replace(embedderRegex, embedderString)
254
+ );
255
+ await ctx.execGitNode('add', ['common.gypi']);
256
+ }
257
+ };
258
+ }
@@ -0,0 +1,26 @@
1
+ import { getNodeV8Version } from './util.js';
2
+
3
+ export default function commitUpdate() {
4
+ return {
5
+ title: 'Commit V8 update',
6
+ task: async(ctx) => {
7
+ const newV8Version = await getNodeV8Version(ctx.nodeDir);
8
+ await ctx.execGitNode('add', ['deps/v8']);
9
+ const moreArgs = [];
10
+ let message;
11
+ if (ctx.minor) {
12
+ const prev = ctx.currentVersion.toString();
13
+ const next = ctx.latestVersion.join('.');
14
+ moreArgs.push(
15
+ '-m',
16
+ `Refs: https://github.com/v8/v8/compare/${prev}...${next}`
17
+ );
18
+ message = `deps: patch V8 to ${newV8Version}`;
19
+ } else {
20
+ message = `deps: update V8 to ${newV8Version}`;
21
+ }
22
+ await ctx.execGitNode('commit', ['-m', message, ...moreArgs]);
23
+ },
24
+ skip: (ctx) => ctx.skipped
25
+ };
26
+ };
@@ -0,0 +1,35 @@
1
+ import path from 'node:path';
2
+ import { promises as fs } from 'node:fs';
3
+
4
+ import { getNodeV8Version } from './util.js';
5
+
6
+ export function getCurrentV8Version() {
7
+ return {
8
+ title: 'Get current V8 version',
9
+ task: async(ctx) => {
10
+ ctx.currentVersion = await getNodeV8Version(ctx.nodeDir);
11
+ }
12
+ };
13
+ };
14
+
15
+ export async function checkCwd(ctx) {
16
+ let isNode = false;
17
+ try {
18
+ const nodeVersion = await fs.readFile(
19
+ path.join(ctx.nodeDir, 'src/node_version.h')
20
+ );
21
+ const match = /#define NODE_MAJOR_VERSION (\d+)/.exec(nodeVersion);
22
+ if (match) {
23
+ isNode = true;
24
+ ctx.nodeMajorVersion = parseInt(match[1], 10);
25
+ }
26
+ } catch (e) {
27
+ // ignore
28
+ }
29
+ if (!isNode) {
30
+ throw new Error(
31
+ 'This does not seem to be the Node.js repository.\n' +
32
+ `node-dir: ${ctx.nodeDir}`
33
+ );
34
+ }
35
+ };
@@ -0,0 +1,86 @@
1
+ import os from 'node:os';
2
+ import path from 'node:path';
3
+
4
+ const homedir = os.homedir();
5
+
6
+ export const chromiumGit = 'https://chromium.googlesource.com';
7
+
8
+ export const defaultBaseDir = path.join(homedir, '.update-v8');
9
+
10
+ export const v8Git = `${chromiumGit}/v8/v8.git`;
11
+
12
+ const gtestReplace = `/testing/gtest/*
13
+ !/testing/gtest/include
14
+ /testing/gtest/include/*
15
+ !/testing/gtest/include/gtest
16
+ /testing/gtest/include/gtest/*
17
+ !/testing/gtest/include/gtest/gtest_prod.h`;
18
+
19
+ const googleTestReplace = `/third_party/googletest/src/*
20
+ !/third_party/googletest/src/googletest
21
+ /third_party/googletest/src/googletest/*
22
+ !/third_party/googletest/src/googletest/include
23
+ /third_party/googletest/src/googletest/include/*
24
+ !/third_party/googletest/src/googletest/include/gtest
25
+ /third_party/googletest/src/googletest/include/gtest/*
26
+ !/third_party/googletest/src/googletest/include/gtest/gtest_prod.h`;
27
+
28
+ const zlibIgnore = `!/third_party/zlib
29
+ /third_party/zlib/contrib/bench
30
+ /third_party/zlib/contrib/tests
31
+ /third_party/zlib/google/test`;
32
+
33
+ export const v8Deps = [
34
+ {
35
+ name: 'trace_event',
36
+ repo: 'base/trace_event/common',
37
+ gitignore: {
38
+ match: '/base\n',
39
+ replace: ''
40
+ },
41
+ since: 55
42
+ },
43
+ {
44
+ name: 'gtest',
45
+ repo: 'testing/gtest',
46
+ gitignore: {
47
+ match: '/testing/gtest',
48
+ replace: gtestReplace
49
+ },
50
+ since: 55,
51
+ until: 66
52
+ },
53
+ {
54
+ name: 'jinja2',
55
+ repo: 'third_party/jinja2',
56
+ gitignore: '!/third_party/jinja2',
57
+ since: 56
58
+ },
59
+ {
60
+ name: 'markupsafe',
61
+ repo: 'third_party/markupsafe',
62
+ gitignore: '!/third_party/markupsafe',
63
+ since: 56
64
+ },
65
+ {
66
+ name: 'googletest',
67
+ repo: 'third_party/googletest/src',
68
+ gitignore: {
69
+ match: '/third_party/googletest/src',
70
+ replace: googleTestReplace
71
+ },
72
+ since: 67
73
+ },
74
+ {
75
+ name: 'zlib',
76
+ repo: 'third_party/zlib',
77
+ gitignore: zlibIgnore,
78
+ since: 80
79
+ },
80
+ {
81
+ name: 'ittapi',
82
+ repo: 'third_party/ittapi',
83
+ gitignore: '!/third_party/ittapi',
84
+ since: 81
85
+ }
86
+ ];
@@ -0,0 +1,56 @@
1
+ import Enquirer from 'enquirer';
2
+ import { Listr } from 'listr2';
3
+
4
+ import { checkOptions, doBackport } from './backport.js';
5
+ import updateVersionNumbers from './updateVersionNumbers.js';
6
+ import commitUpdate from './commitUpdate.js';
7
+ import majorUpdate from './majorUpdate.js';
8
+ import minorUpdate from './minorUpdate.js';
9
+ import updateMaintainingDependencies from './updateMaintainingDependencies.js';
10
+ import updateV8Clone from './updateV8Clone.js';
11
+
12
+ export function major(options) {
13
+ const tasks = new Listr(
14
+ [
15
+ updateV8Clone(),
16
+ majorUpdate(),
17
+ updateMaintainingDependencies(),
18
+ commitUpdate(),
19
+ updateVersionNumbers()
20
+ ],
21
+ getOptions(options)
22
+ );
23
+ return tasks.run(options);
24
+ };
25
+
26
+ export function minor(options) {
27
+ const tasks = new Listr(
28
+ [updateV8Clone(), minorUpdate(), commitUpdate()],
29
+ getOptions(options)
30
+ );
31
+ return tasks.run(options);
32
+ };
33
+
34
+ export async function backport(options) {
35
+ const shouldStop = await checkOptions(options);
36
+ if (shouldStop) return;
37
+ const tasks = new Listr(
38
+ [updateV8Clone(), doBackport(options)],
39
+ getOptions(options)
40
+ );
41
+ return tasks.run(options);
42
+ };
43
+
44
+ /**
45
+ * Get the listr2 options.
46
+ * @param {{ verbose?: boolean }} options The original options.
47
+ * @return {import('listr2').ListrOptions} The listr2 options.
48
+ */
49
+ function getOptions(opts) {
50
+ return {
51
+ renderer: opts.verbose ? 'verbose' : 'default',
52
+ injectWrapper: {
53
+ enquirer: new Enquirer()
54
+ }
55
+ };
56
+ }