@reddoorla/maintenance 0.10.2 → 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 +57 -17
- package/dist/cli/bin.js.map +1 -1
- package/dist/cli/commands/audit.js +6 -1
- package/dist/cli/commands/audit.js.map +1 -1
- package/dist/index.d.ts +22 -1
- package/dist/index.js +41 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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
|
|
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 (
|
|
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 (
|
|
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
|
|
763
|
+
import { dirname as dirname6 } from "path";
|
|
764
764
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
765
765
|
import { cac } from "cac";
|
|
766
766
|
|
|
@@ -1382,7 +1382,12 @@ async function a11yAudit(ctx) {
|
|
|
1382
1382
|
try {
|
|
1383
1383
|
raw = await spawn2("npx", ["--yes", "playwright", "test", "--reporter=line", specPath], {
|
|
1384
1384
|
cwd: site.path,
|
|
1385
|
-
env: { ...process.env, REDDOOR_A11Y_OUTPUT: resultsPath }
|
|
1385
|
+
env: { ...process.env, REDDOOR_A11Y_OUTPUT: resultsPath },
|
|
1386
|
+
// playwright on a cold tree downloads Chrome, boots the site's dev
|
|
1387
|
+
// server, and runs axe over every configured route. The shared 30 s
|
|
1388
|
+
// default in runAudits is fine for deps/lint/security but starves
|
|
1389
|
+
// playwright (mirrors the lighthouse fix shipped earlier).
|
|
1390
|
+
timeoutMs: 5 * 6e4
|
|
1386
1391
|
});
|
|
1387
1392
|
} catch (err) {
|
|
1388
1393
|
await rm2(specDir, { recursive: true, force: true });
|
|
@@ -2523,7 +2528,7 @@ function injectRestIntoProps(scriptBody) {
|
|
|
2523
2528
|
if (!match) return scriptBody;
|
|
2524
2529
|
const destructured = match[1] ?? "";
|
|
2525
2530
|
if (/\.\.\.\s*\w+/.test(destructured)) return scriptBody;
|
|
2526
|
-
const trimmed = destructured.trim();
|
|
2531
|
+
const trimmed = destructured.trim().replace(/,\s*$/, "");
|
|
2527
2532
|
const newDestructured = trimmed === "" ? " ...rest " : ` ${trimmed}, ...rest `;
|
|
2528
2533
|
let replacement;
|
|
2529
2534
|
if (match[2] !== void 0) {
|
|
@@ -2628,6 +2633,20 @@ function findMatchingClose(source, openIdx) {
|
|
|
2628
2633
|
i = closeStr + 1;
|
|
2629
2634
|
continue;
|
|
2630
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
|
+
}
|
|
2631
2650
|
if (ch === "{") depth++;
|
|
2632
2651
|
else if (ch === "}") {
|
|
2633
2652
|
depth--;
|
|
@@ -2960,15 +2979,25 @@ import { stat as stat4 } from "fs/promises";
|
|
|
2960
2979
|
import { join as join19 } from "path";
|
|
2961
2980
|
|
|
2962
2981
|
// src/util/self-version.ts
|
|
2963
|
-
import { readFileSync } from "fs";
|
|
2982
|
+
import { readFileSync, existsSync as existsSync2 } from "fs";
|
|
2964
2983
|
import { fileURLToPath } from "url";
|
|
2965
2984
|
import { dirname, join as join18 } from "path";
|
|
2966
2985
|
function selfPackageVersion(callerImportMetaUrl) {
|
|
2967
2986
|
try {
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
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
|
+
}
|
|
2972
3001
|
} catch {
|
|
2973
3002
|
return "0.0.0";
|
|
2974
3003
|
}
|
|
@@ -3510,20 +3539,31 @@ async function runInitCommand(site, opts) {
|
|
|
3510
3539
|
}
|
|
3511
3540
|
|
|
3512
3541
|
// src/cli/version.ts
|
|
3513
|
-
import { readFileSync as readFileSync2 } from "fs";
|
|
3514
|
-
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";
|
|
3515
3544
|
function resolvePackageVersion(fromDir) {
|
|
3516
3545
|
try {
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
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
|
+
}
|
|
3520
3560
|
} catch {
|
|
3521
3561
|
return "unknown";
|
|
3522
3562
|
}
|
|
3523
3563
|
}
|
|
3524
3564
|
|
|
3525
3565
|
// src/cli/bin.ts
|
|
3526
|
-
var here =
|
|
3566
|
+
var here = dirname6(fileURLToPath3(import.meta.url));
|
|
3527
3567
|
var version = resolvePackageVersion(here);
|
|
3528
3568
|
var AUDIT_DESCRIPTIONS = {
|
|
3529
3569
|
deps: "Diff site package.json against the bundled baseline version map.",
|