@qualcomm-ui/changesets-cli 1.2.0 → 2.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.
@@ -1,92 +1,47 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
-
21
- // src/changelog-formatter.ts
22
- var changelog_formatter_exports = {};
23
- __export(changelog_formatter_exports, {
24
- default: () => changelog_formatter_default
25
- });
26
- module.exports = __toCommonJS(changelog_formatter_exports);
1
+ //#region src/changelog-formatter.ts
27
2
  var typeMap = {
28
- build: "Build System",
29
- chore: "Miscellaneous Chores",
30
- ci: "Continuous Integration",
31
- docs: "Documentation",
32
- feat: "Features",
33
- fix: "Bug Fixes",
34
- perf: "Performance Improvements",
35
- refactor: "Code Refactoring",
36
- style: "Styles",
37
- styles: "Styles",
38
- test: "Tests"
3
+ build: "Build System",
4
+ chore: "Miscellaneous Chores",
5
+ ci: "Continuous Integration",
6
+ docs: "Documentation",
7
+ feat: "Features",
8
+ fix: "Bug Fixes",
9
+ perf: "Performance Improvements",
10
+ refactor: "Code Refactoring",
11
+ style: "Styles",
12
+ styles: "Styles",
13
+ test: "Tests"
39
14
  };
40
15
  var changelogFunctions = {
41
- getDependencyReleaseLine: (_changesets, dependenciesUpdated, options) => {
42
- if (!options.repo) {
43
- throw new Error(
44
- 'Please provide a repo to this changelog generator like this:\n"changelog": ["./changelog.js", { "repo": "org/repo" }]'
45
- );
46
- }
47
- if (dependenciesUpdated.length === 0) {
48
- return "";
49
- }
50
- const deps = dependenciesUpdated.map((d) => `${d.name}@${d.newVersion}`).join(", ");
51
- return `### Miscellaneous Chores
52
- * **deps:** update dependencies [${deps}]`;
53
- },
54
- getReleaseLine: (changeset, _type, options) => {
55
- if (!options?.repo) {
56
- throw new Error(
57
- 'Please provide a repo to this changelog generator like this:\n"changelog": ["./changelog.js", { "repo": "org/repo" }]'
58
- );
59
- }
60
- let commitFromSummary;
61
- const cleanedSummary = changeset.summary.split("\n").filter((line2) => !line2.trim().toLowerCase().startsWith("signed-off-by:")).join("\n").replace(/^\s*commit:\s*([^\s]+)/im, (_, commit2) => {
62
- commitFromSummary = commit2;
63
- return "";
64
- }).trim();
65
- const prMatch = cleanedSummary.match(/\(#(\d+)\)/);
66
- const prNumber = prMatch?.[1];
67
- const typeMatch = cleanedSummary.match(
68
- /^(feat|fix|refactor|chore|perf|test|docs|styles?|ci|build)\s*(\(.+?\))?!?:\s*/i
69
- );
70
- const conventionalType = typeMatch?.[1]?.toLowerCase();
71
- const scope = typeMatch?.[2]?.replace("(", "").replace(")", "");
72
- const isBreaking = cleanedSummary.includes("!:") || cleanedSummary.toLowerCase().includes("breaking");
73
- const summary = cleanedSummary.replace(
74
- /^(feat|fix|refactor|chore|perf|test|docs|styles?|ci|build)\s*(\(.+?\))?!?:\s*/i,
75
- ""
76
- ).replace(/\s*\(#\d+\)\s*$/, "").trim();
77
- const section = isBreaking ? "BREAKING CHANGES" : typeMap[conventionalType ?? ""] || "Miscellaneous";
78
- let line = `### ${section}
79
- * ${scope ? `[${scope}]: ` : ""}${summary}`;
80
- if (prNumber) {
81
- line += ` ([#${prNumber}](${options.repo}/issues/${prNumber}))`;
82
- }
83
- const commit = commitFromSummary || changeset.commit;
84
- if (commit) {
85
- const shortCommit = commit.slice(0, 7);
86
- line += ` ([${shortCommit}](${options.repo}/commit/${commit}))`;
87
- }
88
- return line;
89
- }
16
+ getDependencyReleaseLine: (_changesets, dependenciesUpdated, options) => {
17
+ if (!options.repo) throw new Error("Please provide a repo to this changelog generator like this:\n\"changelog\": [\"./changelog.js\", { \"repo\": \"org/repo\" }]");
18
+ if (dependenciesUpdated.length === 0) return "";
19
+ return `### Miscellaneous Chores\n* **deps:** update dependencies [${dependenciesUpdated.map((d) => `${d.name}@${d.newVersion}`).join(", ")}]`;
20
+ },
21
+ getReleaseLine: (changeset, _type, options) => {
22
+ if (!options?.repo) throw new Error("Please provide a repo to this changelog generator like this:\n\"changelog\": [\"./changelog.js\", { \"repo\": \"org/repo\" }]");
23
+ let commitFromSummary;
24
+ const cleanedSummary = changeset.summary.split("\n").filter((line) => !line.trim().toLowerCase().startsWith("signed-off-by:")).join("\n").replace(/^\s*commit:\s*([^\s]+)/im, (_, commit) => {
25
+ commitFromSummary = commit;
26
+ return "";
27
+ }).trim();
28
+ const prNumber = cleanedSummary.match(/\(#(\d+)\)/)?.[1];
29
+ const typeMatch = cleanedSummary.match(/^(feat|fix|refactor|chore|perf|test|docs|styles?|ci|build)\s*(\(.+?\))?!?:\s*/i);
30
+ const conventionalType = typeMatch?.[1]?.toLowerCase();
31
+ const scope = typeMatch?.[2]?.replace("(", "").replace(")", "");
32
+ const isBreaking = cleanedSummary.includes("!:") || cleanedSummary.toLowerCase().includes("breaking");
33
+ const summary = cleanedSummary.replace(/^(feat|fix|refactor|chore|perf|test|docs|styles?|ci|build)\s*(\(.+?\))?!?:\s*/i, "").replace(/\s*\(#\d+\)\s*$/, "").trim();
34
+ let line = `### ${isBreaking ? "BREAKING CHANGES" : typeMap[conventionalType ?? ""] || "Miscellaneous"}\n* ${scope ? `[${scope}]: ` : ""}${summary}`;
35
+ if (prNumber) line += ` ([#${prNumber}](${options.repo}/issues/${prNumber}))`;
36
+ const commit = commitFromSummary || changeset.commit;
37
+ if (commit) {
38
+ const shortCommit = commit.slice(0, 7);
39
+ line += ` ([${shortCommit}](${options.repo}/commit/${commit}))`;
40
+ }
41
+ return line;
42
+ }
90
43
  };
91
- var changelog_formatter_default = changelogFunctions;
92
- //# sourceMappingURL=changelog-formatter.cjs.map
44
+ //#endregion
45
+ module.exports = changelogFunctions;
46
+
47
+ //# sourceMappingURL=changelog-formatter.cjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/changelog-formatter.ts"],
4
- "sourcesContent": ["// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\ninterface ChangesetInfo {\n commit?: string\n summary: string\n}\n\ninterface DependencyUpdated {\n name: string\n newVersion: string\n}\n\ninterface ChangelogOptions {\n repo: string\n}\n\nconst typeMap: Record<string, string> = {\n build: \"Build System\",\n chore: \"Miscellaneous Chores\",\n ci: \"Continuous Integration\",\n docs: \"Documentation\",\n feat: \"Features\",\n fix: \"Bug Fixes\",\n perf: \"Performance Improvements\",\n refactor: \"Code Refactoring\",\n style: \"Styles\",\n styles: \"Styles\",\n test: \"Tests\",\n}\n\nconst changelogFunctions = {\n getDependencyReleaseLine: (\n _changesets: unknown,\n dependenciesUpdated: DependencyUpdated[],\n options: ChangelogOptions,\n ) => {\n if (!options.repo) {\n throw new Error(\n 'Please provide a repo to this changelog generator like this:\\n\"changelog\": [\"./changelog.js\", { \"repo\": \"org/repo\" }]',\n )\n }\n if (dependenciesUpdated.length === 0) {\n return \"\"\n }\n\n const deps = dependenciesUpdated\n // TODO: link to changelog?\n .map((d) => `${d.name}@${d.newVersion}`)\n .join(\", \")\n return `### Miscellaneous Chores\\n* **deps:** update dependencies [${deps}]`\n },\n\n getReleaseLine: (\n changeset: ChangesetInfo,\n _type: string,\n options: ChangelogOptions,\n ) => {\n if (!options?.repo) {\n throw new Error(\n 'Please provide a repo to this changelog generator like this:\\n\"changelog\": [\"./changelog.js\", { \"repo\": \"org/repo\" }]',\n )\n }\n\n let commitFromSummary: string | undefined\n\n const cleanedSummary = changeset.summary\n .split(\"\\n\")\n .filter((line) => !line.trim().toLowerCase().startsWith(\"signed-off-by:\"))\n .join(\"\\n\")\n .replace(/^\\s*commit:\\s*([^\\s]+)/im, (_, commit) => {\n commitFromSummary = commit\n return \"\"\n })\n .trim()\n\n const prMatch = cleanedSummary.match(/\\(#(\\d+)\\)/)\n const prNumber = prMatch?.[1]\n\n const typeMatch = cleanedSummary.match(\n /^(feat|fix|refactor|chore|perf|test|docs|styles?|ci|build)\\s*(\\(.+?\\))?!?:\\s*/i,\n )\n const conventionalType = typeMatch?.[1]?.toLowerCase()\n const scope = typeMatch?.[2]?.replace(\"(\", \"\").replace(\")\", \"\")\n const isBreaking =\n cleanedSummary.includes(\"!:\") ||\n cleanedSummary.toLowerCase().includes(\"breaking\")\n const summary = cleanedSummary\n .replace(\n /^(feat|fix|refactor|chore|perf|test|docs|styles?|ci|build)\\s*(\\(.+?\\))?!?:\\s*/i,\n \"\",\n )\n .replace(/\\s*\\(#\\d+\\)\\s*$/, \"\")\n .trim()\n\n const section = isBreaking\n ? \"BREAKING CHANGES\"\n : typeMap[conventionalType ?? \"\"] || \"Miscellaneous\"\n\n let line = `### ${section}\\n* ${scope ? `[${scope}]: ` : \"\"}${summary}`\n\n if (prNumber) {\n line += ` ([#${prNumber}](${options.repo}/issues/${prNumber}))`\n }\n\n const commit = commitFromSummary || changeset.commit\n if (commit) {\n const shortCommit = commit.slice(0, 7)\n line += ` ([${shortCommit}](${options.repo}/commit/${commit}))`\n }\n\n return line\n },\n}\n\nexport default changelogFunctions\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBA,IAAM,UAAkC;AAAA,EACtC,OAAO;AAAA,EACP,OAAO;AAAA,EACP,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;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Q,oBAAoB,EAAE,KAAK;AAEvC,QAAI,OAAO,OAAO,OAAO;AAAA,IAAO,QAAQ,IAAI,KAAK,QAAQ,EAAE,GAAG,OAAO;AAErE,QAAI,UAAU;AACZ,cAAQ,OAAO,QAAQ,KAAK,QAAQ,IAAI,WAAW,QAAQ;AAAA,IAC7D;AAEA,UAAM,SAAS,qBAAqB,UAAU;AAC9C,QAAI,QAAQ;AACV,YAAM,cAAc,OAAO,MAAM,GAAG,CAAC;AACrC,cAAQ,MAAM,WAAW,KAAK,QAAQ,IAAI,WAAW,MAAM;AAAA,IAC7D;AAEA,WAAO;AAAA,EACT;AACF;AAEA,IAAO,8BAAQ;",
6
- "names": ["line", "commit"]
7
- }
1
+ {"version":3,"file":"changelog-formatter.cjs","names":[],"sources":["../src/changelog-formatter.ts"],"sourcesContent":["// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\ninterface ChangesetInfo {\n commit?: string\n summary: string\n}\n\ninterface DependencyUpdated {\n name: string\n newVersion: string\n}\n\ninterface ChangelogOptions {\n repo: string\n}\n\nconst typeMap: Record<string, string> = {\n build: \"Build System\",\n chore: \"Miscellaneous Chores\",\n ci: \"Continuous Integration\",\n docs: \"Documentation\",\n feat: \"Features\",\n fix: \"Bug Fixes\",\n perf: \"Performance Improvements\",\n refactor: \"Code Refactoring\",\n style: \"Styles\",\n styles: \"Styles\",\n test: \"Tests\",\n}\n\nconst changelogFunctions = {\n getDependencyReleaseLine: (\n _changesets: unknown,\n dependenciesUpdated: DependencyUpdated[],\n options: ChangelogOptions,\n ) => {\n if (!options.repo) {\n throw new Error(\n 'Please provide a repo to this changelog generator like this:\\n\"changelog\": [\"./changelog.js\", { \"repo\": \"org/repo\" }]',\n )\n }\n if (dependenciesUpdated.length === 0) {\n return \"\"\n }\n\n const deps = dependenciesUpdated\n // TODO: link to changelog?\n .map((d) => `${d.name}@${d.newVersion}`)\n .join(\", \")\n return `### Miscellaneous Chores\\n* **deps:** update dependencies [${deps}]`\n },\n\n getReleaseLine: (\n changeset: ChangesetInfo,\n _type: string,\n options: ChangelogOptions,\n ) => {\n if (!options?.repo) {\n throw new Error(\n 'Please provide a repo to this changelog generator like this:\\n\"changelog\": [\"./changelog.js\", { \"repo\": \"org/repo\" }]',\n )\n }\n\n let commitFromSummary: string | undefined\n\n const cleanedSummary = changeset.summary\n .split(\"\\n\")\n .filter((line) => !line.trim().toLowerCase().startsWith(\"signed-off-by:\"))\n .join(\"\\n\")\n .replace(/^\\s*commit:\\s*([^\\s]+)/im, (_, commit) => {\n commitFromSummary = commit\n return \"\"\n })\n .trim()\n\n const prMatch = cleanedSummary.match(/\\(#(\\d+)\\)/)\n const prNumber = prMatch?.[1]\n\n const typeMatch = cleanedSummary.match(\n /^(feat|fix|refactor|chore|perf|test|docs|styles?|ci|build)\\s*(\\(.+?\\))?!?:\\s*/i,\n )\n const conventionalType = typeMatch?.[1]?.toLowerCase()\n const scope = typeMatch?.[2]?.replace(\"(\", \"\").replace(\")\", \"\")\n const isBreaking =\n cleanedSummary.includes(\"!:\") ||\n cleanedSummary.toLowerCase().includes(\"breaking\")\n const summary = cleanedSummary\n .replace(\n /^(feat|fix|refactor|chore|perf|test|docs|styles?|ci|build)\\s*(\\(.+?\\))?!?:\\s*/i,\n \"\",\n )\n .replace(/\\s*\\(#\\d+\\)\\s*$/, \"\")\n .trim()\n\n const section = isBreaking\n ? \"BREAKING CHANGES\"\n : typeMap[conventionalType ?? \"\"] || \"Miscellaneous\"\n\n let line = `### ${section}\\n* ${scope ? `[${scope}]: ` : \"\"}${summary}`\n\n if (prNumber) {\n line += ` ([#${prNumber}](${options.repo}/issues/${prNumber}))`\n }\n\n const commit = commitFromSummary || changeset.commit\n if (commit) {\n const shortCommit = commit.slice(0, 7)\n line += ` ([${shortCommit}](${options.repo}/commit/${commit}))`\n }\n\n return line\n },\n}\n\nexport default changelogFunctions\n"],"mappings":";AAiBA,IAAM,UAAkC;CACtC,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