@qlover/fe-release 5.0.1 → 5.0.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/dist/cli.cjs CHANGED
@@ -28,7 +28,7 @@ var import_commander = require("commander");
28
28
 
29
29
  // package.json
30
30
  var description = "A tool for releasing front-end projects, supporting multiple release modes and configurations, simplifying the release process and improving efficiency.";
31
- var version = "5.0.1";
31
+ var version = "5.0.4";
32
32
 
33
33
  // src/cli.ts
34
34
  var import_semver = __toESM(require("semver"), 1);
@@ -1662,17 +1662,27 @@ var ChangesetVersion = class extends import_scripts_context4.ScriptPlugin {
1662
1662
  });
1663
1663
  this.context.setWorkspaces(newWorkspaces);
1664
1664
  }
1665
+ printWorksapces() {
1666
+ const workspaces = this.context.workspaces;
1667
+ this.logger.info(
1668
+ `ChangesetVersion Workspaces (${workspaces?.length}):
1669
+ ${workspaces?.map((workspace) => workspace.toString()).join("\n")}`
1670
+ );
1671
+ }
1665
1672
  async onSuccess() {
1666
1673
  if (this.mode === "publish") {
1667
1674
  await this.runChangesetPublish();
1675
+ this.printWorksapces();
1668
1676
  return;
1669
1677
  }
1670
1678
  if (this.mode === "both") {
1671
1679
  await this.runVersionFlow();
1672
1680
  await this.runChangesetPublish();
1681
+ this.printWorksapces();
1673
1682
  return;
1674
1683
  }
1675
1684
  await this.runVersionFlow();
1685
+ this.printWorksapces();
1676
1686
  }
1677
1687
  logDryRun(message) {
1678
1688
  this.logger.info(`[dry-run] ${message}`);
@@ -1711,18 +1721,59 @@ var ChangesetVersion = class extends import_scripts_context4.ScriptPlugin {
1711
1721
  this.syncWorkspaces(this.context.workspaces ?? workspaces);
1712
1722
  }
1713
1723
  async runChangesetPublish() {
1724
+ const workspaces = this.context.workspaces ?? [];
1714
1725
  if (this.context.dryRun) {
1715
1726
  this.logDryRun("Would run: changeset publish, publish packages and tags");
1727
+ const preview = this.mergeWorkspaces(workspaces);
1728
+ this.context.setWorkspaces(preview);
1729
+ const previewTags = preview.filter(
1730
+ (workspace) => this.shouldProcessWorkspace(workspace) && !workspace.dependencyRelease && workspace.tagName
1731
+ ).map((workspace) => workspace.tagName);
1732
+ this.logDryRun(
1733
+ previewTags.length === 0 ? "Would push release tag(s) from workspace.tagName: none" : `Would push release tag(s) from workspace.tagName:
1734
+ ${previewTags.map((tag) => ` ${tag}`).join("\n")}`
1735
+ );
1716
1736
  return;
1717
1737
  }
1718
1738
  await this.step({
1719
1739
  label: "Changeset Publish",
1720
1740
  task: () => this.context.runChangesetsCli("publish")
1721
1741
  });
1722
- const workspaces = this.context.workspaces;
1723
- if (workspaces && workspaces.length > 0) {
1742
+ if (workspaces.length > 0) {
1724
1743
  this.syncWorkspaces(workspaces);
1725
1744
  }
1745
+ await this.step({
1746
+ label: "Push Release Tags",
1747
+ task: () => this.pushWorkspaceReleaseTags(this.context.workspaces ?? workspaces)
1748
+ });
1749
+ }
1750
+ /**
1751
+ * Push release tags from synced workspaces' `tagName` fields.
1752
+ *
1753
+ * `changeset publish` only creates tags locally. After {@link syncWorkspaces},
1754
+ * each publishable workspace should already have `tagName` (e.g. `pkg@1.2.3`).
1755
+ */
1756
+ async pushWorkspaceReleaseTags(workspaces) {
1757
+ const tags = workspaces.filter(
1758
+ (workspace) => this.shouldProcessWorkspace(workspace) && !workspace.dependencyRelease && !!workspace.tagName
1759
+ ).map((workspace) => workspace.tagName);
1760
+ const uniqueTags = [...new Set(tags)];
1761
+ if (uniqueTags.length === 0) {
1762
+ this.logger.warn(
1763
+ "No workspace.tagName found after publish sync; skip tag push"
1764
+ );
1765
+ return;
1766
+ }
1767
+ this.logger.info(
1768
+ `Pushing ${uniqueTags.length} release tag(s) to origin:
1769
+ ${uniqueTags.map((tag) => ` ${tag}`).join("\n")}`
1770
+ );
1771
+ await this.shell.exec([
1772
+ "git",
1773
+ "push",
1774
+ "origin",
1775
+ ...uniqueTags.map((tag) => `"refs/tags/${tag}"`)
1776
+ ]);
1726
1777
  }
1727
1778
  syncWorkspaces(workspaces) {
1728
1779
  let newWorkspaces = this.mergeWorkspaces(workspaces);
@@ -1813,10 +1864,11 @@ ${lines.join("\n")}`
1813
1864
  dependencyReleaseOf: workspace.dependencyReleaseOf,
1814
1865
  lastTag: workspace.lastTag
1815
1866
  });
1816
- if (newWorkspace.newVersion && newWorkspace.newVersion !== newWorkspace.version) {
1867
+ const releaseVersion = newWorkspace.newVersion || newWorkspace.version;
1868
+ if (releaseVersion) {
1817
1869
  newWorkspace.tagName = this.generateTagName({
1818
1870
  ...newWorkspace,
1819
- version: newWorkspace.newVersion
1871
+ version: releaseVersion
1820
1872
  });
1821
1873
  }
1822
1874
  return newWorkspace;
@@ -1935,7 +1987,9 @@ ${lines.join("\n")}`
1935
1987
  getIncrementLabels() {
1936
1988
  const fromConfig = this.context.parameters.workspaces?.changeLabels;
1937
1989
  if (Array.isArray(fromConfig) && fromConfig.length > 0) {
1938
- return fromConfig.filter((label) => typeof label === "string");
1990
+ return fromConfig.filter(
1991
+ (label) => typeof label === "string"
1992
+ );
1939
1993
  }
1940
1994
  return this.readGithubEventLabelNames();
1941
1995
  }
@@ -1950,7 +2004,9 @@ ${lines.join("\n")}`
1950
2004
  if (!Array.isArray(labels)) {
1951
2005
  return [];
1952
2006
  }
1953
- return labels.map((label) => label?.name).filter((name) => typeof name === "string" && name.length > 0);
2007
+ return labels.map((label) => label?.name).filter(
2008
+ (name) => typeof name === "string" && name.length > 0
2009
+ );
1954
2010
  } catch (error) {
1955
2011
  this.logger.debug("Failed to read labels from GITHUB_EVENT_PATH", error);
1956
2012
  return [];
package/dist/cli.js CHANGED
@@ -5,7 +5,7 @@ import { Command } from "commander";
5
5
 
6
6
  // package.json
7
7
  var description = "A tool for releasing front-end projects, supporting multiple release modes and configurations, simplifying the release process and improving efficiency.";
8
- var version = "5.0.1";
8
+ var version = "5.0.4";
9
9
 
10
10
  // src/cli.ts
11
11
  import semver from "semver";
@@ -1642,17 +1642,27 @@ var ChangesetVersion = class extends ScriptPlugin2 {
1642
1642
  });
1643
1643
  this.context.setWorkspaces(newWorkspaces);
1644
1644
  }
1645
+ printWorksapces() {
1646
+ const workspaces = this.context.workspaces;
1647
+ this.logger.info(
1648
+ `ChangesetVersion Workspaces (${workspaces?.length}):
1649
+ ${workspaces?.map((workspace) => workspace.toString()).join("\n")}`
1650
+ );
1651
+ }
1645
1652
  async onSuccess() {
1646
1653
  if (this.mode === "publish") {
1647
1654
  await this.runChangesetPublish();
1655
+ this.printWorksapces();
1648
1656
  return;
1649
1657
  }
1650
1658
  if (this.mode === "both") {
1651
1659
  await this.runVersionFlow();
1652
1660
  await this.runChangesetPublish();
1661
+ this.printWorksapces();
1653
1662
  return;
1654
1663
  }
1655
1664
  await this.runVersionFlow();
1665
+ this.printWorksapces();
1656
1666
  }
1657
1667
  logDryRun(message) {
1658
1668
  this.logger.info(`[dry-run] ${message}`);
@@ -1691,18 +1701,59 @@ var ChangesetVersion = class extends ScriptPlugin2 {
1691
1701
  this.syncWorkspaces(this.context.workspaces ?? workspaces);
1692
1702
  }
1693
1703
  async runChangesetPublish() {
1704
+ const workspaces = this.context.workspaces ?? [];
1694
1705
  if (this.context.dryRun) {
1695
1706
  this.logDryRun("Would run: changeset publish, publish packages and tags");
1707
+ const preview = this.mergeWorkspaces(workspaces);
1708
+ this.context.setWorkspaces(preview);
1709
+ const previewTags = preview.filter(
1710
+ (workspace) => this.shouldProcessWorkspace(workspace) && !workspace.dependencyRelease && workspace.tagName
1711
+ ).map((workspace) => workspace.tagName);
1712
+ this.logDryRun(
1713
+ previewTags.length === 0 ? "Would push release tag(s) from workspace.tagName: none" : `Would push release tag(s) from workspace.tagName:
1714
+ ${previewTags.map((tag) => ` ${tag}`).join("\n")}`
1715
+ );
1696
1716
  return;
1697
1717
  }
1698
1718
  await this.step({
1699
1719
  label: "Changeset Publish",
1700
1720
  task: () => this.context.runChangesetsCli("publish")
1701
1721
  });
1702
- const workspaces = this.context.workspaces;
1703
- if (workspaces && workspaces.length > 0) {
1722
+ if (workspaces.length > 0) {
1704
1723
  this.syncWorkspaces(workspaces);
1705
1724
  }
1725
+ await this.step({
1726
+ label: "Push Release Tags",
1727
+ task: () => this.pushWorkspaceReleaseTags(this.context.workspaces ?? workspaces)
1728
+ });
1729
+ }
1730
+ /**
1731
+ * Push release tags from synced workspaces' `tagName` fields.
1732
+ *
1733
+ * `changeset publish` only creates tags locally. After {@link syncWorkspaces},
1734
+ * each publishable workspace should already have `tagName` (e.g. `pkg@1.2.3`).
1735
+ */
1736
+ async pushWorkspaceReleaseTags(workspaces) {
1737
+ const tags = workspaces.filter(
1738
+ (workspace) => this.shouldProcessWorkspace(workspace) && !workspace.dependencyRelease && !!workspace.tagName
1739
+ ).map((workspace) => workspace.tagName);
1740
+ const uniqueTags = [...new Set(tags)];
1741
+ if (uniqueTags.length === 0) {
1742
+ this.logger.warn(
1743
+ "No workspace.tagName found after publish sync; skip tag push"
1744
+ );
1745
+ return;
1746
+ }
1747
+ this.logger.info(
1748
+ `Pushing ${uniqueTags.length} release tag(s) to origin:
1749
+ ${uniqueTags.map((tag) => ` ${tag}`).join("\n")}`
1750
+ );
1751
+ await this.shell.exec([
1752
+ "git",
1753
+ "push",
1754
+ "origin",
1755
+ ...uniqueTags.map((tag) => `"refs/tags/${tag}"`)
1756
+ ]);
1706
1757
  }
1707
1758
  syncWorkspaces(workspaces) {
1708
1759
  let newWorkspaces = this.mergeWorkspaces(workspaces);
@@ -1793,10 +1844,11 @@ ${lines.join("\n")}`
1793
1844
  dependencyReleaseOf: workspace.dependencyReleaseOf,
1794
1845
  lastTag: workspace.lastTag
1795
1846
  });
1796
- if (newWorkspace.newVersion && newWorkspace.newVersion !== newWorkspace.version) {
1847
+ const releaseVersion = newWorkspace.newVersion || newWorkspace.version;
1848
+ if (releaseVersion) {
1797
1849
  newWorkspace.tagName = this.generateTagName({
1798
1850
  ...newWorkspace,
1799
- version: newWorkspace.newVersion
1851
+ version: releaseVersion
1800
1852
  });
1801
1853
  }
1802
1854
  return newWorkspace;
@@ -1915,7 +1967,9 @@ ${lines.join("\n")}`
1915
1967
  getIncrementLabels() {
1916
1968
  const fromConfig = this.context.parameters.workspaces?.changeLabels;
1917
1969
  if (Array.isArray(fromConfig) && fromConfig.length > 0) {
1918
- return fromConfig.filter((label) => typeof label === "string");
1970
+ return fromConfig.filter(
1971
+ (label) => typeof label === "string"
1972
+ );
1919
1973
  }
1920
1974
  return this.readGithubEventLabelNames();
1921
1975
  }
@@ -1930,7 +1984,9 @@ ${lines.join("\n")}`
1930
1984
  if (!Array.isArray(labels)) {
1931
1985
  return [];
1932
1986
  }
1933
- return labels.map((label) => label?.name).filter((name) => typeof name === "string" && name.length > 0);
1987
+ return labels.map((label) => label?.name).filter(
1988
+ (name) => typeof name === "string" && name.length > 0
1989
+ );
1934
1990
  } catch (error) {
1935
1991
  this.logger.debug("Failed to read labels from GITHUB_EVENT_PATH", error);
1936
1992
  return [];
package/dist/index.cjs CHANGED
@@ -1667,17 +1667,27 @@ var ChangesetVersion = class extends import_scripts_context4.ScriptPlugin {
1667
1667
  });
1668
1668
  this.context.setWorkspaces(newWorkspaces);
1669
1669
  }
1670
+ printWorksapces() {
1671
+ const workspaces = this.context.workspaces;
1672
+ this.logger.info(
1673
+ `ChangesetVersion Workspaces (${workspaces?.length}):
1674
+ ${workspaces?.map((workspace) => workspace.toString()).join("\n")}`
1675
+ );
1676
+ }
1670
1677
  async onSuccess() {
1671
1678
  if (this.mode === "publish") {
1672
1679
  await this.runChangesetPublish();
1680
+ this.printWorksapces();
1673
1681
  return;
1674
1682
  }
1675
1683
  if (this.mode === "both") {
1676
1684
  await this.runVersionFlow();
1677
1685
  await this.runChangesetPublish();
1686
+ this.printWorksapces();
1678
1687
  return;
1679
1688
  }
1680
1689
  await this.runVersionFlow();
1690
+ this.printWorksapces();
1681
1691
  }
1682
1692
  logDryRun(message) {
1683
1693
  this.logger.info(`[dry-run] ${message}`);
@@ -1716,18 +1726,59 @@ var ChangesetVersion = class extends import_scripts_context4.ScriptPlugin {
1716
1726
  this.syncWorkspaces(this.context.workspaces ?? workspaces);
1717
1727
  }
1718
1728
  async runChangesetPublish() {
1729
+ const workspaces = this.context.workspaces ?? [];
1719
1730
  if (this.context.dryRun) {
1720
1731
  this.logDryRun("Would run: changeset publish, publish packages and tags");
1732
+ const preview = this.mergeWorkspaces(workspaces);
1733
+ this.context.setWorkspaces(preview);
1734
+ const previewTags = preview.filter(
1735
+ (workspace) => this.shouldProcessWorkspace(workspace) && !workspace.dependencyRelease && workspace.tagName
1736
+ ).map((workspace) => workspace.tagName);
1737
+ this.logDryRun(
1738
+ previewTags.length === 0 ? "Would push release tag(s) from workspace.tagName: none" : `Would push release tag(s) from workspace.tagName:
1739
+ ${previewTags.map((tag) => ` ${tag}`).join("\n")}`
1740
+ );
1721
1741
  return;
1722
1742
  }
1723
1743
  await this.step({
1724
1744
  label: "Changeset Publish",
1725
1745
  task: () => this.context.runChangesetsCli("publish")
1726
1746
  });
1727
- const workspaces = this.context.workspaces;
1728
- if (workspaces && workspaces.length > 0) {
1747
+ if (workspaces.length > 0) {
1729
1748
  this.syncWorkspaces(workspaces);
1730
1749
  }
1750
+ await this.step({
1751
+ label: "Push Release Tags",
1752
+ task: () => this.pushWorkspaceReleaseTags(this.context.workspaces ?? workspaces)
1753
+ });
1754
+ }
1755
+ /**
1756
+ * Push release tags from synced workspaces' `tagName` fields.
1757
+ *
1758
+ * `changeset publish` only creates tags locally. After {@link syncWorkspaces},
1759
+ * each publishable workspace should already have `tagName` (e.g. `pkg@1.2.3`).
1760
+ */
1761
+ async pushWorkspaceReleaseTags(workspaces) {
1762
+ const tags = workspaces.filter(
1763
+ (workspace) => this.shouldProcessWorkspace(workspace) && !workspace.dependencyRelease && !!workspace.tagName
1764
+ ).map((workspace) => workspace.tagName);
1765
+ const uniqueTags = [...new Set(tags)];
1766
+ if (uniqueTags.length === 0) {
1767
+ this.logger.warn(
1768
+ "No workspace.tagName found after publish sync; skip tag push"
1769
+ );
1770
+ return;
1771
+ }
1772
+ this.logger.info(
1773
+ `Pushing ${uniqueTags.length} release tag(s) to origin:
1774
+ ${uniqueTags.map((tag) => ` ${tag}`).join("\n")}`
1775
+ );
1776
+ await this.shell.exec([
1777
+ "git",
1778
+ "push",
1779
+ "origin",
1780
+ ...uniqueTags.map((tag) => `"refs/tags/${tag}"`)
1781
+ ]);
1731
1782
  }
1732
1783
  syncWorkspaces(workspaces) {
1733
1784
  let newWorkspaces = this.mergeWorkspaces(workspaces);
@@ -1818,10 +1869,11 @@ ${lines.join("\n")}`
1818
1869
  dependencyReleaseOf: workspace.dependencyReleaseOf,
1819
1870
  lastTag: workspace.lastTag
1820
1871
  });
1821
- if (newWorkspace.newVersion && newWorkspace.newVersion !== newWorkspace.version) {
1872
+ const releaseVersion = newWorkspace.newVersion || newWorkspace.version;
1873
+ if (releaseVersion) {
1822
1874
  newWorkspace.tagName = this.generateTagName({
1823
1875
  ...newWorkspace,
1824
- version: newWorkspace.newVersion
1876
+ version: releaseVersion
1825
1877
  });
1826
1878
  }
1827
1879
  return newWorkspace;
@@ -1940,7 +1992,9 @@ ${lines.join("\n")}`
1940
1992
  getIncrementLabels() {
1941
1993
  const fromConfig = this.context.parameters.workspaces?.changeLabels;
1942
1994
  if (Array.isArray(fromConfig) && fromConfig.length > 0) {
1943
- return fromConfig.filter((label) => typeof label === "string");
1995
+ return fromConfig.filter(
1996
+ (label) => typeof label === "string"
1997
+ );
1944
1998
  }
1945
1999
  return this.readGithubEventLabelNames();
1946
2000
  }
@@ -1955,7 +2009,9 @@ ${lines.join("\n")}`
1955
2009
  if (!Array.isArray(labels)) {
1956
2010
  return [];
1957
2011
  }
1958
- return labels.map((label) => label?.name).filter((name) => typeof name === "string" && name.length > 0);
2012
+ return labels.map((label) => label?.name).filter(
2013
+ (name) => typeof name === "string" && name.length > 0
2014
+ );
1959
2015
  } catch (error) {
1960
2016
  this.logger.debug("Failed to read labels from GITHUB_EVENT_PATH", error);
1961
2017
  return [];
package/dist/index.d.ts CHANGED
@@ -763,7 +763,7 @@ interface CommitValue {
763
763
  /** Parsed conventional commit data */
764
764
  commitlint: Commitlint;
765
765
  /** Sub-commits (for merge commits) */
766
- commits: CommitValue[];
766
+ commits?: CommitValue[];
767
767
  /** Associated pull request number */
768
768
  prNumber?: string;
769
769
  }
@@ -839,6 +839,11 @@ interface ChangeLogInterface {
839
839
  * when `ignoreNonUpdatedPackages` is enabled)
840
840
  * - **onSuccess**: run version and/or publish flow based on `mode`
841
841
  *
842
+ * Publish flow (`mode: 'publish'` or second half of `'both'`):
843
+ * 1. Run `changeset publish` (npm publish + local `git tag` only)
844
+ * 2. Sync workspaces from disk so `tagName` is set from the release version
845
+ * 3. Push `workspace.tagName` refs to `origin`
846
+ *
842
847
  * Version flow (`mode: 'version'` or first half of `'both'`):
843
848
  * 1. Write `.changeset/*.md` files for directly changed packages only
844
849
  * 2. Run `changeset version` (optionally with `changelog: false` when `onlyVersion`)
@@ -966,10 +971,18 @@ declare class ChangesetVersion extends ScriptPlugin<ReleaseContext, ChangesetVer
966
971
  */
967
972
  protected validateNpmToken(): Promise<void>;
968
973
  onExec(_context: ReleaseContext): Promise<void>;
974
+ protected printWorksapces(): void;
969
975
  onSuccess(): Promise<void>;
970
976
  protected logDryRun(message: string): void;
971
977
  protected runVersionFlow(): Promise<void>;
972
978
  protected runChangesetPublish(): Promise<void>;
979
+ /**
980
+ * Push release tags from synced workspaces' `tagName` fields.
981
+ *
982
+ * `changeset publish` only creates tags locally. After {@link syncWorkspaces},
983
+ * each publishable workspace should already have `tagName` (e.g. `pkg@1.2.3`).
984
+ */
985
+ protected pushWorkspaceReleaseTags(workspaces: WorkspaceInterface[]): Promise<void>;
973
986
  protected syncWorkspaces(workspaces: WorkspaceInterface[]): void;
974
987
  /**
975
988
  * Rebuild `dependencyRelease` changelogs after source packages have `newVersion`.
@@ -1561,7 +1574,7 @@ type ReleaseReturnValue = {
1561
1574
  * ```
1562
1575
  */
1563
1576
  type DeepPartial<T> = {
1564
- [P in keyof T]?: DeepPartial<T[P]>;
1577
+ [P in keyof T]?: string extends keyof T[P] ? T[P] : T[P] extends object ? DeepPartial<T[P]> : T[P];
1565
1578
  };
1566
1579
  /**
1567
1580
  * Configuration interface for release process
@@ -1587,6 +1600,13 @@ interface ReleaseConfig extends ScriptSharedInterface {
1587
1600
  changesetVersion?: ChangesetVersionProps;
1588
1601
  github?: GithubProps;
1589
1602
  workspaces?: WorkspacesProps;
1603
+ /** Repository name without owner */
1604
+ repoName?: string;
1605
+ /** Repository owner / org / namespace */
1606
+ authorName?: string;
1607
+ releaseEnv?: string;
1608
+ currentBranch?: string;
1609
+ releaseId?: string;
1590
1610
  }
1591
1611
  /**
1592
1612
  * Options interface for release context
package/dist/index.js CHANGED
@@ -1618,17 +1618,27 @@ var ChangesetVersion = class extends ScriptPlugin2 {
1618
1618
  });
1619
1619
  this.context.setWorkspaces(newWorkspaces);
1620
1620
  }
1621
+ printWorksapces() {
1622
+ const workspaces = this.context.workspaces;
1623
+ this.logger.info(
1624
+ `ChangesetVersion Workspaces (${workspaces?.length}):
1625
+ ${workspaces?.map((workspace) => workspace.toString()).join("\n")}`
1626
+ );
1627
+ }
1621
1628
  async onSuccess() {
1622
1629
  if (this.mode === "publish") {
1623
1630
  await this.runChangesetPublish();
1631
+ this.printWorksapces();
1624
1632
  return;
1625
1633
  }
1626
1634
  if (this.mode === "both") {
1627
1635
  await this.runVersionFlow();
1628
1636
  await this.runChangesetPublish();
1637
+ this.printWorksapces();
1629
1638
  return;
1630
1639
  }
1631
1640
  await this.runVersionFlow();
1641
+ this.printWorksapces();
1632
1642
  }
1633
1643
  logDryRun(message) {
1634
1644
  this.logger.info(`[dry-run] ${message}`);
@@ -1667,18 +1677,59 @@ var ChangesetVersion = class extends ScriptPlugin2 {
1667
1677
  this.syncWorkspaces(this.context.workspaces ?? workspaces);
1668
1678
  }
1669
1679
  async runChangesetPublish() {
1680
+ const workspaces = this.context.workspaces ?? [];
1670
1681
  if (this.context.dryRun) {
1671
1682
  this.logDryRun("Would run: changeset publish, publish packages and tags");
1683
+ const preview = this.mergeWorkspaces(workspaces);
1684
+ this.context.setWorkspaces(preview);
1685
+ const previewTags = preview.filter(
1686
+ (workspace) => this.shouldProcessWorkspace(workspace) && !workspace.dependencyRelease && workspace.tagName
1687
+ ).map((workspace) => workspace.tagName);
1688
+ this.logDryRun(
1689
+ previewTags.length === 0 ? "Would push release tag(s) from workspace.tagName: none" : `Would push release tag(s) from workspace.tagName:
1690
+ ${previewTags.map((tag) => ` ${tag}`).join("\n")}`
1691
+ );
1672
1692
  return;
1673
1693
  }
1674
1694
  await this.step({
1675
1695
  label: "Changeset Publish",
1676
1696
  task: () => this.context.runChangesetsCli("publish")
1677
1697
  });
1678
- const workspaces = this.context.workspaces;
1679
- if (workspaces && workspaces.length > 0) {
1698
+ if (workspaces.length > 0) {
1680
1699
  this.syncWorkspaces(workspaces);
1681
1700
  }
1701
+ await this.step({
1702
+ label: "Push Release Tags",
1703
+ task: () => this.pushWorkspaceReleaseTags(this.context.workspaces ?? workspaces)
1704
+ });
1705
+ }
1706
+ /**
1707
+ * Push release tags from synced workspaces' `tagName` fields.
1708
+ *
1709
+ * `changeset publish` only creates tags locally. After {@link syncWorkspaces},
1710
+ * each publishable workspace should already have `tagName` (e.g. `pkg@1.2.3`).
1711
+ */
1712
+ async pushWorkspaceReleaseTags(workspaces) {
1713
+ const tags = workspaces.filter(
1714
+ (workspace) => this.shouldProcessWorkspace(workspace) && !workspace.dependencyRelease && !!workspace.tagName
1715
+ ).map((workspace) => workspace.tagName);
1716
+ const uniqueTags = [...new Set(tags)];
1717
+ if (uniqueTags.length === 0) {
1718
+ this.logger.warn(
1719
+ "No workspace.tagName found after publish sync; skip tag push"
1720
+ );
1721
+ return;
1722
+ }
1723
+ this.logger.info(
1724
+ `Pushing ${uniqueTags.length} release tag(s) to origin:
1725
+ ${uniqueTags.map((tag) => ` ${tag}`).join("\n")}`
1726
+ );
1727
+ await this.shell.exec([
1728
+ "git",
1729
+ "push",
1730
+ "origin",
1731
+ ...uniqueTags.map((tag) => `"refs/tags/${tag}"`)
1732
+ ]);
1682
1733
  }
1683
1734
  syncWorkspaces(workspaces) {
1684
1735
  let newWorkspaces = this.mergeWorkspaces(workspaces);
@@ -1769,10 +1820,11 @@ ${lines.join("\n")}`
1769
1820
  dependencyReleaseOf: workspace.dependencyReleaseOf,
1770
1821
  lastTag: workspace.lastTag
1771
1822
  });
1772
- if (newWorkspace.newVersion && newWorkspace.newVersion !== newWorkspace.version) {
1823
+ const releaseVersion = newWorkspace.newVersion || newWorkspace.version;
1824
+ if (releaseVersion) {
1773
1825
  newWorkspace.tagName = this.generateTagName({
1774
1826
  ...newWorkspace,
1775
- version: newWorkspace.newVersion
1827
+ version: releaseVersion
1776
1828
  });
1777
1829
  }
1778
1830
  return newWorkspace;
@@ -1891,7 +1943,9 @@ ${lines.join("\n")}`
1891
1943
  getIncrementLabels() {
1892
1944
  const fromConfig = this.context.parameters.workspaces?.changeLabels;
1893
1945
  if (Array.isArray(fromConfig) && fromConfig.length > 0) {
1894
- return fromConfig.filter((label) => typeof label === "string");
1946
+ return fromConfig.filter(
1947
+ (label) => typeof label === "string"
1948
+ );
1895
1949
  }
1896
1950
  return this.readGithubEventLabelNames();
1897
1951
  }
@@ -1906,7 +1960,9 @@ ${lines.join("\n")}`
1906
1960
  if (!Array.isArray(labels)) {
1907
1961
  return [];
1908
1962
  }
1909
- return labels.map((label) => label?.name).filter((name) => typeof name === "string" && name.length > 0);
1963
+ return labels.map((label) => label?.name).filter(
1964
+ (name) => typeof name === "string" && name.length > 0
1965
+ );
1910
1966
  } catch (error) {
1911
1967
  this.logger.debug("Failed to read labels from GITHUB_EVENT_PATH", error);
1912
1968
  return [];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qlover/fe-release",
3
3
  "description": "A tool for releasing front-end projects, supporting multiple release modes and configurations, simplifying the release process and improving efficiency.",
4
- "version": "5.0.1",
4
+ "version": "5.0.4",
5
5
  "type": "module",
6
6
  "private": false,
7
7
  "homepage": "https://github.com/qlover/fe-base/tree/master/packages/fe-release",
@@ -60,9 +60,9 @@
60
60
  "p-limit": "^6.2.0",
61
61
  "semver": "^7.5.4",
62
62
  "@qlover/env-loader": "1.0.2",
63
- "@qlover/scripts-context": "2.3.2",
64
63
  "@qlover/fe-corekit": "3.3.0",
65
- "@qlover/logger": "1.2.0"
64
+ "@qlover/scripts-context": "2.3.3",
65
+ "@qlover/logger": "1.2.1"
66
66
  },
67
67
  "scripts": {
68
68
  "lint": "eslint src --fix",