create-nextly-app 0.0.2-alpha.50 → 0.0.2-alpha.52

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
@@ -14316,6 +14316,22 @@ var import_fs_extra3 = __toESM(require_lib());
14316
14316
  function generateNextlySecret() {
14317
14317
  return crypto2__default.default.randomBytes(32).toString("base64");
14318
14318
  }
14319
+ function mentionsDiagnostics(env2) {
14320
+ return /^[ \t]*(?:#[ \t]*)?(?:export[ \t]+)?NEXTLY_DEV_DIAGNOSTICS[ \t]*=/m.test(
14321
+ env2
14322
+ );
14323
+ }
14324
+ var DIAGNOSTICS_BLOCK = `# Development diagnostics (opt-in)
14325
+ # Uncomment to add a _devDiagnostics field to error responses, carrying the
14326
+ # log context of an error and the underlying cause, so a failure names itself
14327
+ # while you build instead of only in the server log.
14328
+ #
14329
+ # Left commented on purpose. It is the SECOND of two independent signals \u2014 the
14330
+ # first is NODE_ENV \u2014 and the second exists precisely because NODE_ENV is a
14331
+ # runtime value a deployment can carry by mistake. A default that ships in this
14332
+ # file would be true in exactly that case, which is the one it guards against.
14333
+ # NEXTLY_DEV_DIAGNOSTICS=1
14334
+ `;
14319
14335
  function getEnvTemplate(database) {
14320
14336
  return `# Nextly Configuration
14321
14337
  # Generated by create-nextly-app
@@ -14329,7 +14345,8 @@ NEXTLY_SECRET=${generateNextlySecret()}
14329
14345
 
14330
14346
  # Application URL
14331
14347
  NEXT_PUBLIC_APP_URL=http://localhost:3000
14332
- `;
14348
+
14349
+ ${DIAGNOSTICS_BLOCK}`;
14333
14350
  }
14334
14351
  async function generateEnv(cwd, database) {
14335
14352
  const envPath = path14__default.default.join(cwd, ".env");
@@ -14342,6 +14359,10 @@ async function generateEnv(cwd, database) {
14342
14359
  await import_fs_extra3.default.appendFile(envPath, "\n" + envContent, "utf-8");
14343
14360
  return { created: false, updated: true };
14344
14361
  }
14362
+ if (!mentionsDiagnostics(existingEnv)) {
14363
+ await import_fs_extra3.default.appendFile(envPath, "\n" + DIAGNOSTICS_BLOCK, "utf-8");
14364
+ return { created: false, updated: true };
14365
+ }
14345
14366
  return { created: false, updated: false };
14346
14367
  }
14347
14368
  await import_fs_extra3.default.writeFile(envPath, envContent, "utf-8");