create-nextly-app 0.0.2-alpha.11 → 0.0.2-alpha.13

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.
@@ -18242,22 +18242,42 @@ async function generateMediaRoutes(cwd, projectInfo) {
18242
18242
 
18243
18243
  // src/generators/next-config.ts
18244
18244
  var import_fs_extra5 = __toESM(require_lib(), 1);
18245
- var SERVER_EXTERNAL_PACKAGES = [
18245
+ var COMMON_SERVER_EXTERNAL_PACKAGES = [
18246
18246
  "nextly",
18247
18247
  "@nextlyhq/adapter-drizzle",
18248
- "@nextlyhq/adapter-postgres",
18249
- "@nextlyhq/adapter-mysql",
18250
- "@nextlyhq/adapter-sqlite",
18251
18248
  "drizzle-orm",
18252
18249
  "drizzle-kit",
18253
- "pg",
18254
- "mysql2",
18255
- "better-sqlite3",
18256
18250
  "bcryptjs",
18257
18251
  "sharp",
18258
18252
  "esbuild"
18259
18253
  ];
18260
- async function patchNextConfig(cwd) {
18254
+ var DATABASE_SERVER_EXTERNAL_PACKAGES = {
18255
+ postgresql: ["@nextlyhq/adapter-postgres", "pg"],
18256
+ mysql: ["@nextlyhq/adapter-mysql", "mysql2"],
18257
+ sqlite: ["@nextlyhq/adapter-sqlite", "better-sqlite3"]
18258
+ };
18259
+ function getServerExternalPackages(database) {
18260
+ return [
18261
+ ...COMMON_SERVER_EXTERNAL_PACKAGES,
18262
+ ...DATABASE_SERVER_EXTERNAL_PACKAGES[database.type]
18263
+ ];
18264
+ }
18265
+ function buildNextConfigTemplate(database) {
18266
+ const packagesArray = JSON.stringify(
18267
+ getServerExternalPackages(database),
18268
+ null,
18269
+ 2
18270
+ ).replace(/\n/g, "\n ");
18271
+ return `import type { NextConfig } from "next";
18272
+
18273
+ const nextConfig: NextConfig = {
18274
+ serverExternalPackages: ${packagesArray},
18275
+ };
18276
+
18277
+ export default nextConfig;
18278
+ `;
18279
+ }
18280
+ async function patchNextConfig(cwd, database) {
18261
18281
  const candidates = ["next.config.ts", "next.config.mjs", "next.config.js"];
18262
18282
  let configPath = null;
18263
18283
  for (const name of candidates) {
@@ -18274,7 +18294,11 @@ async function patchNextConfig(cwd) {
18274
18294
  if (content.includes("serverExternalPackages")) {
18275
18295
  return;
18276
18296
  }
18277
- const packagesArray = JSON.stringify(SERVER_EXTERNAL_PACKAGES, null, 4).replace(/\n/g, "\n ");
18297
+ const packagesArray = JSON.stringify(
18298
+ getServerExternalPackages(database),
18299
+ null,
18300
+ 2
18301
+ ).replace(/\n/g, "\n ");
18278
18302
  const configObjectPattern = /(const\s+\w+\s*(?::\s*NextConfig\s*)?=\s*\{)/;
18279
18303
  if (configObjectPattern.test(content)) {
18280
18304
  const patched = content.replace(
@@ -25044,6 +25068,10 @@ async function generatePackageJson(projectName, database, useYalc = false, proje
25044
25068
  // don't ship a /search page simply won't invoke it.
25045
25069
  pagefind: "^1.1.0"
25046
25070
  };
25071
+ const onlyBuiltDependencies = ["sharp", "esbuild", "unrs-resolver"];
25072
+ if (database.type === "sqlite") {
25073
+ onlyBuiltDependencies.push("better-sqlite3");
25074
+ }
25047
25075
  const pkg = {
25048
25076
  name: projectName,
25049
25077
  version: "0.1.0",
@@ -25074,7 +25102,10 @@ async function generatePackageJson(projectName, database, useYalc = false, proje
25074
25102
  "types:generate": "nextly generate:types"
25075
25103
  },
25076
25104
  dependencies,
25077
- devDependencies
25105
+ devDependencies,
25106
+ pnpm: {
25107
+ onlyBuiltDependencies
25108
+ }
25078
25109
  };
25079
25110
  return JSON.stringify(pkg, null, 2) + "\n";
25080
25111
  }
@@ -25180,6 +25211,11 @@ async function copyTemplate(options) {
25180
25211
  if (database.type === "sqlite") {
25181
25212
  await import_fs_extra8.default.ensureDir(path.join(targetDir, "data"));
25182
25213
  }
25214
+ await import_fs_extra8.default.writeFile(
25215
+ path.join(targetDir, "next.config.ts"),
25216
+ buildNextConfigTemplate(database),
25217
+ "utf-8"
25218
+ );
25183
25219
  const placeholders = buildPlaceholderMap({ database, databaseUrl });
25184
25220
  if (approach) {
25185
25221
  placeholders["{{approach}}"] = approach;
@@ -28489,11 +28525,7 @@ function cwdProjectName(cwd) {
28489
28525
  return basename;
28490
28526
  }
28491
28527
  async function createNextly(options = {}) {
28492
- const {
28493
- defaults = false,
28494
- skipInstall = false,
28495
- useYalc = false
28496
- } = options;
28528
+ const { defaults = false, skipInstall = false, useYalc = false } = options;
28497
28529
  let installInCwd = options.installInCwd ?? false;
28498
28530
  let { cwd = process.cwd() } = options;
28499
28531
  let isFreshProject = false;
@@ -28761,7 +28793,7 @@ async function createNextly(options = {}) {
28761
28793
  await generateAdminPage(cwd, projectInfo);
28762
28794
  await generateMediaRoutes(cwd, projectInfo);
28763
28795
  await generateTypesDirectory(cwd, projectInfo);
28764
- await patchNextConfig(cwd);
28796
+ await patchNextConfig(cwd, database);
28765
28797
  }
28766
28798
  const envDatabase = databaseUrl ? { ...database, connectionUrl: databaseUrl, envExample: databaseUrl } : database;
28767
28799
  await generateEnv(cwd, envDatabase);
@@ -28831,5 +28863,5 @@ async function createNextly(options = {}) {
28831
28863
  */
28832
28864
 
28833
28865
  export { __commonJS, __require, __toESM, capture, createNextly, init, resolveProjectArg, shutdown, validateProjectName };
28834
- //# sourceMappingURL=chunk-RPGFJSDP.mjs.map
28835
- //# sourceMappingURL=chunk-RPGFJSDP.mjs.map
28866
+ //# sourceMappingURL=chunk-AATWR2UA.mjs.map
28867
+ //# sourceMappingURL=chunk-AATWR2UA.mjs.map