@npmcli/template-oss 4.21.4 → 4.23.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 (50) hide show
  1. package/bin/apply.js +2 -5
  2. package/bin/check.js +2 -4
  3. package/bin/release-manager.js +1 -1
  4. package/bin/release-please.js +22 -18
  5. package/lib/apply/apply-files.js +14 -19
  6. package/lib/apply/apply-version.js +1 -5
  7. package/lib/apply/index.js +1 -4
  8. package/lib/check/check-apply.js +38 -39
  9. package/lib/check/check-changelog.js +1 -4
  10. package/lib/check/check-engines.js +5 -6
  11. package/lib/check/check-gitignore.js +14 -14
  12. package/lib/check/check-required.js +13 -15
  13. package/lib/check/check-unwanted.js +2 -3
  14. package/lib/check/index.js +9 -8
  15. package/lib/config.js +86 -35
  16. package/lib/content/LICENSE-md.hbs +2 -2
  17. package/lib/content/_job-matrix-yml.hbs +10 -0
  18. package/lib/content/_job-release-integration-yml.hbs +5 -10
  19. package/lib/content/_step-git-yml.hbs +1 -1
  20. package/lib/content/_step-node-yml.hbs +1 -1
  21. package/lib/content/action-create-check-yml.hbs +1 -1
  22. package/lib/content/ci-release-yml.hbs +2 -2
  23. package/lib/content/eslintrc-js.hbs +4 -5
  24. package/lib/content/gitignore.hbs +0 -3
  25. package/lib/content/index.js +39 -38
  26. package/lib/content/package-json.hbs +12 -2
  27. package/lib/content/prettier-js.hbs +6 -0
  28. package/lib/content/prettierignore.hbs +3 -0
  29. package/lib/content/release-yml.hbs +3 -3
  30. package/lib/index.js +3 -3
  31. package/lib/release/changelog.js +41 -44
  32. package/lib/release/node-workspace-format.js +29 -16
  33. package/lib/release/release-manager.js +61 -76
  34. package/lib/release/release-please.js +50 -61
  35. package/lib/release/util.js +11 -8
  36. package/lib/util/ci-versions.js +3 -3
  37. package/lib/util/dependabot.js +2 -2
  38. package/lib/util/files.js +34 -32
  39. package/lib/util/git.js +8 -5
  40. package/lib/util/gitignore.js +13 -11
  41. package/lib/util/has-package.js +7 -12
  42. package/lib/util/import-or-require.js +1 -1
  43. package/lib/util/json-diff.js +22 -21
  44. package/lib/util/merge.js +19 -16
  45. package/lib/util/output.js +8 -5
  46. package/lib/util/parser.js +86 -70
  47. package/lib/util/path.js +4 -4
  48. package/lib/util/template.js +13 -9
  49. package/package.json +13 -8
  50. package/lib/release/node-workspace.js +0 -103
@@ -3,7 +3,7 @@ const { ManifestPlugin } = require('release-please/build/src/plugin.js')
3
3
  const { addPath } = require('release-please/build/src/plugins/workspace.js')
4
4
  const { TagName } = require('release-please/build/src/util/tag-name.js')
5
5
  const { ROOT_PROJECT_PATH } = require('release-please/build/src/manifest.js')
6
- const { DEPS, link, wrapSpecs } = require('./util.js')
6
+ const { DEPS, link, wrapSpecs, list } = require('./util.js')
7
7
 
8
8
  /* istanbul ignore next: TODO fix flaky tests and enable coverage */
9
9
  module.exports = class extends ManifestPlugin {
@@ -11,9 +11,8 @@ module.exports = class extends ManifestPlugin {
11
11
 
12
12
  #releasesByPackage = new Map()
13
13
  #pathsByComponent = new Map()
14
- #WORKSPACE_SCOPE = /(?<scope>workspace): `?(?<name>\S+?)[@\s](?<version>\S+?)`?$/gm
15
14
 
16
- async preconfigure (strategiesByPath) {
15
+ async preconfigure(strategiesByPath) {
17
16
  // First build a list of all releases that will happen based on
18
17
  // the conventional commits
19
18
  for (const path in strategiesByPath) {
@@ -26,32 +25,46 @@ module.exports = class extends ManifestPlugin {
26
25
  return strategiesByPath
27
26
  }
28
27
 
29
- run (candidates) {
28
+ run(candidates) {
30
29
  this.#rewriteWorkspaceChangelogItems(candidates)
31
30
  this.#sortReleases(candidates)
32
31
  return candidates
33
32
  }
34
33
 
34
+ #replaceWorkspace({ name, versionRange }) {
35
+ const version = versionRange.replace(/^[\^~]/, '')
36
+ const { path, component } = this.#releasesByPackage.get(name)
37
+ const { tagSeparator, includeVInTag } = this.repositoryConfig[path]
38
+ const {
39
+ repository: { owner, repo },
40
+ } = this.github
41
+ const tag = new TagName(version, component, tagSeparator, includeVInTag).toString()
42
+ const url = `https://github.com/${owner}/${repo}/releases/tag/${tag}`
43
+ return list(`${link('workspace', url)}: ${wrapSpecs(`${name}@${version}`)}`)
44
+ }
45
+
35
46
  // I don't like how release-please formats workspace changelog entries
36
47
  // so this rewrites them to look like the rest of our changelog. This can't
37
48
  // be part of the changelog plugin since they are written after that by the
38
49
  // node-workspace plugin. A possible PR to release-please could add an option
39
50
  // to customize these or run them through the changelog notes generator.
40
- #rewriteWorkspaceChangelogItems (candidates) {
51
+ #rewriteWorkspaceChangelogItems(candidates) {
41
52
  for (const candidate of candidates) {
42
53
  for (const release of candidate.pullRequest.body.releaseData) {
43
54
  // Update notes with a link to each workspaces release notes
44
55
  // now that we have all of the releases in a single pull request
45
- release.notes =
46
- release.notes.replace(this.#WORKSPACE_SCOPE, (...args) => {
47
- const { scope, name, version } = args.pop()
48
- const { path, component } = this.#releasesByPackage.get(name)
49
- const { tagSeparator, includeVInTag } = this.repositoryConfig[path]
50
- const { repository: { owner, repo } } = this.github
51
- const tag = new TagName(version, component, tagSeparator, includeVInTag).toString()
52
- const url = `https://github.com/${owner}/${repo}/releases/tag/${tag}`
53
- return `${link(scope, url)}: ${wrapSpecs(`${name}@${version}`)}`
54
- })
56
+ release.notes = release.notes
57
+ .replace(/^\* The following workspace dependencies were updated\n/gm, '')
58
+ .replace(/^\s{2}\* dependencies\n/gm, '')
59
+ .replace(/^\s{2}\* devDependencies\n/gm, '')
60
+ .replace(/^\s{2}\* peerDependencies\n/gm, '')
61
+ .replace(/^\s{2}\* optionalDependencies\n/gm, '')
62
+ .replace(/^\s{4}\* (?<name>[^\s]+) bumped to (?<versionRange>[^\s]+)/gm, (...args) =>
63
+ this.#replaceWorkspace(args.at(-1)),
64
+ )
65
+ .replace(/^\s{4}\* (?<name>[^\s]+) bumped from (?:[^\s]+) to (?<versionRange>[^\s]+)/gm, (...args) =>
66
+ this.#replaceWorkspace(args.at(-1)),
67
+ )
55
68
 
56
69
  // Find the associated changelog and update that too
57
70
  const path = this.#pathsByComponent.get(release.component)
@@ -66,7 +79,7 @@ module.exports = class extends ManifestPlugin {
66
79
 
67
80
  // Sort root release to the top of the pull request
68
81
  // release please pre sorts based on graph order so
69
- #sortReleases (candidates) {
82
+ #sortReleases(candidates) {
70
83
  for (const candidate of candidates) {
71
84
  candidate.pullRequest.body.releaseData.sort((a, b) => {
72
85
  const aPath = this.#pathsByComponent.get(a.component)
@@ -21,17 +21,7 @@ class ReleaseManager {
21
21
 
22
22
  #info
23
23
 
24
- constructor ({
25
- token,
26
- repo,
27
- cwd = process.cwd(),
28
- pr,
29
- backport,
30
- defaultTag,
31
- lockfile,
32
- publish,
33
- silent,
34
- }) {
24
+ constructor({ token, repo, cwd = process.cwd(), pr, backport, defaultTag, lockfile, publish, silent }) {
35
25
  assert(token, 'GITHUB_TOKEN is required')
36
26
  assert(repo, 'GITHUB_REPOSITORY is required')
37
27
  assert(cwd, 'cwd is required')
@@ -51,12 +41,12 @@ class ReleaseManager {
51
41
  this.#info = silent ? noop : core.info
52
42
  }
53
43
 
54
- static async run (options) {
44
+ static async run(options) {
55
45
  const manager = new ReleaseManager(options)
56
46
  return manager.run()
57
47
  }
58
48
 
59
- async run () {
49
+ async run() {
60
50
  const { data: pullRequest } = await this.#octokit.rest.pulls.get({
61
51
  owner: this.#owner,
62
52
  repo: this.#repo,
@@ -84,51 +74,55 @@ class ReleaseManager {
84
74
  return `### Release Checklist for ${release.tag}\n\n${checklist}`
85
75
  }
86
76
 
87
- async #getPrReleases ({ pullRequest }) {
77
+ async #getPrReleases({ pullRequest }) {
88
78
  return /<details><summary>.*<\/summary>/.test(pullRequest.body)
89
79
  ? await this.#getPrMonoRepoReleases({ pullRequest })
90
80
  : [this.#getPrRootRelease({ pullRequest }), []]
91
81
  }
92
82
 
93
- async #getPrMonoRepoReleases ({ pullRequest }) {
83
+ async #getPrMonoRepoReleases({ pullRequest }) {
94
84
  const releases = pullRequest.body.match(/<details><summary>.*<\/summary>/g)
95
85
  this.#info(`Found ${releases.length} releases`)
96
86
 
97
- const workspacesComponents = [...await mapWorkspaces({
98
- cwd: this.#cwd,
99
- pkg: require(join(this.#cwd, 'package.json')),
100
- })]
101
- .reduce((acc, [k]) => {
102
- const wsComponentName = k.startsWith('@') ? k.split('/')[1] : k
103
- acc[wsComponentName] = k
104
- return acc
105
- }, {})
87
+ const workspacesComponents = [
88
+ ...(await mapWorkspaces({
89
+ cwd: this.#cwd,
90
+ pkg: require(join(this.#cwd, 'package.json')),
91
+ })),
92
+ ].reduce((acc, [k]) => {
93
+ const wsComponentName = k.startsWith('@') ? k.split('/')[1] : k
94
+ acc[wsComponentName] = k
95
+ return acc
96
+ }, {})
106
97
 
107
98
  const MONO_VERSIONS = /<details><summary>(?:(.*?):\s)?(.*?)<\/summary>/
108
99
 
109
- return releases.reduce((acc, r) => {
110
- const [, name, version] = r.match(MONO_VERSIONS)
100
+ return releases.reduce(
101
+ (acc, r) => {
102
+ const [, name, version] = r.match(MONO_VERSIONS)
111
103
 
112
- const release = this.#getPrReleaseInfo({
113
- pullRequest,
114
- name,
115
- version,
116
- workspaces: workspacesComponents,
117
- })
104
+ const release = this.#getPrReleaseInfo({
105
+ pullRequest,
106
+ name,
107
+ version,
108
+ workspaces: workspacesComponents,
109
+ })
118
110
 
119
- if (release.isRoot) {
120
- this.#info(`Found root: ${JSON.stringify(release)}`)
121
- acc[0] = release
122
- } else {
123
- this.#info(`Found workspace: ${JSON.stringify(release)}`)
124
- acc[1].push(release)
125
- }
111
+ if (release.isRoot) {
112
+ this.#info(`Found root: ${JSON.stringify(release)}`)
113
+ acc[0] = release
114
+ } else {
115
+ this.#info(`Found workspace: ${JSON.stringify(release)}`)
116
+ acc[1].push(release)
117
+ }
126
118
 
127
- return acc
128
- }, [null, []])
119
+ return acc
120
+ },
121
+ [null, []],
122
+ )
129
123
  }
130
124
 
131
- #getPrRootRelease ({ pullRequest }) {
125
+ #getPrRootRelease({ pullRequest }) {
132
126
  this.#info('Found no monorepo, checking for single root version')
133
127
 
134
128
  const match = pullRequest.body.match(/\n##\s\[(.*?)\]/)
@@ -140,7 +134,7 @@ class ReleaseManager {
140
134
  return this.#getPrReleaseInfo({ pullRequest, version })
141
135
  }
142
136
 
143
- #getPrReleaseInfo ({ pullRequest, workspaces = {}, name = null, version: rawVersion }) {
137
+ #getPrReleaseInfo({ pullRequest, workspaces = {}, name = null, version: rawVersion }) {
144
138
  const version = semver.parse(rawVersion)
145
139
  const prerelease = !!version.prerelease.length
146
140
  const tag = `${name ? `${name}-` : ''}v${rawVersion}`
@@ -156,51 +150,47 @@ class ReleaseManager {
156
150
  version: rawVersion,
157
151
  major: version.major,
158
152
  url: `https://github.com/${pullRequest.base.repo.full_name}/releases/tag/${tag}`,
159
- flags: [
160
- workspaces[name] ? `-w ${workspaces[name]}` : null,
161
- `--tag=${publishTag}`,
162
- ].filter(Boolean).join(' '),
153
+ flags: [workspaces[name] ? `-w ${workspaces[name]}` : null, `--tag=${publishTag}`].filter(Boolean).join(' '),
163
154
  }
164
155
  }
165
156
 
166
- async #getReleaseProcess ({ release, workspaces }) {
157
+ async #getReleaseProcess({ release, workspaces }) {
167
158
  const RELEASE_LIST_ITEM = /^\d+\.\s/gm
168
159
 
169
160
  this.#info(`Fetching release process from repo wiki: ${this.#owner}/${this.#repo}`)
170
161
 
171
162
  const releaseProcess = await fetch(
172
- `https://raw.githubusercontent.com/wiki/${this.#owner}/${this.#repo}/Release-Process.md`
173
- )
174
- .then(r => {
175
- // If the url fails with anything but a 404 we want the process to blow
176
- // up because that means something is very wrong. This is a rare edge
177
- // case that isn't worth testing.
178
- /* istanbul ignore else */
179
- if (r.statusCode === 200) {
180
- this.#info('Found release process from wiki')
181
- return r.body.text()
182
- } else if (r.statusCode === 404) {
183
- this.#info('No release process found in wiki, falling back to default process')
184
- return this.#getReleaseSteps()
185
- } else {
186
- throw new Error(`Release process fetch failed with status: ${r.statusCode}`)
187
- }
188
- })
163
+ `https://raw.githubusercontent.com/wiki/${this.#owner}/${this.#repo}/Release-Process.md`,
164
+ ).then(r => {
165
+ // If the url fails with anything but a 404 we want the process to blow
166
+ // up because that means something is very wrong. This is a rare edge
167
+ // case that isn't worth testing.
168
+ /* istanbul ignore else */
169
+ if (r.statusCode === 200) {
170
+ this.#info('Found release process from wiki')
171
+ return r.body.text()
172
+ } else if (r.statusCode === 404) {
173
+ this.#info('No release process found in wiki, falling back to default process')
174
+ return this.#getReleaseSteps()
175
+ } else {
176
+ throw new Error(`Release process fetch failed with status: ${r.statusCode}`)
177
+ }
178
+ })
189
179
 
190
180
  // XXX: the release steps need to always be the last thing in the doc for this to work
191
181
  const releaseLines = releaseProcess.split('\n')
192
- const releaseStartLine = releaseLines.reduce((acc, l, i) => l.match(/^#+\s/) ? i : acc, 0)
182
+ const releaseStartLine = releaseLines.reduce((acc, l, i) => (l.match(/^#+\s/) ? i : acc), 0)
193
183
  const section = releaseLines.slice(releaseStartLine).join('\n')
194
184
 
195
185
  return section
196
186
  .split({
197
- [Symbol.split]: (str) => {
187
+ [Symbol.split]: str => {
198
188
  const [, ...matches] = str.split(RELEASE_LIST_ITEM)
199
189
  this.#info(`Found ${matches.length} release items`)
200
- return matches.map((m) => `- [ ] <STEP_INDEX>. ${m}`.trim())
190
+ return matches.map(m => `- [ ] <STEP_INDEX>. ${m}`.trim())
201
191
  },
202
192
  })
203
- .filter((item) => {
193
+ .filter(item => {
204
194
  if (release.prerelease && item.includes('> NOT FOR PRERELEASE')) {
205
195
  return false
206
196
  }
@@ -214,7 +204,7 @@ class ReleaseManager {
214
204
  .map((item, index) => item.replace('<STEP_INDEX>', index + 1))
215
205
  }
216
206
 
217
- #getReleaseSteps () {
207
+ #getReleaseSteps() {
218
208
  const R = `-R ${this.#owner}/${this.#repo}`
219
209
 
220
210
  const manualSteps = `
@@ -275,12 +265,7 @@ class ReleaseManager {
275
265
  `
276
266
  /* eslint-enable max-len */
277
267
 
278
- return [
279
- this.#publish ? autoSteps : manualSteps,
280
- alwaysSteps,
281
- ]
282
- .map(v => dedent(v))
283
- .join('\n\n')
268
+ return [this.#publish ? autoSteps : manualSteps, alwaysSteps].map(v => dedent(v)).join('\n\n')
284
269
  }
285
270
  }
286
271
 
@@ -1,17 +1,12 @@
1
1
  const RP = require('release-please')
2
- const {
3
- DefaultVersioningStrategy,
4
- } = require('release-please/build/src/versioning-strategies/default.js')
5
- const {
6
- PrereleaseVersioningStrategy,
7
- } = require('release-please/build/src/versioning-strategies/prerelease.js')
2
+ const { DefaultVersioningStrategy } = require('release-please/build/src/versioning-strategies/default.js')
3
+ const { PrereleaseVersioningStrategy } = require('release-please/build/src/versioning-strategies/prerelease.js')
8
4
  const { ROOT_PROJECT_PATH } = require('release-please/build/src/manifest.js')
9
5
  const { CheckpointLogger, logger } = require('release-please/build/src/util/logger.js')
10
6
  const assert = require('assert')
11
7
  const core = require('@actions/core')
12
8
  const omit = require('just-omit')
13
9
  const ChangelogNotes = require('./changelog.js')
14
- const NodeWorkspace = require('./node-workspace.js')
15
10
  const NodeWorkspaceFormat = require('./node-workspace-format.js')
16
11
  const { getPublishTag, noop } = require('./util.js')
17
12
 
@@ -32,16 +27,7 @@ class ReleasePlease {
32
27
  #octokit
33
28
  #manifest
34
29
 
35
- constructor ({
36
- token,
37
- repo,
38
- branch,
39
- backport,
40
- defaultTag,
41
- overrides,
42
- silent,
43
- trace,
44
- }) {
30
+ constructor({ token, repo, branch, backport, defaultTag, overrides, silent, trace }) {
45
31
  assert(token, 'token is required')
46
32
  assert(repo, 'repo is required')
47
33
  assert(branch, 'branch is required')
@@ -58,30 +44,33 @@ class ReleasePlease {
58
44
  this.#trace = trace
59
45
  }
60
46
 
61
- static async run (options) {
47
+ static async run(options) {
62
48
  const releasePlease = new ReleasePlease(options)
63
49
  await releasePlease.init()
64
50
  return releasePlease.run()
65
51
  }
66
52
 
67
- async init () {
68
- RP.registerChangelogNotes('default', ({ github, ...o }) =>
69
- new ChangelogNotes(github, o))
70
- RP.registerVersioningStrategy('default', (o) =>
71
- o.prerelease ? new PrereleaseVersioningStrategy(o) : new DefaultVersioningStrategy(o))
72
- RP.registerPlugin('node-workspace', ({ github, targetBranch, repositoryConfig, ...o }) =>
73
- new NodeWorkspace(github, targetBranch, repositoryConfig, o))
74
- RP.registerPlugin('node-workspace-format', ({ github, targetBranch, repositoryConfig, ...o }) =>
75
- new NodeWorkspaceFormat(github, targetBranch, repositoryConfig, o))
53
+ async init() {
54
+ RP.registerChangelogNotes('default', ({ github, ...o }) => new ChangelogNotes(github, o))
55
+ RP.registerVersioningStrategy('default', o =>
56
+ o.prerelease ? new PrereleaseVersioningStrategy(o) : new DefaultVersioningStrategy(o),
57
+ )
58
+ RP.registerPlugin(
59
+ 'node-workspace-format',
60
+ ({ github, targetBranch, repositoryConfig, ...o }) =>
61
+ new NodeWorkspaceFormat(github, targetBranch, repositoryConfig, o),
62
+ )
76
63
 
77
64
  if (this.#silent) {
78
65
  this.#info = noop
79
- RP.setLogger(Object.entries(logger).reduce((acc, [k, v]) => {
80
- if (typeof v === 'function') {
81
- acc[k] = noop
82
- }
83
- return acc
84
- }, {}))
66
+ RP.setLogger(
67
+ Object.entries(logger).reduce((acc, [k, v]) => {
68
+ if (typeof v === 'function') {
69
+ acc[k] = noop
70
+ }
71
+ return acc
72
+ }, {}),
73
+ )
85
74
  } else {
86
75
  this.#info = core.info
87
76
  RP.setLogger(new CheckpointLogger(true, !!this.#trace))
@@ -93,16 +82,10 @@ class ReleasePlease {
93
82
  token: this.#token,
94
83
  })
95
84
  this.#octokit = this.#github.octokit
96
- this.#manifest = await RP.Manifest.fromManifest(
97
- this.#github,
98
- this.#branch,
99
- undefined,
100
- undefined,
101
- this.#overrides
102
- )
85
+ this.#manifest = await RP.Manifest.fromManifest(this.#github, this.#branch, undefined, undefined, this.#overrides)
103
86
  }
104
87
 
105
- async run () {
88
+ async run() {
106
89
  const rootPr = await this.#getRootPullRequest()
107
90
  const releases = await this.#getReleases()
108
91
 
@@ -111,11 +94,13 @@ class ReleasePlease {
111
94
 
112
95
  // release please does not guarantee that the release PR will have the latest sha,
113
96
  // but we always need it so we can attach the relevant checks to the sha.
114
- rootPr.sha = await this.#octokit.paginate(this.#octokit.rest.pulls.listCommits, {
115
- owner: this.#owner,
116
- repo: this.#repo,
117
- pull_number: rootPr.number,
118
- }).then(r => r[r.length - 1].sha)
97
+ rootPr.sha = await this.#octokit
98
+ .paginate(this.#octokit.rest.pulls.listCommits, {
99
+ owner: this.#owner,
100
+ repo: this.#repo,
101
+ pull_number: rootPr.number,
102
+ })
103
+ .then(r => r[r.length - 1].sha)
119
104
  }
120
105
 
121
106
  if (releases) {
@@ -129,19 +114,23 @@ class ReleasePlease {
129
114
  defaultTag: this.#defaultTag,
130
115
  })
131
116
 
132
- release.prNumber = await this.#octokit.rest.repos.listPullRequestsAssociatedWithCommit({
133
- owner: this.#owner,
134
- repo: this.#repo,
135
- commit_sha: release.sha,
136
- per_page: 1,
137
- }).then(r => r.data[0]?.number)
138
-
139
- release.pkgName = await this.#octokit.rest.repos.getContent({
140
- owner: this.#owner,
141
- repo: this.#repo,
142
- ref: this.#branch,
143
- path: `${release.path === '.' ? '' : release.path}/package.json`,
144
- }).then(r => JSON.parse(Buffer.from(r.data.content, r.data.encoding)).name)
117
+ release.prNumber = await this.#octokit.rest.repos
118
+ .listPullRequestsAssociatedWithCommit({
119
+ owner: this.#owner,
120
+ repo: this.#repo,
121
+ commit_sha: release.sha,
122
+ per_page: 1,
123
+ })
124
+ .then(r => r.data[0]?.number)
125
+
126
+ release.pkgName = await this.#octokit.rest.repos
127
+ .getContent({
128
+ owner: this.#owner,
129
+ repo: this.#repo,
130
+ ref: this.#branch,
131
+ path: `${release.path === '.' ? '' : release.path}/package.json`,
132
+ })
133
+ .then(r => JSON.parse(Buffer.from(r.data.content, r.data.encoding)).name)
145
134
  }
146
135
  }
147
136
 
@@ -151,14 +140,14 @@ class ReleasePlease {
151
140
  }
152
141
  }
153
142
 
154
- async #getRootPullRequest () {
143
+ async #getRootPullRequest() {
155
144
  // We only ever get a single pull request with our current release-please settings
156
145
  // Update this if we start creating individual PRs per workspace release
157
146
  const pullRequests = await this.#manifest.createPullRequests()
158
147
  return pullRequests.filter(Boolean)[0] ?? null
159
148
  }
160
149
 
161
- async #getReleases () {
150
+ async #getReleases() {
162
151
  // if we have a root release, always put it as the first item in the array
163
152
  const rawReleases = await this.#manifest.createReleases().then(r => r.filter(Boolean))
164
153
  let rootRelease = null
@@ -1,11 +1,11 @@
1
1
  const semver = require('semver')
2
2
 
3
3
  const SPEC = new RegExp(`([^\\s]+@${semver.src[semver.tokens.FULLPLAIN]})`, 'g')
4
- const code = (c) => `\`${c}\``
5
- const wrapSpecs = (str) => str.replace(SPEC, code('$1'))
6
- const block = (lang) => `\`\`\`${lang ? `${lang}` : ''}`
4
+ const code = c => `\`${c}\``
5
+ const wrapSpecs = str => str.replace(SPEC, code('$1'))
6
+ const block = lang => `\`\`\`${lang ? `${lang}` : ''}`
7
7
  const link = (text, url) => `[${text}](${url})`
8
- const list = (text) => `* ${text}`
8
+ const list = text => `* ${text}`
9
9
  const formatDate = (date = new Date()) => {
10
10
  const year = date.getFullYear()
11
11
  const month = (date.getMonth() + 1).toString().padStart(2, '0')
@@ -17,12 +17,15 @@ const getPublishTag = (v, { backport, defaultTag }) => {
17
17
  const version = semver.parse(v)
18
18
  return version.prerelease.length
19
19
  ? `prerelease-${version.major}`
20
- : backport ? `latest-${backport}`
21
- : defaultTag.replace(/{{\s*major\s*}}/, version.major)
20
+ : backport
21
+ ? `latest-${backport}`
22
+ : defaultTag.replace(/{{\s*major\s*}}/, version.major)
22
23
  }
23
24
 
24
- const makeGitHubUrl = (owner, repo) =>
25
- (...p) => `https://github.com/${owner}/${repo}/${p.join('/')}`
25
+ const makeGitHubUrl =
26
+ (owner, repo) =>
27
+ (...p) =>
28
+ `https://github.com/${owner}/${repo}/${p.join('/')}`
26
29
 
27
30
  const noop = () => {}
28
31
 
@@ -1,16 +1,16 @@
1
1
  const { uniq, range, isPlainObject } = require('lodash')
2
2
  const semver = require('semver')
3
3
 
4
- const parseCiVersions = (ciVersions) => {
4
+ const parseCiVersions = ciVersions => {
5
5
  if (Array.isArray(ciVersions)) {
6
- return Object.fromEntries(ciVersions.map((v) => [v, true]))
6
+ return Object.fromEntries(ciVersions.map(v => [v, true]))
7
7
  }
8
8
  if (isPlainObject(ciVersions)) {
9
9
  return ciVersions
10
10
  }
11
11
  }
12
12
 
13
- const getLowerBounds = (sRange) => {
13
+ const getLowerBounds = sRange => {
14
14
  return new semver.Range(sRange).set.map(c => c[0])
15
15
  }
16
16
 
@@ -1,7 +1,7 @@
1
1
  const { name: NAME } = require('../../package.json')
2
2
  const { minimatch } = require('minimatch')
3
3
 
4
- const parseDependabotConfig = (v) => typeof v === 'string' ? { strategy: v } : (v ?? {})
4
+ const parseDependabotConfig = v => (typeof v === 'string' ? { strategy: v } : v ?? {})
5
5
 
6
6
  module.exports = (config, defaultConfig, branches) => {
7
7
  const { dependabot } = config
@@ -12,7 +12,7 @@ module.exports = (config, defaultConfig, branches) => {
12
12
  }
13
13
 
14
14
  return branches
15
- .filter((b) => dependabot[b] !== false)
15
+ .filter(b => dependabot[b] !== false)
16
16
  .map(branch => {
17
17
  const isReleaseBranch = minimatch(branch, config.releaseBranch)
18
18
  return {