@delorenj/pjangler 1.5.28 → 1.5.30

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.
Files changed (2) hide show
  1. package/dist/index.js +18 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -6064,7 +6064,7 @@ var init_capture = __esm({
6064
6064
 
6065
6065
  // src/index.ts
6066
6066
  import { spawnSync as spawnSync17 } from "node:child_process";
6067
- import { existsSync as existsSync25, readdirSync as readdirSync12, readFileSync as readFileSync29, statSync as statSync8 } from "node:fs";
6067
+ import { existsSync as existsSync26, readdirSync as readdirSync12, readFileSync as readFileSync29, statSync as statSync8 } from "node:fs";
6068
6068
  import { basename as basename11, join as join34, resolve as resolve25 } from "node:path";
6069
6069
  import { Command as Command3, CommanderError, Option } from "commander";
6070
6070
 
@@ -20377,6 +20377,8 @@ init_project();
20377
20377
  init_style();
20378
20378
 
20379
20379
  // src/tui/load.ts
20380
+ import { existsSync as existsSync24 } from "node:fs";
20381
+ import { fileURLToPath as fileURLToPath6 } from "node:url";
20380
20382
  var TuiUnavailableError = class extends Error {
20381
20383
  };
20382
20384
  function isInteractive(streams = {}) {
@@ -20384,6 +20386,9 @@ function isInteractive(streams = {}) {
20384
20386
  const stdout = streams.stdout ?? process.stdout;
20385
20387
  return Boolean(stdin.isTTY && stdout.isTTY);
20386
20388
  }
20389
+ var RESOLVER_FRAME = /node:internal\/modules\/(?:esm\/resolve|package_json_reader)/;
20390
+ var CANNOT_FIND = /^Cannot find (package|module) '([^']+)' imported from (.+)$/;
20391
+ var INSTALL_DEPS = "run npm ci in this checkout, or reinstall the global package (npm i -g @delorenj/pjangler)";
20387
20392
  async function loadScreen(relativeToDist, base) {
20388
20393
  const url = new URL(relativeToDist, base);
20389
20394
  try {
@@ -20392,10 +20397,15 @@ async function loadScreen(relativeToDist, base) {
20392
20397
  url.href
20393
20398
  );
20394
20399
  } catch (error) {
20395
- if (error?.code === "ERR_MODULE_NOT_FOUND") {
20400
+ const err = error;
20401
+ if (err?.code !== "ERR_MODULE_NOT_FOUND") throw error;
20402
+ if (!existsSync24(fileURLToPath6(url))) {
20396
20403
  throw new TuiUnavailableError(`TUI screen ${relativeToDist} is not built (run: npm run build); looked for ${url.pathname}`);
20397
20404
  }
20398
- throw error;
20405
+ if (typeof err.stack !== "string" || !RESOLVER_FRAME.test(err.stack)) throw error;
20406
+ const missing = CANNOT_FIND.exec(err.message);
20407
+ const detail = missing ? `cannot find ${missing[1]} '${missing[2]}' imported by ${missing[3]}` : "an import of it cannot be resolved";
20408
+ throw new TuiUnavailableError(`TUI screen ${relativeToDist} is built but its dependencies are not installed: ${detail}; ${INSTALL_DEPS}`);
20399
20409
  }
20400
20410
  }
20401
20411
 
@@ -21118,7 +21128,7 @@ async function promptForRuleIds(rules) {
21118
21128
  return selected;
21119
21129
  }
21120
21130
  function readJson2(path) {
21121
- if (!existsSync25(path)) return void 0;
21131
+ if (!existsSync26(path)) return void 0;
21122
21132
  try {
21123
21133
  const parsed = JSON.parse(readFileSync29(path, "utf8"));
21124
21134
  return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : void 0;
@@ -21213,7 +21223,7 @@ function actionNeedsRun(plan, kind, syncMode) {
21213
21223
  if (!action || action.kind !== "project.write-manifest") return false;
21214
21224
  const next = `${JSON.stringify(action.manifest, null, 2)}
21215
21225
  `;
21216
- return !existsSync25(action.path) || readFileSync29(action.path, "utf8") !== next;
21226
+ return !existsSync26(action.path) || readFileSync29(action.path, "utf8") !== next;
21217
21227
  }
21218
21228
  if (kind === "copier.copy.commonproject") return true;
21219
21229
  if (kind === "ticket-provider.create-or-link") return plan.actions.some((action) => action.kind === kind && action.enabled);
@@ -21270,7 +21280,7 @@ async function resolveProjectInitTarget(name, options) {
21270
21280
  if (!targetDir && cwdGitRoot) {
21271
21281
  targetDir = cwdGitRoot;
21272
21282
  }
21273
- if (!targetDir && !name && existsSync25(join34(cwd, ".project.json"))) {
21283
+ if (!targetDir && !name && existsSync26(join34(cwd, ".project.json"))) {
21274
21284
  targetDir = cwd;
21275
21285
  }
21276
21286
  if (!targetDir && interactive) {
@@ -21281,10 +21291,10 @@ async function resolveProjectInitTarget(name, options) {
21281
21291
  if (!targetDir) {
21282
21292
  throw new Error("Project name or --target-dir is required when project init is not run inside a git repo or a directory carrying .project.json");
21283
21293
  }
21284
- const targetExists = existsSync25(targetDir);
21294
+ const targetExists = existsSync26(targetDir);
21285
21295
  if (targetExists && !statSync8(targetDir).isDirectory()) throw new Error(`Target path is not a directory: ${targetDir}`);
21286
21296
  const targetGitRoot = targetExists ? findGitRoot(targetDir) : void 0;
21287
- const alreadyScaffolded = targetExists && (existsSync25(join34(targetDir, ".project.json")) || existsSync25(join34(targetDir, ".copier-answers.yml")));
21297
+ const alreadyScaffolded = targetExists && (existsSync26(join34(targetDir, ".project.json")) || existsSync26(join34(targetDir, ".copier-answers.yml")));
21288
21298
  const syncMode = Boolean(
21289
21299
  targetGitRoot && resolve25(targetGitRoot) === resolve25(targetDir) || alreadyScaffolded
21290
21300
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@delorenj/pjangler",
3
- "version": "1.5.28",
3
+ "version": "1.5.30",
4
4
  "description": "Project subsystem bootstrapper CLI",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",