@reddoorla/maintenance 0.10.3 → 0.10.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/bin.js CHANGED
@@ -284,7 +284,7 @@ var init_reports = __esm({
284
284
 
285
285
  // src/reports/maintenance-email/assets/index.ts
286
286
  import { readFile as readFile13 } from "fs/promises";
287
- import { existsSync as existsSync2 } from "fs";
287
+ import { existsSync as existsSync3 } from "fs";
288
288
  import { dirname as dirname2, join as join21 } from "path";
289
289
  import { fileURLToPath as fileURLToPath2 } from "url";
290
290
  function resolveAssetsDir() {
@@ -292,12 +292,12 @@ function resolveAssetsDir() {
292
292
  let dir = dirname2(fileURLToPath2(import.meta.url));
293
293
  while (true) {
294
294
  const srcCandidate = join21(dir, "src", "reports", "maintenance-email", "assets", "check.png");
295
- if (existsSync2(srcCandidate)) {
295
+ if (existsSync3(srcCandidate)) {
296
296
  cachedAssetsDir = dirname2(srcCandidate);
297
297
  return cachedAssetsDir;
298
298
  }
299
299
  const distCandidate = join21(dir, "dist", "reports", "maintenance-email", "assets", "check.png");
300
- if (existsSync2(distCandidate)) {
300
+ if (existsSync3(distCandidate)) {
301
301
  cachedAssetsDir = dirname2(distCandidate);
302
302
  return cachedAssetsDir;
303
303
  }
@@ -760,7 +760,7 @@ var init_orchestrate = __esm({
760
760
  });
761
761
 
762
762
  // src/cli/bin.ts
763
- import { dirname as dirname5 } from "path";
763
+ import { dirname as dirname6 } from "path";
764
764
  import { fileURLToPath as fileURLToPath3 } from "url";
765
765
  import { cac } from "cac";
766
766
 
@@ -2633,6 +2633,20 @@ function findMatchingClose(source, openIdx) {
2633
2633
  i = closeStr + 1;
2634
2634
  continue;
2635
2635
  }
2636
+ if (ch === "/") {
2637
+ const next = source[i + 1];
2638
+ if (next === "/") {
2639
+ const eol = source.indexOf("\n", i + 2);
2640
+ i = eol === -1 ? source.length : eol;
2641
+ continue;
2642
+ }
2643
+ if (next === "*") {
2644
+ const end = source.indexOf("*/", i + 2);
2645
+ if (end === -1) return -1;
2646
+ i = end + 2;
2647
+ continue;
2648
+ }
2649
+ }
2636
2650
  if (ch === "{") depth++;
2637
2651
  else if (ch === "}") {
2638
2652
  depth--;
@@ -2965,15 +2979,25 @@ import { stat as stat4 } from "fs/promises";
2965
2979
  import { join as join19 } from "path";
2966
2980
 
2967
2981
  // src/util/self-version.ts
2968
- import { readFileSync } from "fs";
2982
+ import { readFileSync, existsSync as existsSync2 } from "fs";
2969
2983
  import { fileURLToPath } from "url";
2970
2984
  import { dirname, join as join18 } from "path";
2971
2985
  function selfPackageVersion(callerImportMetaUrl) {
2972
2986
  try {
2973
- const here2 = dirname(fileURLToPath(callerImportMetaUrl));
2974
- const raw = readFileSync(join18(here2, "..", "..", "package.json"), "utf-8");
2975
- const pkg = JSON.parse(raw);
2976
- return pkg.version ?? "0.0.0";
2987
+ let dir = dirname(fileURLToPath(callerImportMetaUrl));
2988
+ while (true) {
2989
+ const candidate = join18(dir, "package.json");
2990
+ if (existsSync2(candidate)) {
2991
+ const raw = readFileSync(candidate, "utf-8");
2992
+ const pkg = JSON.parse(raw);
2993
+ if (pkg.name === "@reddoorla/maintenance") {
2994
+ return pkg.version ?? "0.0.0";
2995
+ }
2996
+ }
2997
+ const parent = dirname(dir);
2998
+ if (parent === dir) return "0.0.0";
2999
+ dir = parent;
3000
+ }
2977
3001
  } catch {
2978
3002
  return "0.0.0";
2979
3003
  }
@@ -3515,20 +3539,31 @@ async function runInitCommand(site, opts) {
3515
3539
  }
3516
3540
 
3517
3541
  // src/cli/version.ts
3518
- import { readFileSync as readFileSync2 } from "fs";
3519
- import { join as join23 } from "path";
3542
+ import { readFileSync as readFileSync2, existsSync as existsSync4 } from "fs";
3543
+ import { dirname as dirname5, join as join23 } from "path";
3520
3544
  function resolvePackageVersion(fromDir) {
3521
3545
  try {
3522
- const raw = readFileSync2(join23(fromDir, "..", "..", "package.json"), "utf-8");
3523
- const pkg = JSON.parse(raw);
3524
- return pkg.version ?? "unknown";
3546
+ let dir = fromDir;
3547
+ while (true) {
3548
+ const candidate = join23(dir, "package.json");
3549
+ if (existsSync4(candidate)) {
3550
+ const raw = readFileSync2(candidate, "utf-8");
3551
+ const pkg = JSON.parse(raw);
3552
+ if (pkg.name === "@reddoorla/maintenance") {
3553
+ return pkg.version ?? "unknown";
3554
+ }
3555
+ }
3556
+ const parent = dirname5(dir);
3557
+ if (parent === dir) return "unknown";
3558
+ dir = parent;
3559
+ }
3525
3560
  } catch {
3526
3561
  return "unknown";
3527
3562
  }
3528
3563
  }
3529
3564
 
3530
3565
  // src/cli/bin.ts
3531
- var here = dirname5(fileURLToPath3(import.meta.url));
3566
+ var here = dirname6(fileURLToPath3(import.meta.url));
3532
3567
  var version = resolvePackageVersion(here);
3533
3568
  var AUDIT_DESCRIPTIONS = {
3534
3569
  deps: "Diff site package.json against the bundled baseline version map.",