betterstart-cli 0.0.20 → 0.0.21

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.js CHANGED
@@ -3056,7 +3056,7 @@ async function resolvePasswordEnvValue(options) {
3056
3056
  options.overwriteEnvKeys.add(options.key);
3057
3057
  return result.trim();
3058
3058
  }
3059
- async function promptResendConfig(cwd) {
3059
+ async function collectResendConfig(cwd) {
3060
3060
  const overwriteEnvKeys = /* @__PURE__ */ new Set();
3061
3061
  const apiKey = await resolvePasswordEnvValue({
3062
3062
  cwd,
@@ -3083,9 +3083,8 @@ async function promptResendConfig(cwd) {
3083
3083
  }
3084
3084
  }
3085
3085
  });
3086
- const envResult = appendEnvVars(
3087
- cwd,
3088
- [
3086
+ return {
3087
+ sections: [
3089
3088
  {
3090
3089
  header: "Email (Resend)",
3091
3090
  vars: [
@@ -3094,15 +3093,19 @@ async function promptResendConfig(cwd) {
3094
3093
  ]
3095
3094
  }
3096
3095
  ],
3097
- overwriteEnvKeys
3098
- );
3096
+ overwriteKeys: overwriteEnvKeys
3097
+ };
3098
+ }
3099
+ async function promptResendConfig(cwd) {
3100
+ const collected = await collectResendConfig(cwd);
3101
+ const envResult = appendEnvVars(cwd, collected.sections, collected.overwriteKeys);
3099
3102
  return {
3100
3103
  configured: true,
3101
3104
  addedEnvKeys: envResult.added,
3102
3105
  updatedEnvKeys: envResult.updated
3103
3106
  };
3104
3107
  }
3105
- async function promptR2Config(cwd) {
3108
+ async function collectR2Config(cwd) {
3106
3109
  const overwriteEnvKeys = /* @__PURE__ */ new Set();
3107
3110
  const accountId = await resolveTextEnvValue({
3108
3111
  cwd,
@@ -3157,9 +3160,8 @@ async function promptR2Config(cwd) {
3157
3160
  }
3158
3161
  }
3159
3162
  });
3160
- const envResult = appendEnvVars(
3161
- cwd,
3162
- [
3163
+ return {
3164
+ sections: [
3163
3165
  {
3164
3166
  header: "Storage (Cloudflare R2)",
3165
3167
  vars: [
@@ -3171,14 +3173,34 @@ async function promptR2Config(cwd) {
3171
3173
  ]
3172
3174
  }
3173
3175
  ],
3174
- overwriteEnvKeys
3175
- );
3176
+ overwriteKeys: overwriteEnvKeys
3177
+ };
3178
+ }
3179
+ async function promptR2Config(cwd) {
3180
+ const collected = await collectR2Config(cwd);
3181
+ const envResult = appendEnvVars(cwd, collected.sections, collected.overwriteKeys);
3176
3182
  return {
3177
3183
  configured: true,
3178
3184
  addedEnvKeys: envResult.added,
3179
3185
  updatedEnvKeys: envResult.updated
3180
3186
  };
3181
3187
  }
3188
+ async function collectIntegrationConfig(cwd, integrationIds) {
3189
+ const sections = [];
3190
+ const overwriteKeys = /* @__PURE__ */ new Set();
3191
+ for (const integrationId of resolveIntegrationInstallOrder(integrationIds)) {
3192
+ const definition = getIntegrationDefinition(integrationId);
3193
+ const collected = definition.configure === "resend" ? await collectResendConfig(cwd) : definition.configure === "r2" ? await collectR2Config(cwd) : void 0;
3194
+ if (!collected) {
3195
+ continue;
3196
+ }
3197
+ sections.push(...collected.sections);
3198
+ for (const key of collected.overwriteKeys) {
3199
+ overwriteKeys.add(key);
3200
+ }
3201
+ }
3202
+ return { sections, overwriteKeys };
3203
+ }
3182
3204
  async function configureIntegration(definition, cwd, interactive) {
3183
3205
  if (definition.configure === "resend") {
3184
3206
  if (interactive) {
@@ -21130,14 +21152,14 @@ ${styleText(
21130
21152
  value: "resend",
21131
21153
  label: "Resend"
21132
21154
  },
21133
- {
21134
- value: "skip",
21135
- label: "Skip"
21136
- },
21137
21155
  {
21138
21156
  value: "cloudflare",
21139
21157
  label: `Cloudflare ${styleText("dim", "(coming soon)")}`,
21140
21158
  disabled: true
21159
+ },
21160
+ {
21161
+ value: "skip",
21162
+ label: "Skip"
21141
21163
  }
21142
21164
  ],
21143
21165
  initialValue: "resend"
@@ -23619,6 +23641,7 @@ async function runInitCommand(name, options) {
23619
23641
  integrations: [],
23620
23642
  storage: "local"
23621
23643
  } : await promptPlugins();
23644
+ const collectedIntegrationConfig = !options.yes && pluginSelection.integrations.length > 0 ? await collectIntegrationConfig(cwd, pluginSelection.integrations) : { sections: [], overwriteKeys: /* @__PURE__ */ new Set() };
23622
23645
  let databaseUrl;
23623
23646
  const existingDbUrl = readExistingDbUrl(cwd);
23624
23647
  if (options.yes) {
@@ -23678,6 +23701,13 @@ async function runInitCommand(name, options) {
23678
23701
  });
23679
23702
  s.message("Environment variables");
23680
23703
  const envResult = scaffoldEnv(cwd, { databaseUrl, namespace });
23704
+ if (collectedIntegrationConfig.sections.length > 0) {
23705
+ appendEnvVars(
23706
+ cwd,
23707
+ collectedIntegrationConfig.sections,
23708
+ collectedIntegrationConfig.overwriteKeys
23709
+ );
23710
+ }
23681
23711
  const envCount = envResult.added.length + envResult.updated.length;
23682
23712
  results.push({
23683
23713
  label: "Environment variables",
@@ -23806,7 +23836,9 @@ async function runInitCommand(name, options) {
23806
23836
  config: resolvedPluginInstallResult.config,
23807
23837
  pm,
23808
23838
  integrationIds: pluginSelection.integrations,
23809
- interactive: !options.yes,
23839
+ // Secrets were already collected up front and written to .env.local,
23840
+ // so the install runs without prompting (rule: no mid-scaffold input).
23841
+ interactive: false,
23810
23842
  includeBiome: project2.linter.type === "none"
23811
23843
  });
23812
23844
  })() : Promise.resolve({