@qlover/fe-release 5.1.0 → 5.3.1
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 +35 -5
- package/dist/cli.js +35 -5
- package/dist/index.cjs +31 -4
- package/dist/index.d.ts +21 -4
- package/dist/index.js +31 -4
- package/package.json +3 -3
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.1
|
|
31
|
+
var version = "5.3.1";
|
|
32
32
|
|
|
33
33
|
// src/cli.ts
|
|
34
34
|
var import_semver = __toESM(require("semver"), 1);
|
|
@@ -1610,6 +1610,22 @@ var ChangesetVersion = class extends import_scripts_context4.ScriptPlugin {
|
|
|
1610
1610
|
get ignoreNonUpdatedPackages() {
|
|
1611
1611
|
return !!this.config.ignoreNonUpdatedPackages;
|
|
1612
1612
|
}
|
|
1613
|
+
get useTrustedPublishing() {
|
|
1614
|
+
return !!(this.config.useTrustedPublishing || this.context.parameters.changesetVersion?.useTrustedPublishing);
|
|
1615
|
+
}
|
|
1616
|
+
/**
|
|
1617
|
+
* True when publish should use npm Trusted Publishing (OIDC) instead of NPM_TOKEN.
|
|
1618
|
+
*/
|
|
1619
|
+
isTrustedPublishingEnv() {
|
|
1620
|
+
if (this.useTrustedPublishing) {
|
|
1621
|
+
return true;
|
|
1622
|
+
}
|
|
1623
|
+
const envFlag = this.context.getEnv("FE_RELEASE_TRUSTED_PUBLISHING");
|
|
1624
|
+
if (envFlag === "1" || envFlag === "true") {
|
|
1625
|
+
return true;
|
|
1626
|
+
}
|
|
1627
|
+
return Boolean(this.context.getEnv("ACTIONS_ID_TOKEN_REQUEST_URL"));
|
|
1628
|
+
}
|
|
1613
1629
|
shouldProcessWorkspace(workspace) {
|
|
1614
1630
|
return shouldProcessWorkspace(workspace, this.ignoreNonUpdatedPackages);
|
|
1615
1631
|
}
|
|
@@ -1631,15 +1647,26 @@ var ChangesetVersion = class extends import_scripts_context4.ScriptPlugin {
|
|
|
1631
1647
|
}
|
|
1632
1648
|
}
|
|
1633
1649
|
/**
|
|
1634
|
-
*
|
|
1650
|
+
* Configure npm auth before changeset publish.
|
|
1635
1651
|
*
|
|
1636
|
-
*
|
|
1637
|
-
* do not need
|
|
1652
|
+
* Uses Trusted Publishing (OIDC) when detected; otherwise requires `NPM_TOKEN`.
|
|
1653
|
+
* Version-only runs (release PR) do not need npm auth.
|
|
1638
1654
|
*/
|
|
1639
1655
|
async validateNpmToken() {
|
|
1656
|
+
if (this.isTrustedPublishingEnv()) {
|
|
1657
|
+
this.logger.info(
|
|
1658
|
+
"Using npm Trusted Publishing (OIDC); skip NPM_TOKEN auth setup"
|
|
1659
|
+
);
|
|
1660
|
+
if (this.context.dryRun) {
|
|
1661
|
+
this.logDryRun("Would publish via npm Trusted Publishing (OIDC)");
|
|
1662
|
+
}
|
|
1663
|
+
return;
|
|
1664
|
+
}
|
|
1640
1665
|
const npmToken = this.context.getEnv("NPM_TOKEN");
|
|
1641
1666
|
if (!npmToken) {
|
|
1642
|
-
throw new Error(
|
|
1667
|
+
throw new Error(
|
|
1668
|
+
"NPM_TOKEN is not set. Enable Trusted Publishing (OIDC) or provide NPM_TOKEN."
|
|
1669
|
+
);
|
|
1643
1670
|
}
|
|
1644
1671
|
if (this.context.dryRun) {
|
|
1645
1672
|
this.logDryRun(
|
|
@@ -3982,6 +4009,9 @@ function programArgs() {
|
|
|
3982
4009
|
).option(
|
|
3983
4010
|
"--changelog.ignore-non-updated-packages",
|
|
3984
4011
|
"Alias of --changesetVersion.ignore-non-updated-packages"
|
|
4012
|
+
).option(
|
|
4013
|
+
"--changesetVersion.use-trusted-publishing",
|
|
4014
|
+
"Use npm Trusted Publishing (OIDC) instead of NPM_TOKEN (fe-config: release.changesetVersion.useTrustedPublishing)"
|
|
3985
4015
|
).option(
|
|
3986
4016
|
"--changesetVersion.mode <mode>",
|
|
3987
4017
|
"ChangesetVersion mode: version (default), publish, or both (fe-config: release.changesetVersion.mode)",
|
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.1
|
|
8
|
+
var version = "5.3.1";
|
|
9
9
|
|
|
10
10
|
// src/cli.ts
|
|
11
11
|
import semver from "semver";
|
|
@@ -1590,6 +1590,22 @@ var ChangesetVersion = class extends ScriptPlugin2 {
|
|
|
1590
1590
|
get ignoreNonUpdatedPackages() {
|
|
1591
1591
|
return !!this.config.ignoreNonUpdatedPackages;
|
|
1592
1592
|
}
|
|
1593
|
+
get useTrustedPublishing() {
|
|
1594
|
+
return !!(this.config.useTrustedPublishing || this.context.parameters.changesetVersion?.useTrustedPublishing);
|
|
1595
|
+
}
|
|
1596
|
+
/**
|
|
1597
|
+
* True when publish should use npm Trusted Publishing (OIDC) instead of NPM_TOKEN.
|
|
1598
|
+
*/
|
|
1599
|
+
isTrustedPublishingEnv() {
|
|
1600
|
+
if (this.useTrustedPublishing) {
|
|
1601
|
+
return true;
|
|
1602
|
+
}
|
|
1603
|
+
const envFlag = this.context.getEnv("FE_RELEASE_TRUSTED_PUBLISHING");
|
|
1604
|
+
if (envFlag === "1" || envFlag === "true") {
|
|
1605
|
+
return true;
|
|
1606
|
+
}
|
|
1607
|
+
return Boolean(this.context.getEnv("ACTIONS_ID_TOKEN_REQUEST_URL"));
|
|
1608
|
+
}
|
|
1593
1609
|
shouldProcessWorkspace(workspace) {
|
|
1594
1610
|
return shouldProcessWorkspace(workspace, this.ignoreNonUpdatedPackages);
|
|
1595
1611
|
}
|
|
@@ -1611,15 +1627,26 @@ var ChangesetVersion = class extends ScriptPlugin2 {
|
|
|
1611
1627
|
}
|
|
1612
1628
|
}
|
|
1613
1629
|
/**
|
|
1614
|
-
*
|
|
1630
|
+
* Configure npm auth before changeset publish.
|
|
1615
1631
|
*
|
|
1616
|
-
*
|
|
1617
|
-
* do not need
|
|
1632
|
+
* Uses Trusted Publishing (OIDC) when detected; otherwise requires `NPM_TOKEN`.
|
|
1633
|
+
* Version-only runs (release PR) do not need npm auth.
|
|
1618
1634
|
*/
|
|
1619
1635
|
async validateNpmToken() {
|
|
1636
|
+
if (this.isTrustedPublishingEnv()) {
|
|
1637
|
+
this.logger.info(
|
|
1638
|
+
"Using npm Trusted Publishing (OIDC); skip NPM_TOKEN auth setup"
|
|
1639
|
+
);
|
|
1640
|
+
if (this.context.dryRun) {
|
|
1641
|
+
this.logDryRun("Would publish via npm Trusted Publishing (OIDC)");
|
|
1642
|
+
}
|
|
1643
|
+
return;
|
|
1644
|
+
}
|
|
1620
1645
|
const npmToken = this.context.getEnv("NPM_TOKEN");
|
|
1621
1646
|
if (!npmToken) {
|
|
1622
|
-
throw new Error(
|
|
1647
|
+
throw new Error(
|
|
1648
|
+
"NPM_TOKEN is not set. Enable Trusted Publishing (OIDC) or provide NPM_TOKEN."
|
|
1649
|
+
);
|
|
1623
1650
|
}
|
|
1624
1651
|
if (this.context.dryRun) {
|
|
1625
1652
|
this.logDryRun(
|
|
@@ -3962,6 +3989,9 @@ function programArgs() {
|
|
|
3962
3989
|
).option(
|
|
3963
3990
|
"--changelog.ignore-non-updated-packages",
|
|
3964
3991
|
"Alias of --changesetVersion.ignore-non-updated-packages"
|
|
3992
|
+
).option(
|
|
3993
|
+
"--changesetVersion.use-trusted-publishing",
|
|
3994
|
+
"Use npm Trusted Publishing (OIDC) instead of NPM_TOKEN (fe-config: release.changesetVersion.useTrustedPublishing)"
|
|
3965
3995
|
).option(
|
|
3966
3996
|
"--changesetVersion.mode <mode>",
|
|
3967
3997
|
"ChangesetVersion mode: version (default), publish, or both (fe-config: release.changesetVersion.mode)",
|
package/dist/index.cjs
CHANGED
|
@@ -1615,6 +1615,22 @@ var ChangesetVersion = class extends import_scripts_context4.ScriptPlugin {
|
|
|
1615
1615
|
get ignoreNonUpdatedPackages() {
|
|
1616
1616
|
return !!this.config.ignoreNonUpdatedPackages;
|
|
1617
1617
|
}
|
|
1618
|
+
get useTrustedPublishing() {
|
|
1619
|
+
return !!(this.config.useTrustedPublishing || this.context.parameters.changesetVersion?.useTrustedPublishing);
|
|
1620
|
+
}
|
|
1621
|
+
/**
|
|
1622
|
+
* True when publish should use npm Trusted Publishing (OIDC) instead of NPM_TOKEN.
|
|
1623
|
+
*/
|
|
1624
|
+
isTrustedPublishingEnv() {
|
|
1625
|
+
if (this.useTrustedPublishing) {
|
|
1626
|
+
return true;
|
|
1627
|
+
}
|
|
1628
|
+
const envFlag = this.context.getEnv("FE_RELEASE_TRUSTED_PUBLISHING");
|
|
1629
|
+
if (envFlag === "1" || envFlag === "true") {
|
|
1630
|
+
return true;
|
|
1631
|
+
}
|
|
1632
|
+
return Boolean(this.context.getEnv("ACTIONS_ID_TOKEN_REQUEST_URL"));
|
|
1633
|
+
}
|
|
1618
1634
|
shouldProcessWorkspace(workspace) {
|
|
1619
1635
|
return shouldProcessWorkspace(workspace, this.ignoreNonUpdatedPackages);
|
|
1620
1636
|
}
|
|
@@ -1636,15 +1652,26 @@ var ChangesetVersion = class extends import_scripts_context4.ScriptPlugin {
|
|
|
1636
1652
|
}
|
|
1637
1653
|
}
|
|
1638
1654
|
/**
|
|
1639
|
-
*
|
|
1655
|
+
* Configure npm auth before changeset publish.
|
|
1640
1656
|
*
|
|
1641
|
-
*
|
|
1642
|
-
* do not need
|
|
1657
|
+
* Uses Trusted Publishing (OIDC) when detected; otherwise requires `NPM_TOKEN`.
|
|
1658
|
+
* Version-only runs (release PR) do not need npm auth.
|
|
1643
1659
|
*/
|
|
1644
1660
|
async validateNpmToken() {
|
|
1661
|
+
if (this.isTrustedPublishingEnv()) {
|
|
1662
|
+
this.logger.info(
|
|
1663
|
+
"Using npm Trusted Publishing (OIDC); skip NPM_TOKEN auth setup"
|
|
1664
|
+
);
|
|
1665
|
+
if (this.context.dryRun) {
|
|
1666
|
+
this.logDryRun("Would publish via npm Trusted Publishing (OIDC)");
|
|
1667
|
+
}
|
|
1668
|
+
return;
|
|
1669
|
+
}
|
|
1645
1670
|
const npmToken = this.context.getEnv("NPM_TOKEN");
|
|
1646
1671
|
if (!npmToken) {
|
|
1647
|
-
throw new Error(
|
|
1672
|
+
throw new Error(
|
|
1673
|
+
"NPM_TOKEN is not set. Enable Trusted Publishing (OIDC) or provide NPM_TOKEN."
|
|
1674
|
+
);
|
|
1648
1675
|
}
|
|
1649
1676
|
if (this.context.dryRun) {
|
|
1650
1677
|
this.logDryRun(
|
package/dist/index.d.ts
CHANGED
|
@@ -881,7 +881,8 @@ interface ChangeLogInterface {
|
|
|
881
881
|
* Changesets CLI for monorepo version bumps.
|
|
882
882
|
*
|
|
883
883
|
* Pipeline phases:
|
|
884
|
-
* - **onBefore**: validate `.changeset` directory;
|
|
884
|
+
* - **onBefore**: validate `.changeset` directory; configure npm auth when mode includes publish
|
|
885
|
+
* (`NPM_TOKEN` for token auth, or skip when Trusted Publishing / OIDC is detected)
|
|
885
886
|
* - **onExec**: generate per-workspace git changelogs (skips `dependencyRelease`
|
|
886
887
|
* when `ignoreNonUpdatedPackages` is enabled)
|
|
887
888
|
* - **onSuccess**: run version and/or publish flow based on `mode`
|
|
@@ -994,6 +995,17 @@ interface ChangesetVersionProps extends GitChangelogOptions, ScriptPluginProps {
|
|
|
994
995
|
* @default false
|
|
995
996
|
*/
|
|
996
997
|
ignoreNonUpdatedPackages?: boolean;
|
|
998
|
+
/**
|
|
999
|
+
* Use npm Trusted Publishing (OIDC) instead of `NPM_TOKEN`.
|
|
1000
|
+
*
|
|
1001
|
+
* When enabled (or when GitHub Actions OIDC env is detected), publish skips
|
|
1002
|
+
* writing `_authToken` to npm config so the CLI can exchange OIDC credentials.
|
|
1003
|
+
*
|
|
1004
|
+
* CLI: `--changesetVersion.use-trusted-publishing`
|
|
1005
|
+
*
|
|
1006
|
+
* @default false
|
|
1007
|
+
*/
|
|
1008
|
+
useTrustedPublishing?: boolean;
|
|
997
1009
|
}
|
|
998
1010
|
/**
|
|
999
1011
|
* Manages changelog generation, changeset file creation, and Changesets CLI execution.
|
|
@@ -1008,14 +1020,19 @@ declare class ChangesetVersion extends ScriptPlugin<ReleaseContext, ChangesetVer
|
|
|
1008
1020
|
get changesetConfigPath(): string;
|
|
1009
1021
|
protected get mode(): ChangesetVersionMode;
|
|
1010
1022
|
protected get ignoreNonUpdatedPackages(): boolean;
|
|
1023
|
+
protected get useTrustedPublishing(): boolean;
|
|
1024
|
+
/**
|
|
1025
|
+
* True when publish should use npm Trusted Publishing (OIDC) instead of NPM_TOKEN.
|
|
1026
|
+
*/
|
|
1027
|
+
protected isTrustedPublishingEnv(): boolean;
|
|
1011
1028
|
protected shouldProcessWorkspace(workspace: WorkspaceInterface): boolean;
|
|
1012
1029
|
protected getProcessableWorkspaces(workspaces: WorkspaceInterface[]): WorkspaceInterface[];
|
|
1013
1030
|
onBefore(): Promise<void>;
|
|
1014
1031
|
/**
|
|
1015
|
-
*
|
|
1032
|
+
* Configure npm auth before changeset publish.
|
|
1016
1033
|
*
|
|
1017
|
-
*
|
|
1018
|
-
* do not need
|
|
1034
|
+
* Uses Trusted Publishing (OIDC) when detected; otherwise requires `NPM_TOKEN`.
|
|
1035
|
+
* Version-only runs (release PR) do not need npm auth.
|
|
1019
1036
|
*/
|
|
1020
1037
|
protected validateNpmToken(): Promise<void>;
|
|
1021
1038
|
onExec(_context: ReleaseContext): Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -1566,6 +1566,22 @@ var ChangesetVersion = class extends ScriptPlugin2 {
|
|
|
1566
1566
|
get ignoreNonUpdatedPackages() {
|
|
1567
1567
|
return !!this.config.ignoreNonUpdatedPackages;
|
|
1568
1568
|
}
|
|
1569
|
+
get useTrustedPublishing() {
|
|
1570
|
+
return !!(this.config.useTrustedPublishing || this.context.parameters.changesetVersion?.useTrustedPublishing);
|
|
1571
|
+
}
|
|
1572
|
+
/**
|
|
1573
|
+
* True when publish should use npm Trusted Publishing (OIDC) instead of NPM_TOKEN.
|
|
1574
|
+
*/
|
|
1575
|
+
isTrustedPublishingEnv() {
|
|
1576
|
+
if (this.useTrustedPublishing) {
|
|
1577
|
+
return true;
|
|
1578
|
+
}
|
|
1579
|
+
const envFlag = this.context.getEnv("FE_RELEASE_TRUSTED_PUBLISHING");
|
|
1580
|
+
if (envFlag === "1" || envFlag === "true") {
|
|
1581
|
+
return true;
|
|
1582
|
+
}
|
|
1583
|
+
return Boolean(this.context.getEnv("ACTIONS_ID_TOKEN_REQUEST_URL"));
|
|
1584
|
+
}
|
|
1569
1585
|
shouldProcessWorkspace(workspace) {
|
|
1570
1586
|
return shouldProcessWorkspace(workspace, this.ignoreNonUpdatedPackages);
|
|
1571
1587
|
}
|
|
@@ -1587,15 +1603,26 @@ var ChangesetVersion = class extends ScriptPlugin2 {
|
|
|
1587
1603
|
}
|
|
1588
1604
|
}
|
|
1589
1605
|
/**
|
|
1590
|
-
*
|
|
1606
|
+
* Configure npm auth before changeset publish.
|
|
1591
1607
|
*
|
|
1592
|
-
*
|
|
1593
|
-
* do not need
|
|
1608
|
+
* Uses Trusted Publishing (OIDC) when detected; otherwise requires `NPM_TOKEN`.
|
|
1609
|
+
* Version-only runs (release PR) do not need npm auth.
|
|
1594
1610
|
*/
|
|
1595
1611
|
async validateNpmToken() {
|
|
1612
|
+
if (this.isTrustedPublishingEnv()) {
|
|
1613
|
+
this.logger.info(
|
|
1614
|
+
"Using npm Trusted Publishing (OIDC); skip NPM_TOKEN auth setup"
|
|
1615
|
+
);
|
|
1616
|
+
if (this.context.dryRun) {
|
|
1617
|
+
this.logDryRun("Would publish via npm Trusted Publishing (OIDC)");
|
|
1618
|
+
}
|
|
1619
|
+
return;
|
|
1620
|
+
}
|
|
1596
1621
|
const npmToken = this.context.getEnv("NPM_TOKEN");
|
|
1597
1622
|
if (!npmToken) {
|
|
1598
|
-
throw new Error(
|
|
1623
|
+
throw new Error(
|
|
1624
|
+
"NPM_TOKEN is not set. Enable Trusted Publishing (OIDC) or provide NPM_TOKEN."
|
|
1625
|
+
);
|
|
1599
1626
|
}
|
|
1600
1627
|
if (this.context.dryRun) {
|
|
1601
1628
|
this.logDryRun(
|
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.1
|
|
4
|
+
"version": "5.3.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
7
7
|
"homepage": "https://github.com/qlover/fe-base/tree/master/packages/fe-release",
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"lodash-es": "^4.17.22",
|
|
60
60
|
"p-limit": "^6.2.0",
|
|
61
61
|
"semver": "^7.5.4",
|
|
62
|
-
"@qlover/env-loader": "1.0
|
|
63
|
-
"@qlover/fe-corekit": "3.4.
|
|
62
|
+
"@qlover/env-loader": "1.1.0",
|
|
63
|
+
"@qlover/fe-corekit": "3.4.6",
|
|
64
64
|
"@qlover/logger": "1.2.1",
|
|
65
65
|
"@qlover/scripts-context": "2.3.3"
|
|
66
66
|
},
|