astroidjs 0.3.0 → 0.3.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.
Files changed (2) hide show
  1. package/bin/astroid.mjs +32 -1
  2. package/package.json +2 -2
package/bin/astroid.mjs CHANGED
@@ -124,7 +124,7 @@ async function cmdGenerate(cwd, flags, { quiet = false } = {}) {
124
124
  }
125
125
 
126
126
  async function cmdDoctor(cwd, flags) {
127
- const { generateAstroidProject, generateAstroidScaffoldFiles, astroidUsesQueues } =
127
+ const { generateAstroidProject, generateAstroidScaffoldFiles, astroidUsesQueues, astroidCrons } =
128
128
  await import(GENERATORS_URL);
129
129
  const { config, path: configPath } = await loadConfig(cwd, flags.config);
130
130
 
@@ -224,6 +224,37 @@ async function cmdDoctor(cwd, flags) {
224
224
  else err("wrangler.jsonc has no R2 `MEDIA` binding.");
225
225
  if (/"main"\s*:\s*"src\/worker\.ts"/.test(w)) ok("wrangler: `main` → src/worker.ts");
226
226
  else warn("wrangler.jsonc `main` does not point at src/worker.ts.");
227
+
228
+ // Cron triggers. The generated `scheduled` handler dispatches on a fixed set
229
+ // of cron strings (`astroidCrons`); every one of them MUST be declared here
230
+ // or Cloudflare never fires it and that job silently never runs. Because
231
+ // wrangler.jsonc is scaffold-once, a config that gains a cron (e.g. the daily
232
+ // health scan alongside the hourly catalog sync) can't update it — the exact
233
+ // drift that shipped a dead daily scan while the handler dispatched on it and
234
+ // doctor reported healthy. Parse the array from the JSONC text rather than
235
+ // JSON.parse (comments/trailing commas), matching the binding checks above.
236
+ const expectedCrons = astroidCrons(config);
237
+ const cronsMatch = w.match(/"crons"\s*:\s*\[([^\]]*)\]/);
238
+ if (!cronsMatch) {
239
+ err(
240
+ "wrangler.jsonc has no `triggers.crons`, but the generated `scheduled` handler " +
241
+ `dispatches on ${expectedCrons.map((c) => `"${c}"`).join(", ")}. ` +
242
+ `Add: "triggers": { "crons": ${JSON.stringify(expectedCrons)} }`,
243
+ );
244
+ } else {
245
+ const declaredCrons = [...cronsMatch[1].matchAll(/"([^"]+)"/g)].map((m) => m[1]);
246
+ const missingCrons = expectedCrons.filter((c) => !declaredCrons.includes(c));
247
+ if (missingCrons.length > 0) {
248
+ err(
249
+ `wrangler.jsonc \`triggers.crons\` is missing ${missingCrons.map((c) => `"${c}"`).join(", ")} — ` +
250
+ "the generated `scheduled` handler dispatches on it, so an undeclared cron silently " +
251
+ `never fires. Set crons to ${JSON.stringify(expectedCrons)}.`,
252
+ );
253
+ } else {
254
+ ok(`wrangler: triggers.crons declares all ${expectedCrons.length} generated cron(s)`);
255
+ }
256
+ }
257
+
227
258
  const placeholders = w.match(/<run:[^>]*>|<your-[^>]*>/g);
228
259
  if (placeholders) {
229
260
  warn(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astroidjs",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Astroid — an opinionated meta-framework over Louise Toolkit and Astro for building editable, multi-editor sites on Cloudflare Workers.",
5
5
  "keywords": [
6
6
  "astro",
@@ -60,7 +60,7 @@
60
60
  "access": "public"
61
61
  },
62
62
  "dependencies": {
63
- "louise-toolkit": "0.17.0"
63
+ "louise-toolkit": "0.18.0"
64
64
  },
65
65
  "peerDependencies": {
66
66
  "solid-js": "^1.9.0"