@moku-labs/web 1.13.0 → 1.13.1

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.cjs CHANGED
@@ -6108,7 +6108,7 @@ async function readWranglerConfig(cwd) {
6108
6108
  /** Relative path of the generated wrangler config. */
6109
6109
  const WRANGLER_PATH = "wrangler.jsonc";
6110
6110
  /** Relative path of the generated GitHub Actions workflow. */
6111
- const WORKFLOW_PATH = ".github/workflows/deploy.yml";
6111
+ const WORKFLOW_PATH$1 = ".github/workflows/deploy.yml";
6112
6112
  /** Wrangler `compatibility_date` used when the deploy config does not pin one. */
6113
6113
  const DEFAULT_COMPATIBILITY_DATE = "2024-01-01";
6114
6114
  /**
@@ -6166,12 +6166,12 @@ async function writeScaffolding(input) {
6166
6166
  result
6167
6167
  });
6168
6168
  if (ci) await reconcile({
6169
- relativePath: WORKFLOW_PATH,
6169
+ relativePath: WORKFLOW_PATH$1,
6170
6170
  expected: generateGithubWorkflow({
6171
6171
  slug,
6172
6172
  ...options.workflowTrigger ? { trigger: options.workflowTrigger } : {}
6173
6173
  }),
6174
- existing: await readMaybe(cwd, WORKFLOW_PATH),
6174
+ existing: await readMaybe(cwd, WORKFLOW_PATH$1),
6175
6175
  cwd,
6176
6176
  check,
6177
6177
  result
@@ -6869,30 +6869,39 @@ async function resolveTrigger(ctx, choice) {
6869
6869
  if (choice === 0) return "auto";
6870
6870
  return await ctx.state.select("How should the versioned deploy be triggered?", ["On a version tag push (v*) + the manual Run-workflow button", "Manual Run-workflow button only (workflow_dispatch)"]) === 0 ? "versioned-tag" : "dispatch";
6871
6871
  }
6872
+ /** Relative path of the GitHub Actions workflow the deploy plugin scaffolds. */
6873
+ const WORKFLOW_PATH = ".github/workflows/deploy.yml";
6872
6874
  /**
6873
6875
  * Offer to scaffold a GitHub Actions deploy workflow, letting the user choose how it is
6874
- * triggered, then remind them which repo secrets to add. A no-op past a "skip" choice.
6876
+ * triggered, then remind them which repo secrets to add. Short-circuits WITHOUT prompting
6877
+ * when {@link WORKFLOW_PATH} already exists — CI is already wired and the scaffold is
6878
+ * idempotent (a second setup would only no-op), so there is nothing to ask; it just
6879
+ * confirms the file and re-shows the secrets reminder. A no-op past a "skip" choice.
6875
6880
  *
6876
6881
  * @param ctx - The cli plugin context.
6882
+ * @param cwd - The project root (where `.github/workflows/deploy.yml` lives).
6877
6883
  * @returns Resolves once any chosen workflow has been scaffolded.
6878
6884
  * @example
6879
- * await offerWorkflowSetup(ctx);
6885
+ * await offerWorkflowSetup(ctx, process.cwd());
6880
6886
  */
6881
- async function offerWorkflowSetup(ctx) {
6887
+ async function offerWorkflowSetup(ctx, cwd) {
6882
6888
  ctx.state.render.heading("Automate future deploys (GitHub Actions)");
6889
+ if ((0, node_fs.existsSync)(node_path$1.default.join(cwd, WORKFLOW_PATH))) {
6890
+ ctx.state.render.check(true, `${WORKFLOW_PATH} already exists (left unchanged)`);
6891
+ ctx.state.render.info(SECRETS_HELP);
6892
+ return;
6893
+ }
6883
6894
  const trigger = await resolveTrigger(ctx, await ctx.state.select("Set up a deploy workflow?", [
6884
6895
  "Auto-deploy on every push to main",
6885
6896
  "Manual / versioned deploy (choose trigger)",
6886
6897
  "Skip for now"
6887
6898
  ]));
6888
6899
  if (trigger === null) return;
6889
- const result = await ctx.require(deployPlugin).init({
6900
+ const wrote = (await ctx.require(deployPlugin).init({
6890
6901
  ci: true,
6891
6902
  workflowTrigger: trigger
6892
- });
6893
- const workflowPath = ".github/workflows/deploy.yml";
6894
- const wrote = result.written.includes(workflowPath);
6895
- ctx.state.render.check(true, wrote ? `wrote ${workflowPath}` : `${workflowPath} already exists (left unchanged)`);
6903
+ })).written.includes(WORKFLOW_PATH);
6904
+ ctx.state.render.check(true, wrote ? `wrote ${WORKFLOW_PATH}` : `${WORKFLOW_PATH} already exists (left unchanged)`);
6896
6905
  ctx.state.render.info(SECRETS_HELP);
6897
6906
  }
6898
6907
  /**
@@ -7088,7 +7097,7 @@ async function runDeployWizard(ctx, options) {
7088
7097
  ctx.state.render.check(notFoundOk, `${ctx.config.notFoundFile} present`, notFoundOk ? void 0 : "Set build.notFound so the SSG emits it (CF Pages else flips to SPA mode).");
7089
7098
  ctx.state.render.info("Tip: run `bun run preview` to eyeball the built site before deploying.");
7090
7099
  const outcome = await runDeployStep(ctx, options);
7091
- if (!(outcome.deployed === false && outcome.reason === "failed")) await offerWorkflowSetup(ctx);
7100
+ if (!(outcome.deployed === false && outcome.reason === "failed")) await offerWorkflowSetup(ctx, cwd);
7092
7101
  return outcome;
7093
7102
  }
7094
7103
  //#endregion
package/dist/index.mjs CHANGED
@@ -6095,7 +6095,7 @@ async function readWranglerConfig(cwd) {
6095
6095
  /** Relative path of the generated wrangler config. */
6096
6096
  const WRANGLER_PATH = "wrangler.jsonc";
6097
6097
  /** Relative path of the generated GitHub Actions workflow. */
6098
- const WORKFLOW_PATH = ".github/workflows/deploy.yml";
6098
+ const WORKFLOW_PATH$1 = ".github/workflows/deploy.yml";
6099
6099
  /** Wrangler `compatibility_date` used when the deploy config does not pin one. */
6100
6100
  const DEFAULT_COMPATIBILITY_DATE = "2024-01-01";
6101
6101
  /**
@@ -6153,12 +6153,12 @@ async function writeScaffolding(input) {
6153
6153
  result
6154
6154
  });
6155
6155
  if (ci) await reconcile({
6156
- relativePath: WORKFLOW_PATH,
6156
+ relativePath: WORKFLOW_PATH$1,
6157
6157
  expected: generateGithubWorkflow({
6158
6158
  slug,
6159
6159
  ...options.workflowTrigger ? { trigger: options.workflowTrigger } : {}
6160
6160
  }),
6161
- existing: await readMaybe(cwd, WORKFLOW_PATH),
6161
+ existing: await readMaybe(cwd, WORKFLOW_PATH$1),
6162
6162
  cwd,
6163
6163
  check,
6164
6164
  result
@@ -6856,30 +6856,39 @@ async function resolveTrigger(ctx, choice) {
6856
6856
  if (choice === 0) return "auto";
6857
6857
  return await ctx.state.select("How should the versioned deploy be triggered?", ["On a version tag push (v*) + the manual Run-workflow button", "Manual Run-workflow button only (workflow_dispatch)"]) === 0 ? "versioned-tag" : "dispatch";
6858
6858
  }
6859
+ /** Relative path of the GitHub Actions workflow the deploy plugin scaffolds. */
6860
+ const WORKFLOW_PATH = ".github/workflows/deploy.yml";
6859
6861
  /**
6860
6862
  * Offer to scaffold a GitHub Actions deploy workflow, letting the user choose how it is
6861
- * triggered, then remind them which repo secrets to add. A no-op past a "skip" choice.
6863
+ * triggered, then remind them which repo secrets to add. Short-circuits WITHOUT prompting
6864
+ * when {@link WORKFLOW_PATH} already exists — CI is already wired and the scaffold is
6865
+ * idempotent (a second setup would only no-op), so there is nothing to ask; it just
6866
+ * confirms the file and re-shows the secrets reminder. A no-op past a "skip" choice.
6862
6867
  *
6863
6868
  * @param ctx - The cli plugin context.
6869
+ * @param cwd - The project root (where `.github/workflows/deploy.yml` lives).
6864
6870
  * @returns Resolves once any chosen workflow has been scaffolded.
6865
6871
  * @example
6866
- * await offerWorkflowSetup(ctx);
6872
+ * await offerWorkflowSetup(ctx, process.cwd());
6867
6873
  */
6868
- async function offerWorkflowSetup(ctx) {
6874
+ async function offerWorkflowSetup(ctx, cwd) {
6869
6875
  ctx.state.render.heading("Automate future deploys (GitHub Actions)");
6876
+ if (existsSync(path.join(cwd, WORKFLOW_PATH))) {
6877
+ ctx.state.render.check(true, `${WORKFLOW_PATH} already exists (left unchanged)`);
6878
+ ctx.state.render.info(SECRETS_HELP);
6879
+ return;
6880
+ }
6870
6881
  const trigger = await resolveTrigger(ctx, await ctx.state.select("Set up a deploy workflow?", [
6871
6882
  "Auto-deploy on every push to main",
6872
6883
  "Manual / versioned deploy (choose trigger)",
6873
6884
  "Skip for now"
6874
6885
  ]));
6875
6886
  if (trigger === null) return;
6876
- const result = await ctx.require(deployPlugin).init({
6887
+ const wrote = (await ctx.require(deployPlugin).init({
6877
6888
  ci: true,
6878
6889
  workflowTrigger: trigger
6879
- });
6880
- const workflowPath = ".github/workflows/deploy.yml";
6881
- const wrote = result.written.includes(workflowPath);
6882
- ctx.state.render.check(true, wrote ? `wrote ${workflowPath}` : `${workflowPath} already exists (left unchanged)`);
6890
+ })).written.includes(WORKFLOW_PATH);
6891
+ ctx.state.render.check(true, wrote ? `wrote ${WORKFLOW_PATH}` : `${WORKFLOW_PATH} already exists (left unchanged)`);
6883
6892
  ctx.state.render.info(SECRETS_HELP);
6884
6893
  }
6885
6894
  /**
@@ -7075,7 +7084,7 @@ async function runDeployWizard(ctx, options) {
7075
7084
  ctx.state.render.check(notFoundOk, `${ctx.config.notFoundFile} present`, notFoundOk ? void 0 : "Set build.notFound so the SSG emits it (CF Pages else flips to SPA mode).");
7076
7085
  ctx.state.render.info("Tip: run `bun run preview` to eyeball the built site before deploying.");
7077
7086
  const outcome = await runDeployStep(ctx, options);
7078
- if (!(outcome.deployed === false && outcome.reason === "failed")) await offerWorkflowSetup(ctx);
7087
+ if (!(outcome.deployed === false && outcome.reason === "failed")) await offerWorkflowSetup(ctx, cwd);
7079
7088
  return outcome;
7080
7089
  }
7081
7090
  //#endregion
package/package.json CHANGED
@@ -126,5 +126,5 @@
126
126
  "test:build-e2e": "bun test src/plugins/build/__tests__/e2e/",
127
127
  "test:coverage": "vitest run --project unit --project integration --coverage"
128
128
  },
129
- "version": "1.13.0"
129
+ "version": "1.13.1"
130
130
  }