@reddoorla/maintenance 0.10.1 → 0.10.2
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 +33 -8
- package/dist/cli/bin.js.map +1 -1
- package/dist/index.d.ts +19 -1
- package/dist/index.js +33 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/bin.js
CHANGED
|
@@ -284,12 +284,37 @@ 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
288
|
import { dirname as dirname2, join as join21 } from "path";
|
|
288
289
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
290
|
+
function resolveAssetsDir() {
|
|
291
|
+
if (cachedAssetsDir) return cachedAssetsDir;
|
|
292
|
+
let dir = dirname2(fileURLToPath2(import.meta.url));
|
|
293
|
+
while (true) {
|
|
294
|
+
const srcCandidate = join21(dir, "src", "reports", "maintenance-email", "assets", "check.png");
|
|
295
|
+
if (existsSync2(srcCandidate)) {
|
|
296
|
+
cachedAssetsDir = dirname2(srcCandidate);
|
|
297
|
+
return cachedAssetsDir;
|
|
298
|
+
}
|
|
299
|
+
const distCandidate = join21(dir, "dist", "reports", "maintenance-email", "assets", "check.png");
|
|
300
|
+
if (existsSync2(distCandidate)) {
|
|
301
|
+
cachedAssetsDir = dirname2(distCandidate);
|
|
302
|
+
return cachedAssetsDir;
|
|
303
|
+
}
|
|
304
|
+
const parent = dirname2(dir);
|
|
305
|
+
if (parent === dir) {
|
|
306
|
+
throw new Error(
|
|
307
|
+
`loadBundledImages: could not locate maintenance-email assets dir by walking up from ${fileURLToPath2(import.meta.url)}. Checked both src/ and dist/ layouts.`
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
dir = parent;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
289
313
|
async function loadBundledImages() {
|
|
314
|
+
const assetsDir = resolveAssetsDir();
|
|
290
315
|
const [check, blurred] = await Promise.all([
|
|
291
|
-
readFile13(join21(
|
|
292
|
-
readFile13(join21(
|
|
316
|
+
readFile13(join21(assetsDir, "check.png")),
|
|
317
|
+
readFile13(join21(assetsDir, "blurredTests.jpg"))
|
|
293
318
|
]);
|
|
294
319
|
return {
|
|
295
320
|
check: {
|
|
@@ -306,13 +331,13 @@ async function loadBundledImages() {
|
|
|
306
331
|
}
|
|
307
332
|
};
|
|
308
333
|
}
|
|
309
|
-
var
|
|
334
|
+
var CHECK_CID, BLURRED_CID, cachedAssetsDir;
|
|
310
335
|
var init_assets = __esm({
|
|
311
336
|
"src/reports/maintenance-email/assets/index.ts"() {
|
|
312
337
|
"use strict";
|
|
313
|
-
here = dirname2(fileURLToPath2(import.meta.url));
|
|
314
338
|
CHECK_CID = "rd-check-png";
|
|
315
339
|
BLURRED_CID = "rd-blurred-tests-jpg";
|
|
340
|
+
cachedAssetsDir = null;
|
|
316
341
|
}
|
|
317
342
|
});
|
|
318
343
|
|
|
@@ -2940,8 +2965,8 @@ import { fileURLToPath } from "url";
|
|
|
2940
2965
|
import { dirname, join as join18 } from "path";
|
|
2941
2966
|
function selfPackageVersion(callerImportMetaUrl) {
|
|
2942
2967
|
try {
|
|
2943
|
-
const
|
|
2944
|
-
const raw = readFileSync(join18(
|
|
2968
|
+
const here2 = dirname(fileURLToPath(callerImportMetaUrl));
|
|
2969
|
+
const raw = readFileSync(join18(here2, "..", "..", "package.json"), "utf-8");
|
|
2945
2970
|
const pkg = JSON.parse(raw);
|
|
2946
2971
|
return pkg.version ?? "0.0.0";
|
|
2947
2972
|
} catch {
|
|
@@ -3498,8 +3523,8 @@ function resolvePackageVersion(fromDir) {
|
|
|
3498
3523
|
}
|
|
3499
3524
|
|
|
3500
3525
|
// src/cli/bin.ts
|
|
3501
|
-
var
|
|
3502
|
-
var version = resolvePackageVersion(
|
|
3526
|
+
var here = dirname5(fileURLToPath3(import.meta.url));
|
|
3527
|
+
var version = resolvePackageVersion(here);
|
|
3503
3528
|
var AUDIT_DESCRIPTIONS = {
|
|
3504
3529
|
deps: "Diff site package.json against the bundled baseline version map.",
|
|
3505
3530
|
lighthouse: "Run @lhci/cli autorun using the canonical lighthouserc.",
|