@theholocron/cli 5.0.0-alpha.133 → 5.0.0-alpha.134
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.mjs +43 -18
- package/dist/cli.mjs.map +1 -1
- package/package.json +4 -4
package/dist/cli.mjs
CHANGED
|
@@ -3479,7 +3479,7 @@ async function runSyncTrust(input) {
|
|
|
3479
3479
|
packages: packageNames.length
|
|
3480
3480
|
}, "sync-trust: start");
|
|
3481
3481
|
if (packageNames.length === 0) {
|
|
3482
|
-
const message = "nothing to sync (no packages
|
|
3482
|
+
const message = "nothing to sync (no packages/*, plugins/*, or root package.json is private or unnamed)";
|
|
3483
3483
|
print(` ✗ ${message}`);
|
|
3484
3484
|
return {
|
|
3485
3485
|
status: "fail",
|
|
@@ -3636,7 +3636,7 @@ async function runPublish(input = {}) {
|
|
|
3636
3636
|
const exec = input.exec ?? defaultExec$1;
|
|
3637
3637
|
const login = input.login ?? defaultLogin;
|
|
3638
3638
|
const publishArgs = [
|
|
3639
|
-
...
|
|
3639
|
+
...workspaceFilterArgs(cwd),
|
|
3640
3640
|
"publish",
|
|
3641
3641
|
"--access",
|
|
3642
3642
|
"public",
|
|
@@ -3687,7 +3687,7 @@ async function runPublish(input = {}) {
|
|
|
3687
3687
|
const packageNames = input.packages ?? discoverPublicPackages(cwd);
|
|
3688
3688
|
const repoName = input.repoName ?? await resolveRepoName(cwd, exec);
|
|
3689
3689
|
if (packageNames.length === 0) {
|
|
3690
|
-
const message = "nothing to publish (no packages
|
|
3690
|
+
const message = "nothing to publish (no packages/*, plugins/*, or root package.json is private or unnamed)";
|
|
3691
3691
|
print(` ✗ ${message}`);
|
|
3692
3692
|
logger.warn({ reason: message }, "publish --initial: done");
|
|
3693
3693
|
return {
|
|
@@ -3757,7 +3757,7 @@ async function runPublish(input = {}) {
|
|
|
3757
3757
|
* Deliberately does not do the `--initial` bootstrap dance (npm
|
|
3758
3758
|
* login-if-needed, Trusted Publisher next-steps printout) — a steady-state
|
|
3759
3759
|
* publish runs in CI, authenticated via OIDC automatically, no interactive
|
|
3760
|
-
* step involved. Reuses `
|
|
3760
|
+
* step involved. Reuses `workspaceFilterArgs()`'s monorepo-vs-single-package
|
|
3761
3761
|
* detection rather than duplicating it.
|
|
3762
3762
|
*/
|
|
3763
3763
|
async function runSteadyPublish(input = {}) {
|
|
@@ -3786,7 +3786,7 @@ async function runSteadyPublish(input = {}) {
|
|
|
3786
3786
|
if (otp) print(` otp: <${otp.length} chars>`);
|
|
3787
3787
|
print("");
|
|
3788
3788
|
if (entries.length === 0) {
|
|
3789
|
-
const message = "nothing to publish (no packages
|
|
3789
|
+
const message = "nothing to publish (no packages/*, plugins/*, or root package.json is private or unnamed)";
|
|
3790
3790
|
print(` ✗ ${message}`);
|
|
3791
3791
|
logger.warn({ reason: message }, "publish: done");
|
|
3792
3792
|
return {
|
|
@@ -3809,7 +3809,7 @@ async function runSteadyPublish(input = {}) {
|
|
|
3809
3809
|
if (skipAlreadyPublished) for (const entry of entries) print(` … would check ${entry.name}@${entry.version}, publish if not already on npm`);
|
|
3810
3810
|
else {
|
|
3811
3811
|
const args = [
|
|
3812
|
-
...
|
|
3812
|
+
...workspaceFilterArgs(cwd),
|
|
3813
3813
|
"publish",
|
|
3814
3814
|
...baseFlags,
|
|
3815
3815
|
...otpFlags
|
|
@@ -3875,7 +3875,7 @@ async function runSteadyPublish(input = {}) {
|
|
|
3875
3875
|
}
|
|
3876
3876
|
print(" → publishing all public @theholocron/* packages…");
|
|
3877
3877
|
const publish = await exec("pnpm", [
|
|
3878
|
-
...
|
|
3878
|
+
...workspaceFilterArgs(cwd),
|
|
3879
3879
|
"publish",
|
|
3880
3880
|
...baseFlags,
|
|
3881
3881
|
...otpFlags
|
|
@@ -3912,6 +3912,22 @@ async function runSteadyPublish(input = {}) {
|
|
|
3912
3912
|
function hasPackagesDir(cwd) {
|
|
3913
3913
|
return existsSync(join(cwd, "packages"));
|
|
3914
3914
|
}
|
|
3915
|
+
/** `plugins/` — vendor capability providers, split from `packages/` as a sibling workspace root (#993). */
|
|
3916
|
+
function hasPluginsDir(cwd) {
|
|
3917
|
+
return existsSync(join(cwd, "plugins"));
|
|
3918
|
+
}
|
|
3919
|
+
/**
|
|
3920
|
+
* `-r --filter=./packages/* --filter=./plugins/*` — whichever workspace
|
|
3921
|
+
* roots exist. Empty (single-package repo, no `-r`) when neither does.
|
|
3922
|
+
* Shared by every `pnpm publish` invocation below so a repo with only
|
|
3923
|
+
* `plugins/*` (or both) is covered the same as `packages/*`-only.
|
|
3924
|
+
*/
|
|
3925
|
+
function workspaceFilterArgs(cwd) {
|
|
3926
|
+
const filters = [];
|
|
3927
|
+
if (hasPackagesDir(cwd)) filters.push("--filter=./packages/*");
|
|
3928
|
+
if (hasPluginsDir(cwd)) filters.push("--filter=./plugins/*");
|
|
3929
|
+
return filters.length > 0 ? ["-r", ...filters] : [];
|
|
3930
|
+
}
|
|
3915
3931
|
/** Read a `package.json`'s `name`, when it's public (`!private && name`). */
|
|
3916
3932
|
function publicPackageName(pkgPath) {
|
|
3917
3933
|
if (!existsSync(pkgPath)) return void 0;
|
|
@@ -3943,29 +3959,38 @@ function publicPackageEntry(pkgPath, dir) {
|
|
|
3943
3959
|
* and publish one workspace at a time.
|
|
3944
3960
|
*/
|
|
3945
3961
|
function discoverPublicPackageEntries(cwd) {
|
|
3946
|
-
if (!hasPackagesDir(cwd)) {
|
|
3962
|
+
if (!hasPackagesDir(cwd) && !hasPluginsDir(cwd)) {
|
|
3947
3963
|
const entry = publicPackageEntry(join(cwd, "package.json"), ".");
|
|
3948
3964
|
return entry ? [entry] : [];
|
|
3949
3965
|
}
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3966
|
+
return [...entriesInWorkspaceDir(cwd, "packages"), ...entriesInWorkspaceDir(cwd, "plugins")];
|
|
3967
|
+
}
|
|
3968
|
+
function entriesInWorkspaceDir(cwd, dirName) {
|
|
3969
|
+
const dirPath = join(cwd, dirName);
|
|
3970
|
+
if (!existsSync(dirPath)) return [];
|
|
3971
|
+
return readdirSync(dirPath, { withFileTypes: true }).filter((e) => e.isDirectory()).flatMap((e) => {
|
|
3972
|
+
const entry = publicPackageEntry(join(dirPath, e.name, "package.json"), `./${dirName}/${e.name}`);
|
|
3953
3973
|
return entry ? [entry] : [];
|
|
3954
3974
|
});
|
|
3955
3975
|
}
|
|
3956
3976
|
/**
|
|
3957
|
-
* Monorepo (`packages/` present): every public
|
|
3958
|
-
* Single package (
|
|
3959
|
-
* most `node-template` scaffolds are one
|
|
3977
|
+
* Monorepo (`packages/` and/or `plugins/` present): every public workspace
|
|
3978
|
+
* under either. Single package (neither dir present): the root
|
|
3979
|
+
* `package.json`, if it's public — most `node-template` scaffolds are one
|
|
3980
|
+
* package at the repo root.
|
|
3960
3981
|
*/
|
|
3961
3982
|
function discoverPublicPackages(cwd) {
|
|
3962
|
-
if (!hasPackagesDir(cwd)) {
|
|
3983
|
+
if (!hasPackagesDir(cwd) && !hasPluginsDir(cwd)) {
|
|
3963
3984
|
const name = publicPackageName(join(cwd, "package.json"));
|
|
3964
3985
|
return name ? [name] : [];
|
|
3965
3986
|
}
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3987
|
+
return [...namesInWorkspaceDir(cwd, "packages"), ...namesInWorkspaceDir(cwd, "plugins")];
|
|
3988
|
+
}
|
|
3989
|
+
function namesInWorkspaceDir(cwd, dirName) {
|
|
3990
|
+
const dirPath = join(cwd, dirName);
|
|
3991
|
+
if (!existsSync(dirPath)) return [];
|
|
3992
|
+
return readdirSync(dirPath, { withFileTypes: true }).filter((e) => e.isDirectory()).flatMap((e) => {
|
|
3993
|
+
const name = publicPackageName(join(dirPath, e.name, "package.json"));
|
|
3969
3994
|
return name ? [name] : [];
|
|
3970
3995
|
});
|
|
3971
3996
|
}
|