@npmcli/template-oss 4.21.3 → 4.21.4
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/lib/apply/apply-files.js +1 -1
- package/lib/apply/apply-version.js +1 -1
- package/lib/check/check-apply.js +1 -1
- package/lib/check/check-gitignore.js +1 -1
- package/lib/check/check-required.js +1 -1
- package/lib/content/_job-release-integration-yml.hbs +2 -1
- package/lib/content/commitlintrc-js.hbs +2 -1
- package/lib/index.js +1 -1
- package/lib/release/changelog.js +54 -13
- package/package.json +5 -5
package/lib/apply/apply-files.js
CHANGED
package/lib/check/check-apply.js
CHANGED
|
@@ -15,6 +15,7 @@ steps:
|
|
|
15
15
|
- name: Publish
|
|
16
16
|
env:
|
|
17
17
|
PUBLISH_TOKEN: $\{{ secrets.PUBLISH_TOKEN }}
|
|
18
|
+
RELEASES: $\{{ inputs.releases }}
|
|
18
19
|
{{else}}
|
|
19
20
|
{{> stepsSetupYml }}
|
|
20
21
|
- name: Check If Published
|
|
@@ -30,7 +31,7 @@ steps:
|
|
|
30
31
|
fi
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
for release in $(echo
|
|
34
|
+
for release in $(echo $RELEASES | jq -r '.[] | @base64'); do
|
|
34
35
|
{{#if publish}}
|
|
35
36
|
PUBLISH_TAG=$(echo "$release" | base64 --decode | jq -r .publishTag)
|
|
36
37
|
STATUS=$(each_release "$PUBLISH_TAG")
|
|
@@ -3,6 +3,7 @@ module.exports = {
|
|
|
3
3
|
rules: {
|
|
4
4
|
'type-enum': [2, 'always', [{{{ join (quote (pluck changelogTypes "type")) }}}]],
|
|
5
5
|
'header-max-length': [2, 'always', 80],
|
|
6
|
-
'subject-case': [0
|
|
6
|
+
'subject-case': [0],
|
|
7
|
+
'body-max-line-length': [0],
|
|
7
8
|
},
|
|
8
9
|
}
|
package/lib/index.js
CHANGED
package/lib/release/changelog.js
CHANGED
|
@@ -110,7 +110,7 @@ class ChangelogNotes {
|
|
|
110
110
|
return authorsByCommit
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
async #
|
|
113
|
+
async #getPullRequestNumbersForCommits (commits) {
|
|
114
114
|
const shas = commits
|
|
115
115
|
.filter(c => !c.pullRequest?.number)
|
|
116
116
|
.map(c => c.sha)
|
|
@@ -134,7 +134,7 @@ class ChangelogNotes {
|
|
|
134
134
|
return pullRequestsByCommit
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
#buildEntry (commit
|
|
137
|
+
#buildEntry (commit) {
|
|
138
138
|
const entry = []
|
|
139
139
|
|
|
140
140
|
if (commit.sha) {
|
|
@@ -143,7 +143,7 @@ class ChangelogNotes {
|
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
// A link to the pull request if the commit has one
|
|
146
|
-
const commitPullRequest = commit.
|
|
146
|
+
const commitPullRequest = commit.pullRequestNumber
|
|
147
147
|
if (commitPullRequest) {
|
|
148
148
|
entry.push(link(`#${commitPullRequest}`, this.#ghUrl('pull', commitPullRequest)))
|
|
149
149
|
}
|
|
@@ -154,21 +154,65 @@ class ChangelogNotes {
|
|
|
154
154
|
entry.push([scope, subject].filter(Boolean).join(' '))
|
|
155
155
|
|
|
156
156
|
// A list og the authors github handles or names
|
|
157
|
-
if (authors.length) {
|
|
158
|
-
entry.push(`(${authors.join(', ')})`)
|
|
157
|
+
if (commit.authors.length) {
|
|
158
|
+
entry.push(`(${commit.authors.join(', ')})`)
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
return entry.join(' ')
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
|
|
164
|
+
#filterCommits (commits) {
|
|
165
|
+
const filteredCommits = []
|
|
166
|
+
const keyedDuplicates = {}
|
|
167
|
+
|
|
168
|
+
// Filter certain commits so we can make sure only the latest version of
|
|
169
|
+
// each one gets into the changelog
|
|
170
|
+
for (const commit of commits) {
|
|
171
|
+
if (commit.bareMessage.startsWith('postinstall for dependabot template-oss PR')) {
|
|
172
|
+
keyedDuplicates.templateOssPostInstall ??= []
|
|
173
|
+
keyedDuplicates.templateOssPostInstall.push(commit)
|
|
174
|
+
continue
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (commit.bareMessage.startsWith('bump @npmcli/template-oss from')) {
|
|
178
|
+
keyedDuplicates.templateOssBump ??= []
|
|
179
|
+
keyedDuplicates.templateOssBump.push(commit)
|
|
180
|
+
continue
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
filteredCommits.push(commit)
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// Sort all our duplicates so we get the latest verion (by PR number) of each type.
|
|
187
|
+
// Then flatten so we can put them all back into the changelog
|
|
188
|
+
const sortedDupes = Object.values(keyedDuplicates)
|
|
189
|
+
.filter((items) => Boolean(items.length))
|
|
190
|
+
.map((items) => items.sort((a, b) => b.pullRequestNumber - a.pullRequestNumber))
|
|
191
|
+
.flatMap(items => items[0])
|
|
192
|
+
|
|
193
|
+
// This moves them to the bottom of their changelog section which is not
|
|
194
|
+
// strictly necessary but it's easier to do this way.
|
|
195
|
+
for (const duplicate of sortedDupes) {
|
|
196
|
+
filteredCommits.push(duplicate)
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return filteredCommits
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
async buildNotes (rawCommits, { version, previousTag, currentTag, changelogSections }) {
|
|
165
203
|
// get authors for commits for each sha
|
|
166
|
-
const
|
|
204
|
+
const authors = await this.#getAuthorsForCommits(rawCommits)
|
|
167
205
|
|
|
168
206
|
// when rebase merging multiple commits with a single PR, only the first commit
|
|
169
207
|
// will have a pr number when coming from release-please. this check will manually
|
|
170
208
|
// lookup commits without a pr number and find one if it exists
|
|
171
|
-
const
|
|
209
|
+
const prNumbers = await this.#getPullRequestNumbersForCommits(rawCommits)
|
|
210
|
+
|
|
211
|
+
const fullCommits = rawCommits.map((commit) => {
|
|
212
|
+
commit.authors = authors[commit.sha] ?? []
|
|
213
|
+
commit.pullRequestNumber = Number(commit.pullRequest?.number ?? prNumbers[commit.sha])
|
|
214
|
+
return commit
|
|
215
|
+
})
|
|
172
216
|
|
|
173
217
|
const changelog = new Changelog({
|
|
174
218
|
version,
|
|
@@ -178,12 +222,9 @@ class ChangelogNotes {
|
|
|
178
222
|
sections: changelogSections,
|
|
179
223
|
})
|
|
180
224
|
|
|
181
|
-
for (const commit of
|
|
225
|
+
for (const commit of this.#filterCommits(fullCommits)) {
|
|
182
226
|
// Collect commits by type
|
|
183
|
-
changelog.add(commit.type, this.#buildEntry(commit
|
|
184
|
-
authors: authorsByCommit[commit.sha],
|
|
185
|
-
pullRequest: pullRequestByCommit[commit.sha],
|
|
186
|
-
}))
|
|
227
|
+
changelog.add(commit.type, this.#buildEntry(commit))
|
|
187
228
|
|
|
188
229
|
// And breaking changes to its own section
|
|
189
230
|
changelog.add(Changelog.BREAKING, ...commit.notes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@npmcli/template-oss",
|
|
3
|
-
"version": "4.21.
|
|
3
|
+
"version": "4.21.4",
|
|
4
4
|
"description": "templated files used in npm CLI team oss projects",
|
|
5
5
|
"main": "lib/content/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"license": "ISC",
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@actions/core": "^1.9.1",
|
|
37
|
-
"@commitlint/cli": "^
|
|
38
|
-
"@commitlint/config-conventional": "^
|
|
37
|
+
"@commitlint/cli": "^19.0.3",
|
|
38
|
+
"@commitlint/config-conventional": "^19.2.2",
|
|
39
39
|
"@isaacs/string-locale-compare": "^1.1.0",
|
|
40
40
|
"@npmcli/arborist": "^7.2.1",
|
|
41
41
|
"@npmcli/git": "^5.0.3",
|
|
@@ -55,10 +55,10 @@
|
|
|
55
55
|
"lodash": "^4.17.21",
|
|
56
56
|
"minimatch": "^9.0.2",
|
|
57
57
|
"npm-package-arg": "^11.0.1",
|
|
58
|
-
"proc-log": "^
|
|
58
|
+
"proc-log": "^4.0.0",
|
|
59
59
|
"release-please": "16.3.1",
|
|
60
60
|
"semver": "^7.3.5",
|
|
61
|
-
"undici": "^
|
|
61
|
+
"undici": "^6.7.0",
|
|
62
62
|
"yaml": "^2.1.1"
|
|
63
63
|
},
|
|
64
64
|
"files": [
|