@vitejs/release-scripts 1.7.1 → 1.8.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 (2) hide show
  1. package/dist/index.js +16 -50
  2. package/package.json +13 -12
package/dist/index.js CHANGED
@@ -9,7 +9,8 @@ import prompts from "prompts";
9
9
  import { publint } from "publint";
10
10
  import { formatMessage } from "publint/utils";
11
11
  import { ConventionalChangelog } from "conventional-changelog";
12
- import createPreset, { DEFAULT_COMMIT_TYPES } from "conventional-changelog-conventionalcommits";
12
+ import createPreset, { DEFAULT_COMMIT_TYPES, formatCommitUrl } from "conventional-changelog-conventionalcommits";
13
+ import { bold, compareUrl, each, heading, link, list, newline, segments, words } from "@conventional-changelog/template";
13
14
  //#region src/utils.ts
14
15
  const args = mri(process.argv.slice(2));
15
16
  const isDryRun = !!args.dry;
@@ -232,58 +233,23 @@ https://github.com/${org}/${repo}/actions/workflows/publish.yml`));
232
233
  //#endregion
233
234
  //#region src/changelog.ts
234
235
  const generateChangelog = async ({ getPkgDir, tagPrefix }) => {
235
- const preset = await createPreset({ types: DEFAULT_COMMIT_TYPES.map((t) => ({
236
+ const preset = createPreset({ types: DEFAULT_COMMIT_TYPES.map((t) => ({
236
237
  ...t,
237
- hidden: false
238
+ effect: t.effect === "hidden" ? "changelog" : t.effect
238
239
  })) });
239
240
  preset.writer ??= {};
240
- preset.writer.headerPartial = `
241
- ## {{#if isPatch~}} <small> {{~/if~}}
242
- {{#if @root.linkCompare~}}
243
- [{{version}}](
244
- {{~#if @root.repository~}}
245
- {{~#if @root.host}}
246
- {{~@root.host}}/
247
- {{~/if}}
248
- {{~#if @root.owner}}
249
- {{~@root.owner}}/
250
- {{~/if}}
251
- {{~@root.repository}}
252
- {{~else}}
253
- {{~@root.repoUrl}}
254
- {{~/if~}}
255
- /compare/{{previousTag}}...{{currentTag}})
256
- {{~else}}
257
- {{~version}}
258
- {{~/if}}
259
- {{~#if title}} "{{title}}"
260
- {{~/if}}
261
- {{~#if date}} ({{date}})
262
- {{~/if}}
263
- {{~#if isPatch~}} </small> {{~/if}}
264
- `.trim();
265
- preset.writer.mainTemplate = `
266
- {{> header}}
267
- {{#if noteGroups}}
268
- {{#each noteGroups}}
269
-
270
- ### ⚠ {{title}}
271
-
272
- {{#each notes}}
273
- * {{#if commit.scope}}**{{commit.scope}}:** {{/if}}{{commit.subject}} {{#if commit.hash}}([{{commit.shortHash}}](https://github.com/{{@root.owner}}/{{@root.repository}}/commit/{{commit.hash}})){{/if}}
274
- {{/each}}
275
- {{/each}}
276
- {{/if}}
277
- {{#each commitGroups}}
278
-
279
- {{#if title}}
280
- ### {{title}}
281
-
282
- {{/if}}
283
- {{#each commits}}
284
- {{> commit root=@root}}
285
- {{/each}}
286
- {{/each}}`.trim() + "\n";
241
+ preset.writer.headerPartial = function(context) {
242
+ const { linkCompare, version, title, date, isPatch } = context;
243
+ const headingText = words(linkCompare ? link(version, compareUrl(context)) : version, title && `"${title}"`, date && `(${date})`);
244
+ return heading(2, isPatch ? `<small>${headingText}</small>` : headingText);
245
+ };
246
+ preset.writer.template = function(context) {
247
+ const { headerPartial, preamblePartial, commitPartial, footerPartial, noteGroups, commitGroups } = context;
248
+ return headerPartial(context) + "\n" + segments(preamblePartial(context), each(noteGroups, (group) => segments(heading(3, words("⚠", group.title)), list(group.notes, (_note) => {
249
+ const note = _note;
250
+ return words(note.commit.scope && bold(`${note.commit.scope}:`), note.commit.subject, note.commit.hash && `(${link(note.commit.shortHash, formatCommitUrl(context, note.commit))})`);
251
+ })), newline(2)), each(commitGroups, (group) => segments(group.title && heading(3, group.title), list(group.commits, (commit) => commitPartial(context, commit))), newline(2)), footerPartial(context));
252
+ };
287
253
  const pkgDir = getPkgDir();
288
254
  const generator = new ConventionalChangelog(pkgDir).readPackage().config(preset).options({ releaseCount: 1 }).commits({ path: "." });
289
255
  if (tagPrefix) generator.tags({ prefix: tagPrefix });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitejs/release-scripts",
3
- "version": "1.7.1",
3
+ "version": "1.8.0",
4
4
  "description": "@vitejs release scripts",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -20,24 +20,25 @@
20
20
  "release": "node scripts/release.ts"
21
21
  },
22
22
  "dependencies": {
23
- "conventional-changelog": "^7.2.0",
24
- "conventional-changelog-conventionalcommits": "^9.3.1",
23
+ "@conventional-changelog/template": "^1.2.1",
24
+ "conventional-changelog": "^8.0.1",
25
+ "conventional-changelog-conventionalcommits": "^10.2.1",
25
26
  "mri": "^1.2.0",
26
27
  "picocolors": "^1.1.1",
27
28
  "prompts": "^2.4.2",
28
- "publint": "^0.3.20",
29
- "semver": "^7.8.0",
30
- "tinyexec": "^1.1.2"
29
+ "publint": "^0.3.21",
30
+ "semver": "^7.8.5",
31
+ "tinyexec": "^1.2.4"
31
32
  },
32
33
  "devDependencies": {
33
- "@types/node": "^24.12.3",
34
+ "@types/node": "^24.13.2",
34
35
  "@types/prompts": "^2.4.9",
35
36
  "@types/semver": "^7.7.1",
36
- "fs-fixture": "^2.13.0",
37
- "oxfmt": "^0.48.0",
38
- "rolldown": "^1.0.0",
37
+ "fs-fixture": "^2.14.0",
38
+ "oxfmt": "^0.58.0",
39
+ "rolldown": "^1.1.4",
39
40
  "typescript": "^6.0.3",
40
- "vitest": "^4.1.5"
41
+ "vitest": "^4.1.10"
41
42
  },
42
- "packageManager": "pnpm@10.33.4"
43
+ "packageManager": "pnpm@11.10.0"
43
44
  }