@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
package/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright 2017 node-core-utils contributors
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,158 @@
1
+ # Node.js Core Utilities
2
+ [![npm](https://img.shields.io/npm/v/node-core-utils.svg?style=flat-square)](https://npmjs.org/package/node-core-utils)
3
+ [![Build Status](https://img.shields.io/github/actions/workflow/status/nodejs/node-core-utils/nodejs.yml?branch=main&style=flat-square)](https://github.com/nodejs/node-core-utils/workflows/Node.js%20CI/badge.svg?branch=main)
4
+ [![codecov](https://img.shields.io/codecov/c/github/nodejs/node-core-utils.svg?style=flat-square)](https://codecov.io/gh/nodejs/node-core-utils)
5
+ [![Known Vulnerabilities](https://snyk.io/test/github/nodejs/node-core-utils/badge.svg?style=flat-square)](https://snyk.io/test/github/nodejs/node-core-utils)
6
+
7
+ CLI tools for Node.js Core collaborators.
8
+
9
+ <!-- TOC -->
10
+
11
+ - [Tools](#tools)
12
+ - [Usage](#usage)
13
+ - [Install](#install)
14
+ - [Setting up GitHub credentials](#setting-up-github-credentials)
15
+ - [Setting up Jenkins credentials](#setting-up-jenkins-credentials)
16
+ - [Make sure your credentials won't be committed](#make-sure-your-credentials-wont-be-committed)
17
+ - [Shell autocomplete](#shell-autocomplete)
18
+ - [Troubleshooting](#troubleshooting)
19
+ - [Contributing](#contributing)
20
+ - [License](#license)
21
+
22
+ <!-- /TOC -->
23
+
24
+ ## Tools
25
+
26
+ - [`git-node`](./docs/git-node.md): Custom Git commands for working with Node.js
27
+ core, e.g. landing Pull Requests.
28
+ - [`ncu-config`](./docs/ncu-config.md): Configure variables for node-core-utils
29
+ to use.
30
+ - [`ncu-team`](./docs/ncu-team.md): Listing members of a team, synchronizing
31
+ special blocks in files with the list of members.
32
+ - [`get-metadata`](./docs/get-metadata.md): Retrieving metadata for a Pull Request.
33
+ **DEPRECATED**: use [`git node metadata`](./docs/git-node.md#git-node-metadata)
34
+ instead.
35
+ - [`ncu-ci`](./docs/ncu-ci.md): Parse the results of a Jenkins CI run and display a summary for all the failures.
36
+
37
+ ## Usage
38
+
39
+ ### Install
40
+
41
+ ```
42
+ npm install -g @node-core/utils
43
+ ```
44
+
45
+ If you would prefer to build from the source, install and link:
46
+
47
+ ```
48
+ git clone git@github.com:nodejs/node-core-utils.git
49
+ cd node-core-utils
50
+ npm install
51
+ npm link
52
+ ```
53
+
54
+ ### Setting up GitHub credentials
55
+
56
+ Most of the tools need your GitHub credentials to work. You can either
57
+
58
+ 1. Run any of the tools and you will be asked in a prompt to provide your
59
+ username and password in order to create a personal access token.
60
+ 2. Or, create a personal access token yourself on GitHub, then set them up
61
+ using an editor.
62
+
63
+
64
+ If you prefer option 2, [follow these instructions](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/)
65
+ to create the token.
66
+
67
+ When creating the token, the following boxes need to be checked:
68
+
69
+ - `user:email`: Used by `git-node` and `get-metadata` to read the email of the
70
+ PR author in order to check if it matches the email of the commit author.
71
+ - `read:org`: Used by `ncu-team` to read the list of team members.
72
+
73
+ Optionally, if you want to grant write access so `git-node` can write comments:
74
+
75
+ - `public_repo` (or `repo` if you intend to work with private repositories).
76
+
77
+ You can also edit the permission of existing tokens later.
78
+
79
+ After the token is generated, create an rc file with the following content:
80
+ (`~/.ncurc` or `$XDG_CONFIG_HOME/ncurc`):
81
+
82
+ ```json
83
+ {
84
+ "username": "your_github_username",
85
+ "token": "token_that_you_created"
86
+ }
87
+ ```
88
+
89
+ Note: you could use `ncu-config` to configure these variables, but it's not
90
+ recommended to leave your tokens in your command line history.
91
+
92
+ ### Setting up Jenkins credentials
93
+
94
+ The `git-node` and `ncu-ci` commands need to query the Node.js Jenkins API for
95
+ CI results, so you'll need to configure the Jenkins API token before using
96
+ these commands.
97
+
98
+ To obtain the Jenkins API token
99
+
100
+ 1. Open
101
+ `https://ci.nodejs.org/user/<your-github-username>/configure` (replace
102
+ \<your-github-username\> with your own GitHub username).
103
+ 2. Click on the `ADD NEW TOKEN` button in the `API Token` section.
104
+ 3. Enter an identifiable name (for example, `node-core-utils`) for this
105
+ token in the inbox that appears, and click `GENERATE`.
106
+ 4. Copy the generated token.
107
+ 5. Add it into your `ncurc` file (`~/.ncurc` or `$XDG_CONFIG_HOME/ncurc`)
108
+ with `jenkins_token` as key, like this:
109
+
110
+ ```json
111
+ {
112
+ "username": "your_github_username",
113
+ "token": "your_github_token",
114
+ "jenkins_token": "your_jenkins_token"
115
+ }
116
+ ```
117
+
118
+
119
+ ### Make sure your credentials won't be committed
120
+
121
+ Put the following entries into your
122
+ [global `gitignore` file](https://git-scm.com/docs/git-config#Documentation/git-config.txt-coreexcludesFile)
123
+ (`$XDG_CONFIG_HOME/git/ignore` or a file specified by `core.excludesFile`):
124
+
125
+ ```
126
+ # node-core-utils configuration file
127
+ .ncurc
128
+ # node-core-utils working directory
129
+ .ncu
130
+ ```
131
+
132
+ Mind that `.ncu/land` could contain your access token since it contains the
133
+ serialized configurations.
134
+
135
+ If you ever accidentally commit your access token on GitHub, you can simply
136
+ revoke that token and use a new one.
137
+
138
+ ### Shell autocomplete
139
+
140
+ To add autocomplete just run `git-node completion` and follow the instructions.
141
+ (same for the rest of the tools)
142
+
143
+ ### Troubleshooting
144
+
145
+ If you encounter an error that you cannot fix by yourself, please
146
+
147
+ 1. Make sure you update NCU to the latest version
148
+ 2. Try again with the `NCU_VERBOSITY=debug` environment variable set and
149
+ open an issue at https://github.com/nodejs/node-core-utils/issues with
150
+ detailed logs.
151
+
152
+ ## Contributing
153
+
154
+ See [CONTRIBUTING.md](./CONTRIBUTING.md).
155
+
156
+ ## License
157
+
158
+ MIT. See [LICENSE](./LICENSE).
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { fileURLToPath } from 'node:url';
4
+
5
+ import { runAsync } from '../lib/run.js';
6
+ import { setVerbosityFromEnv } from '../lib/verbosity.js';
7
+
8
+ setVerbosityFromEnv();
9
+
10
+ const script = fileURLToPath(new URL('git-node.js', import.meta.url));
11
+ runAsync(process.execPath, [script, 'metadata', ...process.argv.slice(2)]);
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { readdirSync } from 'fs';
4
+
5
+ import yargs from 'yargs';
6
+ import { hideBin } from 'yargs/helpers';
7
+
8
+ import epilogue from '../components/git/epilogue.js';
9
+ import { setVerbosityFromEnv } from '../lib/verbosity.js';
10
+
11
+ setVerbosityFromEnv();
12
+
13
+ const commandFiles = readdirSync(new URL('../components/git', import.meta.url))
14
+ .filter(file => file !== 'epilogue.js');
15
+
16
+ function importCommand(commandFile) {
17
+ return import(new URL(`../components/git/${commandFile}`, import.meta.url));
18
+ }
19
+
20
+ Promise.all(commandFiles.map(importCommand)).then((commands) => {
21
+ const args = yargs(hideBin(process.argv));
22
+ commands.forEach(command => args.command(command));
23
+ args.command('help', false, () => {}, (yargs) => { yargs.showHelp(); })
24
+ .completion('completion')
25
+ .demandCommand(1)
26
+ .strict()
27
+ .epilogue(epilogue)
28
+ .help('help')
29
+ .parse();
30
+ });