@theholocron/cli 5.0.0-alpha.555 → 5.0.0-alpha.557

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.mjs CHANGED
@@ -10401,24 +10401,32 @@ function previewInstance(app, options) {
10401
10401
  /**
10402
10402
  * The project, domain and deployment target an app's `--env` target goes to. `production` is the project named like the
10403
10403
  * app, as its production target. `preview` is the instance the app declares in its `deployment` options
10404
- * (`instances: { preview: { project, domain } }`): a project of its own, deployed as that project's production target
10405
- * with the `crons` left out of its `vercel.json`, because the crons belong to production. An app that declares no preview
10406
- * instance keeps the earlier meaning: a Vercel preview deployment of its one project.
10404
+ * (`instances: { preview: { project, domain } }`): a project of its own, deployed as that project's production target. An
10405
+ * app that declares no preview instance keeps the earlier meaning: a Vercel preview deployment of its one project.
10406
+ *
10407
+ * Only one instance runs the app's `crons` (the `crons` option, `"production"` by default): the payload of the other
10408
+ * leaves them out of `vercel.json`. A cron dispatches through the App installed on the repository, so the instance whose
10409
+ * App holds the installation has to be the one that runs them (spec `tech-sentinel-preview-instance`).
10407
10410
  *
10408
10411
  * @param app - The app folder's name.
10409
10412
  * @param options - The `deployment` provider's options from the app's config.
10410
10413
  * @param target - The target `--env` named.
10411
- * @throws {ConfigError} For an `instances.preview` that is not an object with a `project` name.
10414
+ * @throws {ConfigError} For an `instances.preview` that is not an object with a `project` name, a `crons` that is neither
10415
+ * `"production"` nor `"preview"`, or `crons: "preview"` with no preview instance declared.
10412
10416
  */
10413
10417
  function appInstance(app, options, target) {
10414
10418
  const domain = typeof options.domain === "string" ? { domain: options.domain } : {};
10419
+ const declared = previewInstance(app, options);
10420
+ const owner = options.crons ?? "production";
10421
+ if (owner !== "production" && owner !== "preview") throw new ConfigError$1(`${app}: \`deployment\` option \`crons\` is "production" or "preview", got ${JSON.stringify(owner)}`);
10422
+ if (owner === "preview" && !declared) throw new ConfigError$1(`${app}: \`crons: "preview"\` needs \`instances.preview\`, which it does not declare`);
10423
+ const omitCrons = declared !== void 0 && owner !== target;
10415
10424
  if (target === "production") return {
10416
10425
  project: app,
10417
10426
  ...domain,
10418
10427
  production: true,
10419
- omitCrons: false
10428
+ omitCrons
10420
10429
  };
10421
- const declared = previewInstance(app, options);
10422
10430
  if (!declared) return {
10423
10431
  project: app,
10424
10432
  ...domain,
@@ -10428,7 +10436,7 @@ function appInstance(app, options, target) {
10428
10436
  return {
10429
10437
  ...declared,
10430
10438
  production: true,
10431
- omitCrons: true
10439
+ omitCrons
10432
10440
  };
10433
10441
  }
10434
10442
  // src/commands/app-plan/app-plan.ts
@@ -10518,7 +10526,7 @@ async function runAppDeploy(input) {
10518
10526
  print,
10519
10527
  ...instance.omitCrons ? {
10520
10528
  omitCrons: true,
10521
- outDir: join(app.dir, ".vercel-deploy-preview")
10529
+ outDir: join(app.dir, ".vercel-deploy-no-crons")
10522
10530
  } : {}
10523
10531
  });
10524
10532
  if (result.status === "fail" || !result.outDir) return fail(`stage: ${result.message ?? "no payload was made"}`);