create-nextly-app 0.0.2-alpha.51 → 0.0.2-alpha.54

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.
@@ -18292,6 +18292,22 @@ var import_fs_extra3 = __toESM(require_lib(), 1);
18292
18292
  function generateNextlySecret() {
18293
18293
  return crypto.randomBytes(32).toString("base64");
18294
18294
  }
18295
+ function mentionsDiagnostics(env2) {
18296
+ return /^[ \t]*(?:#[ \t]*)?(?:export[ \t]+)?NEXTLY_DEV_DIAGNOSTICS[ \t]*=/m.test(
18297
+ env2
18298
+ );
18299
+ }
18300
+ var DIAGNOSTICS_BLOCK = `# Development diagnostics (opt-in)
18301
+ # Uncomment to add a _devDiagnostics field to error responses, carrying the
18302
+ # log context of an error and the underlying cause, so a failure names itself
18303
+ # while you build instead of only in the server log.
18304
+ #
18305
+ # Left commented on purpose. It is the SECOND of two independent signals \u2014 the
18306
+ # first is NODE_ENV \u2014 and the second exists precisely because NODE_ENV is a
18307
+ # runtime value a deployment can carry by mistake. A default that ships in this
18308
+ # file would be true in exactly that case, which is the one it guards against.
18309
+ # NEXTLY_DEV_DIAGNOSTICS=1
18310
+ `;
18295
18311
  function getEnvTemplate(database) {
18296
18312
  return `# Nextly Configuration
18297
18313
  # Generated by create-nextly-app
@@ -18305,7 +18321,8 @@ NEXTLY_SECRET=${generateNextlySecret()}
18305
18321
 
18306
18322
  # Application URL
18307
18323
  NEXT_PUBLIC_APP_URL=http://localhost:3000
18308
- `;
18324
+
18325
+ ${DIAGNOSTICS_BLOCK}`;
18309
18326
  }
18310
18327
  async function generateEnv(cwd, database) {
18311
18328
  const envPath = path15.join(cwd, ".env");
@@ -18318,6 +18335,10 @@ async function generateEnv(cwd, database) {
18318
18335
  await import_fs_extra3.default.appendFile(envPath, "\n" + envContent, "utf-8");
18319
18336
  return { created: false, updated: true };
18320
18337
  }
18338
+ if (!mentionsDiagnostics(existingEnv)) {
18339
+ await import_fs_extra3.default.appendFile(envPath, "\n" + DIAGNOSTICS_BLOCK, "utf-8");
18340
+ return { created: false, updated: true };
18341
+ }
18321
18342
  return { created: false, updated: false };
18322
18343
  }
18323
18344
  await import_fs_extra3.default.writeFile(envPath, envContent, "utf-8");
@@ -29312,5 +29333,5 @@ async function createNextly(options = {}) {
29312
29333
  */
29313
29334
 
29314
29335
  export { __commonJS, __require, __toESM, capture, createNextly, init, resolveProjectArg, shutdown, validateProjectName };
29315
- //# sourceMappingURL=chunk-MP4HG5TY.mjs.map
29316
- //# sourceMappingURL=chunk-MP4HG5TY.mjs.map
29336
+ //# sourceMappingURL=chunk-APDKXW5L.mjs.map
29337
+ //# sourceMappingURL=chunk-APDKXW5L.mjs.map