@reddoorla/maintenance 0.10.0 → 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/index.d.ts CHANGED
@@ -351,4 +351,22 @@ type DueItem = {
351
351
  */
352
352
  declare function findDueReports(websites: WebsiteRow[], reports: ReportRow[], today: Date): DueItem[];
353
353
 
354
- export { ALL_AUDIT_NAMES, ALL_RECIPE_NAMES, type AirtableInventoryOptions, AuditName, AuditResult, type BumpDepsOptions, type ConvertToPnpmOptions, DEFAULT_INIT_STEPS, type DraftOptions, type DraftResult, type DueItem, type HeaderImage, type InitOptions, type InitResult, type InitStep, type InitStepResult, InventoryProvider, type LighthouseScores, type LocalPathOptions, type OnboardAudit, type OnboardOptions, type OrchestrateOptions, RecipeName, RecipeResult, type RenderResult, type ReportData, type ReportType, Site, type UpgradeSvelte4to5Options, a11yAudit, a11yFixturesPage, bumpDeps, convertToPnpm, depsAudit, draftReportForSite, findDueReports, fromAirtableBase, fromJsonFile, init, isRecipeName, lighthouseAudit, lintAudit, localPath, onboard, renderReportHtml, runAudits, runAuditsAcross, securityAudit, sendApprovedReports, svelteCodemods, upgradeSvelte4to5 };
354
+ declare const CHECK_CID = "rd-check-png";
355
+ declare const BLURRED_CID = "rd-blurred-tests-jpg";
356
+ type BundledImage = {
357
+ bytes: Uint8Array;
358
+ contentType: string;
359
+ cid: string;
360
+ filename: string;
361
+ };
362
+ /**
363
+ * Read the bundled image bytes from disk. Both Maintenance and Testing
364
+ * variants reference `check.png`; only the Maintenance variant references
365
+ * `blurredTests.jpg`.
366
+ */
367
+ declare function loadBundledImages(): Promise<{
368
+ check: BundledImage;
369
+ blurred: BundledImage;
370
+ }>;
371
+
372
+ export { ALL_AUDIT_NAMES, ALL_RECIPE_NAMES, type AirtableInventoryOptions, AuditName, AuditResult, BLURRED_CID, type BumpDepsOptions, type BundledImage, CHECK_CID, type ConvertToPnpmOptions, DEFAULT_INIT_STEPS, type DraftOptions, type DraftResult, type DueItem, type HeaderImage, type InitOptions, type InitResult, type InitStep, type InitStepResult, InventoryProvider, type LighthouseScores, type LocalPathOptions, type OnboardAudit, type OnboardOptions, type OrchestrateOptions, RecipeName, RecipeResult, type RenderResult, type ReportData, type ReportType, Site, type UpgradeSvelte4to5Options, a11yAudit, a11yFixturesPage, bumpDeps, convertToPnpm, depsAudit, draftReportForSite, findDueReports, fromAirtableBase, fromJsonFile, init, isRecipeName, lighthouseAudit, lintAudit, loadBundledImages, localPath, onboard, renderReportHtml, runAudits, runAuditsAcross, securityAudit, sendApprovedReports, svelteCodemods, upgradeSvelte4to5 };
package/dist/index.js CHANGED
@@ -1809,8 +1809,8 @@ import { fileURLToPath } from "url";
1809
1809
  import { dirname, join as join16 } from "path";
1810
1810
  function selfPackageVersion(callerImportMetaUrl) {
1811
1811
  try {
1812
- const here2 = dirname(fileURLToPath(callerImportMetaUrl));
1813
- const raw = readFileSync(join16(here2, "..", "..", "package.json"), "utf-8");
1812
+ const here = dirname(fileURLToPath(callerImportMetaUrl));
1813
+ const raw = readFileSync(join16(here, "..", "..", "package.json"), "utf-8");
1814
1814
  const pkg = JSON.parse(raw);
1815
1815
  return pkg.version ?? "0.0.0";
1816
1816
  } catch {
@@ -2147,15 +2147,40 @@ import mjml2html from "mjml";
2147
2147
 
2148
2148
  // src/reports/maintenance-email/assets/index.ts
2149
2149
  import { readFile as readFile11 } from "fs/promises";
2150
+ import { existsSync as existsSync2 } from "fs";
2150
2151
  import { dirname as dirname3, join as join19 } from "path";
2151
2152
  import { fileURLToPath as fileURLToPath2 } from "url";
2152
- var here = dirname3(fileURLToPath2(import.meta.url));
2153
2153
  var CHECK_CID = "rd-check-png";
2154
2154
  var BLURRED_CID = "rd-blurred-tests-jpg";
2155
+ var cachedAssetsDir = null;
2156
+ function resolveAssetsDir() {
2157
+ if (cachedAssetsDir) return cachedAssetsDir;
2158
+ let dir = dirname3(fileURLToPath2(import.meta.url));
2159
+ while (true) {
2160
+ const srcCandidate = join19(dir, "src", "reports", "maintenance-email", "assets", "check.png");
2161
+ if (existsSync2(srcCandidate)) {
2162
+ cachedAssetsDir = dirname3(srcCandidate);
2163
+ return cachedAssetsDir;
2164
+ }
2165
+ const distCandidate = join19(dir, "dist", "reports", "maintenance-email", "assets", "check.png");
2166
+ if (existsSync2(distCandidate)) {
2167
+ cachedAssetsDir = dirname3(distCandidate);
2168
+ return cachedAssetsDir;
2169
+ }
2170
+ const parent = dirname3(dir);
2171
+ if (parent === dir) {
2172
+ throw new Error(
2173
+ `loadBundledImages: could not locate maintenance-email assets dir by walking up from ${fileURLToPath2(import.meta.url)}. Checked both src/ and dist/ layouts.`
2174
+ );
2175
+ }
2176
+ dir = parent;
2177
+ }
2178
+ }
2155
2179
  async function loadBundledImages() {
2180
+ const assetsDir = resolveAssetsDir();
2156
2181
  const [check, blurred] = await Promise.all([
2157
- readFile11(join19(here, "check.png")),
2158
- readFile11(join19(here, "blurredTests.jpg"))
2182
+ readFile11(join19(assetsDir, "check.png")),
2183
+ readFile11(join19(assetsDir, "blurredTests.jpg"))
2159
2184
  ]);
2160
2185
  return {
2161
2186
  check: {
@@ -2786,6 +2811,8 @@ function findDueReports(websites, reports, today) {
2786
2811
  export {
2787
2812
  ALL_AUDIT_NAMES,
2788
2813
  ALL_RECIPE_NAMES,
2814
+ BLURRED_CID,
2815
+ CHECK_CID,
2789
2816
  DEFAULT_INIT_STEPS,
2790
2817
  a11yAudit,
2791
2818
  a11yFixturesPage,
@@ -2800,6 +2827,7 @@ export {
2800
2827
  isRecipeName,
2801
2828
  lighthouseAudit,
2802
2829
  lintAudit,
2830
+ loadBundledImages,
2803
2831
  localPath,
2804
2832
  onboard,
2805
2833
  renderReportHtml,