@theholocron/cli 5.0.0-alpha.147 → 5.0.0-alpha.148

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 CHANGED
@@ -20,6 +20,7 @@ import ora from "ora";
20
20
  import { execFileSync, spawn, spawnSync } from "node:child_process";
21
21
  import { stringifyJson } from "@theholocron/json-utils";
22
22
  import { readGitRemote, updateGitignore } from "@theholocron/git-utils";
23
+ import { readPackageJson } from "@theholocron/pkg-utils";
23
24
  import { access, copyFile, mkdir, readFile, readdir, rename, rm, stat, symlink, unlink, writeFile } from "node:fs/promises";
24
25
  import { createHash, randomUUID } from "node:crypto";
25
26
  import { findRootSync } from "@theholocron/fs-utils";
@@ -4554,10 +4555,10 @@ function deriveCompliance(capabilities) {
4554
4555
  */
4555
4556
  async function readWorkspacePackageJsons(repoRoot, workspacePackages) {
4556
4557
  const results = [];
4557
- for (const { slug, dir = "packages" } of workspacePackages) try {
4558
- const raw = await readFile(join(repoRoot, dir, slug, "package.json"), "utf8");
4559
- results.push(JSON.parse(raw));
4560
- } catch {}
4558
+ for (const { slug, dir = "packages" } of workspacePackages) {
4559
+ const pkg = await readPackageJson(join(repoRoot, dir, slug));
4560
+ if (pkg) results.push(pkg);
4561
+ }
4561
4562
  return results;
4562
4563
  }
4563
4564
  //#endregion
@@ -8357,13 +8358,8 @@ async function deriveDefaults(configDir, raw) {
8357
8358
  return result;
8358
8359
  }
8359
8360
  async function readPackageJsonName(dir) {
8360
- try {
8361
- const content = await readFile(join(dir, "package.json"), "utf8");
8362
- const pkg = JSON.parse(content);
8363
- return typeof pkg.name === "string" ? pkg.name.replace(/^@[^/]+\//, "") : void 0;
8364
- } catch {
8365
- return;
8366
- }
8361
+ const name = (await readPackageJson(dir))?.name;
8362
+ return name === void 0 ? void 0 : name.replace(/^@[^/]+\//, "");
8367
8363
  }
8368
8364
  //#endregion
8369
8365
  //#region src/interactive-menu.ts