@qualcomm-ui/changesets-cli 1.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.
package/LICENSE.txt ADDED
@@ -0,0 +1,31 @@
1
+ Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
2
+
3
+ Redistribution and use in source and binary forms, with or without
4
+ modification, are permitted (subject to the limitations in the
5
+ disclaimer below) provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright
8
+ notice, this list of conditions and the following disclaimer.
9
+
10
+ * Redistributions in binary form must reproduce the above
11
+ copyright notice, this list of conditions and the following
12
+ disclaimer in the documentation and/or other materials provided
13
+ with the distribution.
14
+
15
+ * Neither the name of Qualcomm Technologies, Inc. nor the names of its
16
+ contributors may be used to endorse or promote products derived
17
+ from this software without specific prior written permission.
18
+
19
+ NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
20
+ GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
21
+ HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
22
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
23
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24
+ IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
25
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
27
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
29
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
31
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,106 @@
1
+ # @qualcomm-ui/changesets-cli
2
+
3
+ Changeset automation CLI for conventional commits.
4
+
5
+ This package streamlines the release process for monorepos by converting [conventional commits](https://www.conventionalcommits.org/) into [changesets](https://github.com/changesets/changesets), managing versioning, formatting changelogs, and generating combined release notes.
6
+
7
+ ## Installation
8
+
9
+ ```sh
10
+ pnpm add -D @qualcomm-ui/changesets-cli
11
+ ```
12
+
13
+ ## Commands
14
+
15
+ ### `prep-release`
16
+
17
+ Runs the full release-prep pipeline sequentially:
18
+
19
+ 1. Generate changesets from conventional commits
20
+ 2. Bump versions and generate changelogs
21
+ 3. Consolidate changelog formatting
22
+ 4. Generate combined release notes and write to a temporary file
23
+
24
+ ```sh
25
+ qui-changesets prep-release [options]
26
+ ```
27
+
28
+ | Option | Description | Default |
29
+ | ----------------------------- | ----------------------------------------------------------------------------- | ------------------------ |
30
+ | `--in-steps` | Pause after each step and wait for confirmation | `false` |
31
+ | `--from-release-tags` | Diff each package from its most recent release tag instead of the base branch | `false` |
32
+ | `--include-commit-links` | Embed commit hashes in changeset summaries for changelog links | `false` |
33
+ | `--package-manager <command>` | Package manager command to use for `changeset version` | `pnpm` |
34
+ | `--config <path>` | Path to the changesets config file, relative to the project root | `.changeset/config.json` |
35
+
36
+ ### `changeset-generate`
37
+
38
+ Generates changesets from conventional commits without running the full pipeline.
39
+
40
+ ```sh
41
+ qui-changesets changeset-generate [options]
42
+ ```
43
+
44
+ | Option | Description | Default |
45
+ | ------------------------ | ----------------------------------------------------------------------------- | ------------------------ |
46
+ | `--from-release-tags` | Diff each package from its most recent release tag instead of the base branch | `false` |
47
+ | `--include-commit-links` | Embed commit hashes in changeset summaries for changelog links | `false` |
48
+ | `--config <path>` | Path to the changesets config file, relative to the project root | `.changeset/config.json` |
49
+
50
+ ### `consolidate-changelogs`
51
+
52
+ Normalizes and reformats all changed `CHANGELOG.md` files into a consistent structure.
53
+
54
+ ```sh
55
+ qui-changesets consolidate-changelogs
56
+ ```
57
+
58
+ ### `generate-release-notes`
59
+
60
+ Generates combined release notes from changed package changelogs, separating substantive changes from dependency-only updates.
61
+
62
+ ```sh
63
+ qui-changesets generate-release-notes
64
+ ```
65
+
66
+ ### `check-versions`
67
+
68
+ Checks which packages have newer local versions than what is published on npm. Sets a `should-publish` GitHub Actions output.
69
+
70
+ ```sh
71
+ qui-changesets check-versions [options]
72
+ ```
73
+
74
+ | Option | Description | Default |
75
+ | ----------------- | ---------------------------------------------------------------- | ------------------------ |
76
+ | `--config <path>` | Path to the changesets config file, relative to the project root | `.changeset/config.json` |
77
+
78
+ ### `create-github-releases`
79
+
80
+ Creates GitHub releases for published packages by parsing their changelogs.
81
+
82
+ ```sh
83
+ qui-changesets create-github-releases [options]
84
+ ```
85
+
86
+ | Option | Description | Default |
87
+ | --------------------- | ---------------------------------------------------------------------------------- | ------------------------ |
88
+ | `--token <token>` | GitHub token for authentication (falls back to `TOKEN` or `GITHUB_TOKEN` env vars) | |
89
+ | `--repo <owner/repo>` | GitHub repository in `owner/repo` format | Derived from git remote |
90
+ | `--config <path>` | Path to the changesets config file, relative to the project root | `.changeset/config.json` |
91
+
92
+ ## Programmatic API
93
+
94
+ The package also exports core functions for use in scripts:
95
+
96
+ ```ts
97
+ import {
98
+ conventionalCommitChangeset,
99
+ consolidateChangelogs,
100
+ generateReleaseNotes,
101
+ } from "@qualcomm-ui/changesets-cli"
102
+ ```
103
+
104
+ ## License
105
+
106
+ Licensed under the [BSD-3-Clause-Clear License](https://spdx.org/licenses/BSD-3-Clause-Clear.html).
@@ -0,0 +1,92 @@
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);
27
+ 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"
39
+ };
40
+ 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).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
+ }
90
+ };
91
+ var changelog_formatter_default = changelogFunctions;
92
+ //# sourceMappingURL=changelog-formatter.cjs.map
@@ -0,0 +1,7 @@
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}\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.map((d) => d.name).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;AAgBA,IAAM,UAAkC;AAAA,EACtC,OAAO;AAAA,EACP,OAAO;AAAA,EACP,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AAAA,EACN,UAAU;AAAA,EACV,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AACR;AAEA,IAAM,qBAAqB;AAAA,EACzB,0BAA0B,CACxB,aACA,qBACA,YACG;AACH,QAAI,CAAC,QAAQ,MAAM;AACjB,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AACA,QAAI,oBAAoB,WAAW,GAAG;AACpC,aAAO;AAAA,IACT;AAEA,UAAM,OAAO,oBAAoB,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,IAAI;AAC7D,WAAO;AAAA,mCAA8D,IAAI;AAAA,EAC3E;AAAA,EAEA,gBAAgB,CACd,WACA,OACA,YACG;AACH,QAAI,CAAC,SAAS,MAAM;AAClB,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,QAAI;AAEJ,UAAM,iBAAiB,UAAU,QAC9B,MAAM,IAAI,EACV,OAAO,CAACA,UAAS,CAACA,MAAK,KAAK,EAAE,YAAY,EAAE,WAAW,gBAAgB,CAAC,EACxE,KAAK,IAAI,EACT,QAAQ,4BAA4B,CAAC,GAAGC,YAAW;AAClD,0BAAoBA;AACpB,aAAO;AAAA,IACT,CAAC,EACA,KAAK;AAER,UAAM,UAAU,eAAe,MAAM,YAAY;AACjD,UAAM,WAAW,UAAU,CAAC;AAE5B,UAAM,YAAY,eAAe;AAAA,MAC/B;AAAA,IACF;AACA,UAAM,mBAAmB,YAAY,CAAC,GAAG,YAAY;AACrD,UAAM,QAAQ,YAAY,CAAC,GAAG,QAAQ,KAAK,EAAE,EAAE,QAAQ,KAAK,EAAE;AAC9D,UAAM,aACJ,eAAe,SAAS,IAAI,KAC5B,eAAe,YAAY,EAAE,SAAS,UAAU;AAClD,UAAM,UAAU,eACb;AAAA,MACC;AAAA,MACA;AAAA,IACF,EACC,QAAQ,mBAAmB,EAAE,EAC7B,KAAK;AAER,UAAM,UAAU,aACZ,qBACA,QAAQ,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
+ }
@@ -0,0 +1,16 @@
1
+ interface ChangesetInfo {
2
+ commit?: string;
3
+ summary: string;
4
+ }
5
+ interface DependencyUpdated {
6
+ name: string;
7
+ }
8
+ interface ChangelogOptions {
9
+ repo: string;
10
+ }
11
+ declare const changelogFunctions: {
12
+ getDependencyReleaseLine: (_changesets: unknown, dependenciesUpdated: DependencyUpdated[], options: ChangelogOptions) => string;
13
+ getReleaseLine: (changeset: ChangesetInfo, _type: string, options: ChangelogOptions) => string;
14
+ };
15
+ export default changelogFunctions;
16
+ //# sourceMappingURL=changelog-formatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"changelog-formatter.d.ts","sourceRoot":"","sources":["../src/changelog-formatter.ts"],"names":[],"mappings":"AAGA,UAAU,aAAa;IACrB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,UAAU,iBAAiB;IACzB,IAAI,EAAE,MAAM,CAAA;CACb;AAED,UAAU,gBAAgB;IACxB,IAAI,EAAE,MAAM,CAAA;CACb;AAgBD,QAAA,MAAM,kBAAkB;4CAEP,OAAO,uBACC,iBAAiB,EAAE,WAC/B,gBAAgB;gCAgBd,aAAa,SACjB,MAAM,WACJ,gBAAgB;CAyD5B,CAAA;AAED,eAAe,kBAAkB,CAAA"}
@@ -0,0 +1,4 @@
1
+ export declare function checkVersions(options?: {
2
+ configPath?: string;
3
+ }): Promise<void>;
4
+ //# sourceMappingURL=check-versions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-versions.d.ts","sourceRoot":"","sources":["../src/check-versions.ts"],"names":[],"mappings":"AAqCA,wBAAsB,aAAa,CAAC,OAAO,CAAC,EAAE;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAC,iBA2ClE"}