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/cli.cjs CHANGED
@@ -6259,7 +6259,7 @@ var require_package = __commonJS({
6259
6259
  "package.json"(exports$1, module) {
6260
6260
  module.exports = {
6261
6261
  name: "create-nextly-app",
6262
- version: "0.0.2-alpha.50",
6262
+ version: "0.0.2-alpha.52",
6263
6263
  description: "CLI to scaffold Nextly in your Next.js project",
6264
6264
  license: "MIT",
6265
6265
  type: "module",
@@ -21861,6 +21861,22 @@ var import_fs_extra3 = __toESM(require_lib());
21861
21861
  function generateNextlySecret() {
21862
21862
  return crypto__default.default.randomBytes(32).toString("base64");
21863
21863
  }
21864
+ function mentionsDiagnostics(env2) {
21865
+ return /^[ \t]*(?:#[ \t]*)?(?:export[ \t]+)?NEXTLY_DEV_DIAGNOSTICS[ \t]*=/m.test(
21866
+ env2
21867
+ );
21868
+ }
21869
+ var DIAGNOSTICS_BLOCK = `# Development diagnostics (opt-in)
21870
+ # Uncomment to add a _devDiagnostics field to error responses, carrying the
21871
+ # log context of an error and the underlying cause, so a failure names itself
21872
+ # while you build instead of only in the server log.
21873
+ #
21874
+ # Left commented on purpose. It is the SECOND of two independent signals \u2014 the
21875
+ # first is NODE_ENV \u2014 and the second exists precisely because NODE_ENV is a
21876
+ # runtime value a deployment can carry by mistake. A default that ships in this
21877
+ # file would be true in exactly that case, which is the one it guards against.
21878
+ # NEXTLY_DEV_DIAGNOSTICS=1
21879
+ `;
21864
21880
  function getEnvTemplate(database) {
21865
21881
  return `# Nextly Configuration
21866
21882
  # Generated by create-nextly-app
@@ -21874,7 +21890,8 @@ NEXTLY_SECRET=${generateNextlySecret()}
21874
21890
 
21875
21891
  # Application URL
21876
21892
  NEXT_PUBLIC_APP_URL=http://localhost:3000
21877
- `;
21893
+
21894
+ ${DIAGNOSTICS_BLOCK}`;
21878
21895
  }
21879
21896
  async function generateEnv(cwd, database) {
21880
21897
  const envPath = path15__default.default.join(cwd, ".env");
@@ -21887,6 +21904,10 @@ async function generateEnv(cwd, database) {
21887
21904
  await import_fs_extra3.default.appendFile(envPath, "\n" + envContent, "utf-8");
21888
21905
  return { created: false, updated: true };
21889
21906
  }
21907
+ if (!mentionsDiagnostics(existingEnv)) {
21908
+ await import_fs_extra3.default.appendFile(envPath, "\n" + DIAGNOSTICS_BLOCK, "utf-8");
21909
+ return { created: false, updated: true };
21910
+ }
21890
21911
  return { created: false, updated: false };
21891
21912
  }
21892
21913
  await import_fs_extra3.default.writeFile(envPath, envContent, "utf-8");