@qualcomm-ui/changesets-cli 1.0.1 → 1.0.2

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/README.md CHANGED
@@ -25,13 +25,13 @@ Runs the full release-prep pipeline sequentially:
25
25
  qui-changesets prep-release [options]
26
26
  ```
27
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` |
28
+ | Option | Description | Default |
29
+ | ----------------------------- | ----------------------------------------------------------------------------------- | ------------------------ |
30
+ | `--in-steps` | Pause after each step and wait for confirmation | `false` |
31
+ | `--commit-sha <sha>` | Diff each package against the target commit instead of the repository's base branch | |
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
35
 
36
36
  ### `changeset-generate`
37
37
 
@@ -41,11 +41,11 @@ Generates changesets from conventional commits without running the full pipeline
41
41
  qui-changesets changeset-generate [options]
42
42
  ```
43
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` |
44
+ | Option | Description | Default |
45
+ | ------------------------ | ----------------------------------------------------------------------------------- | ------------------------ |
46
+ | `--commit-sha` | Diff each package against the target commit instead of the repository's 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
49
 
50
50
  ### `consolidate-changelogs`
51
51
 
package/dist/cli.cjs CHANGED
@@ -162004,42 +162004,14 @@ commit: ${hash.slice(0, 7)}` : conventionalCommit
162004
162004
  function gitFetch(branch) {
162005
162005
  (0, import_node_child_process3.execSync)(`git fetch origin ${branch}`);
162006
162006
  }
162007
- function getCurrentBranch() {
162008
- return (0, import_node_child_process3.execSync)("git rev-parse --abbrev-ref HEAD").toString().trim();
162007
+ function getCommitsSinceCommit(sha) {
162008
+ return (0, import_node_child_process3.execSync)(`git rev-list ${sha}..HEAD`).toString().split("\n").filter(Boolean).reverse();
162009
162009
  }
162010
- function getCommitsSinceRef(branch) {
162010
+ function getCommitsSinceBranch(branch) {
162011
162011
  gitFetch(branch);
162012
- const currentBranch = getCurrentBranch();
162013
- let sinceRef = `origin/${branch}`;
162014
- if (currentBranch === branch) {
162015
- try {
162016
- sinceRef = (0, import_node_child_process3.execSync)("git describe --tags --abbrev=0").toString();
162017
- } catch (e) {
162018
- console.log(
162019
- "No git tags found, using repo's first commit for automated change detection. Note: this may take a while."
162020
- );
162021
- sinceRef = (0, import_node_child_process3.execSync)("git rev-list --max-parents=0 HEAD").toString();
162022
- }
162023
- }
162024
- sinceRef = sinceRef.trim();
162012
+ const sinceRef = `origin/${branch}`;
162025
162013
  return (0, import_node_child_process3.execSync)(`git rev-list ${sinceRef}..HEAD`).toString().split("\n").filter(Boolean).reverse();
162026
162014
  }
162027
- function tagExists(tag) {
162028
- try {
162029
- (0, import_node_child_process3.execSync)(`git rev-parse --verify refs/tags/${tag}`, { stdio: "pipe" });
162030
- return true;
162031
- } catch {
162032
- return false;
162033
- }
162034
- }
162035
- function getCommitsSincePackageRelease(packageName, version, baseBranch) {
162036
- const releaseTag = `${packageName}@${version}`;
162037
- if (tagExists(releaseTag)) {
162038
- return (0, import_node_child_process3.execSync)(`git rev-list ${releaseTag}..HEAD`).toString().split("\n").filter(Boolean).reverse();
162039
- }
162040
- gitFetch(baseBranch);
162041
- return (0, import_node_child_process3.execSync)(`git rev-list origin/${baseBranch}..HEAD`).toString().split("\n").filter(Boolean).reverse();
162042
- }
162043
162015
  function compareChangeSet(a, b) {
162044
162016
  return a.summary.replace(/\n$/, "") === b.summary && JSON.stringify(a.releases) === JSON.stringify(b.releases);
162045
162017
  }
@@ -162072,46 +162044,18 @@ async function conventionalCommitChangeset(options, cwd = process.cwd()) {
162072
162044
  (pkg) => Boolean(pkg.packageJson.version) && !ignored.includes(pkg.packageJson.name)
162073
162045
  );
162074
162046
  const { baseBranch = "main" } = changesetConfig;
162075
- const { fromReleaseTags, includeCommitLinks } = options;
162076
- let changesets;
162077
- if (fromReleaseTags) {
162078
- const allChangesets = packages.flatMap((pkg) => {
162079
- const packageName = pkg.packageJson.name;
162080
- const version = pkg.packageJson.version;
162081
- if (!packageName || !version) {
162082
- return [];
162083
- }
162084
- const commitsSinceRelease = getCommitsSincePackageRelease(
162085
- packageName,
162086
- version,
162087
- baseBranch
162088
- );
162089
- const commitsWithMessages = getCommitsWithMessages(commitsSinceRelease);
162090
- const changelogMessages = translateCommitsToConventionalCommitMessages(commitsWithMessages);
162091
- return conventionalMessagesWithCommitsToChangesets(changelogMessages, {
162092
- ignoredFiles: ignored,
162093
- includeCommitLinks,
162094
- packages: [pkg]
162095
- });
162096
- });
162097
- changesets = allChangesets.filter(
162098
- (changeset, index, self2) => index === self2.findIndex(
162099
- (c) => c.summary === changeset.summary && JSON.stringify(c.releases) === JSON.stringify(changeset.releases)
162100
- )
162101
- );
162102
- } else {
162103
- const commitsSinceBase = getCommitsSinceRef(baseBranch);
162104
- const commitsWithMessages = getCommitsWithMessages(commitsSinceBase);
162105
- const changelogMessagesWithAssociatedCommits = translateCommitsToConventionalCommitMessages(commitsWithMessages);
162106
- changesets = conventionalMessagesWithCommitsToChangesets(
162107
- changelogMessagesWithAssociatedCommits,
162108
- {
162109
- ignoredFiles: ignored,
162110
- includeCommitLinks,
162111
- packages
162112
- }
162113
- );
162114
- }
162047
+ const { commitSha, includeCommitLinks } = options;
162048
+ const commitsSinceRef = commitSha ? getCommitsSinceCommit(commitSha) : getCommitsSinceBranch(baseBranch);
162049
+ const commitsWithMessages = getCommitsWithMessages(commitsSinceRef);
162050
+ const changelogMessages = translateCommitsToConventionalCommitMessages(commitsWithMessages);
162051
+ const changesets = conventionalMessagesWithCommitsToChangesets(
162052
+ changelogMessages,
162053
+ {
162054
+ ignoredFiles: ignored,
162055
+ includeCommitLinks,
162056
+ packages
162057
+ }
162058
+ );
162115
162059
  const currentChangesets = await getChangesets(cwd);
162116
162060
  const newChangesets = currentChangesets.length === 0 ? changesets : difference(changesets, currentChangesets);
162117
162061
  await Promise.all(
@@ -162127,8 +162071,8 @@ function buildSteps(options) {
162127
162071
  description: "Generate changesets from conventional commits",
162128
162072
  name: "changeset-generate",
162129
162073
  run: () => conventionalCommitChangeset({
162074
+ commitSha: options.commitSha,
162130
162075
  configPath: options.config,
162131
- fromReleaseTags: options.fromReleaseTags,
162132
162076
  includeCommitLinks: options.includeCommitLinks
162133
162077
  })
162134
162078
  },
@@ -162196,9 +162140,8 @@ program.command("prep-release").description("Run all prep-release steps sequenti
162196
162140
  "Pause after each step and wait for confirmation before continuing",
162197
162141
  false
162198
162142
  ).option(
162199
- "--from-release-tags",
162200
- "Diff each package from its most recent release tag instead of the baseBranch from the changesets config",
162201
- false
162143
+ "--commit-sha <sha>",
162144
+ "Diff each package against the target commit instead of the repository's base branch"
162202
162145
  ).option(
162203
162146
  "--include-commit-links",
162204
162147
  "Embed commit hashes in changeset summaries for changelog links",
@@ -162212,9 +162155,8 @@ program.command("prep-release").description("Run all prep-release steps sequenti
162212
162155
  "Path to the changesets config file, relative to the project root"
162213
162156
  ).action((options) => run(options));
162214
162157
  program.command("changeset-generate").description("Generate changesets from conventional commits").option(
162215
- "--from-release-tags",
162216
- "Diff each package from its most recent release tag instead of the base branch",
162217
- false
162158
+ "--commit-sha <sha>",
162159
+ "Diff each package against the target commit instead of the repository's base branch"
162218
162160
  ).option(
162219
162161
  "--include-commit-links",
162220
162162
  "Embed commit hashes in changeset summaries for changelog links",