create-nextly-app 0.0.2-alpha.12 → 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(
@@ -25187,6 +25211,11 @@ async function copyTemplate(options) {
25187
25211
  if (database.type === "sqlite") {
25188
25212
  await import_fs_extra8.default.ensureDir(path.join(targetDir, "data"));
25189
25213
  }
25214
+ await import_fs_extra8.default.writeFile(
25215
+ path.join(targetDir, "next.config.ts"),
25216
+ buildNextConfigTemplate(database),
25217
+ "utf-8"
25218
+ );
25190
25219
  const placeholders = buildPlaceholderMap({ database, databaseUrl });
25191
25220
  if (approach) {
25192
25221
  placeholders["{{approach}}"] = approach;
@@ -28496,11 +28525,7 @@ function cwdProjectName(cwd) {
28496
28525
  return basename;
28497
28526
  }
28498
28527
  async function createNextly(options = {}) {
28499
- const {
28500
- defaults = false,
28501
- skipInstall = false,
28502
- useYalc = false
28503
- } = options;
28528
+ const { defaults = false, skipInstall = false, useYalc = false } = options;
28504
28529
  let installInCwd = options.installInCwd ?? false;
28505
28530
  let { cwd = process.cwd() } = options;
28506
28531
  let isFreshProject = false;
@@ -28768,7 +28793,7 @@ async function createNextly(options = {}) {
28768
28793
  await generateAdminPage(cwd, projectInfo);
28769
28794
  await generateMediaRoutes(cwd, projectInfo);
28770
28795
  await generateTypesDirectory(cwd, projectInfo);
28771
- await patchNextConfig(cwd);
28796
+ await patchNextConfig(cwd, database);
28772
28797
  }
28773
28798
  const envDatabase = databaseUrl ? { ...database, connectionUrl: databaseUrl, envExample: databaseUrl } : database;
28774
28799
  await generateEnv(cwd, envDatabase);
@@ -28838,5 +28863,5 @@ async function createNextly(options = {}) {
28838
28863
  */
28839
28864
 
28840
28865
  export { __commonJS, __require, __toESM, capture, createNextly, init, resolveProjectArg, shutdown, validateProjectName };
28841
- //# sourceMappingURL=chunk-HUETNHOV.mjs.map
28842
- //# sourceMappingURL=chunk-HUETNHOV.mjs.map
28866
+ //# sourceMappingURL=chunk-AATWR2UA.mjs.map
28867
+ //# sourceMappingURL=chunk-AATWR2UA.mjs.map