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.
- package/dist/{chunk-RPGFJSDP.mjs → chunk-AATWR2UA.mjs} +50 -18
- package/dist/chunk-AATWR2UA.mjs.map +1 -0
- package/dist/cli.cjs +49 -17
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/cli.mjs.map +1 -1
- package/dist/index.cjs +48 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +4 -4
- package/templates/base/next.config.ts +11 -17
- package/dist/chunk-RPGFJSDP.mjs.map +0 -1
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.
|
|
6262
|
+
version: "0.0.2-alpha.13",
|
|
6263
6263
|
description: "CLI to scaffold Nextly in your Next.js project",
|
|
6264
6264
|
license: "MIT",
|
|
6265
6265
|
type: "module",
|
|
@@ -21811,22 +21811,42 @@ async function generateMediaRoutes(cwd, projectInfo) {
|
|
|
21811
21811
|
|
|
21812
21812
|
// src/generators/next-config.ts
|
|
21813
21813
|
var import_fs_extra5 = __toESM(require_lib());
|
|
21814
|
-
var
|
|
21814
|
+
var COMMON_SERVER_EXTERNAL_PACKAGES = [
|
|
21815
21815
|
"nextly",
|
|
21816
21816
|
"@nextlyhq/adapter-drizzle",
|
|
21817
|
-
"@nextlyhq/adapter-postgres",
|
|
21818
|
-
"@nextlyhq/adapter-mysql",
|
|
21819
|
-
"@nextlyhq/adapter-sqlite",
|
|
21820
21817
|
"drizzle-orm",
|
|
21821
21818
|
"drizzle-kit",
|
|
21822
|
-
"pg",
|
|
21823
|
-
"mysql2",
|
|
21824
|
-
"better-sqlite3",
|
|
21825
21819
|
"bcryptjs",
|
|
21826
21820
|
"sharp",
|
|
21827
21821
|
"esbuild"
|
|
21828
21822
|
];
|
|
21829
|
-
|
|
21823
|
+
var DATABASE_SERVER_EXTERNAL_PACKAGES = {
|
|
21824
|
+
postgresql: ["@nextlyhq/adapter-postgres", "pg"],
|
|
21825
|
+
mysql: ["@nextlyhq/adapter-mysql", "mysql2"],
|
|
21826
|
+
sqlite: ["@nextlyhq/adapter-sqlite", "better-sqlite3"]
|
|
21827
|
+
};
|
|
21828
|
+
function getServerExternalPackages(database) {
|
|
21829
|
+
return [
|
|
21830
|
+
...COMMON_SERVER_EXTERNAL_PACKAGES,
|
|
21831
|
+
...DATABASE_SERVER_EXTERNAL_PACKAGES[database.type]
|
|
21832
|
+
];
|
|
21833
|
+
}
|
|
21834
|
+
function buildNextConfigTemplate(database) {
|
|
21835
|
+
const packagesArray = JSON.stringify(
|
|
21836
|
+
getServerExternalPackages(database),
|
|
21837
|
+
null,
|
|
21838
|
+
2
|
|
21839
|
+
).replace(/\n/g, "\n ");
|
|
21840
|
+
return `import type { NextConfig } from "next";
|
|
21841
|
+
|
|
21842
|
+
const nextConfig: NextConfig = {
|
|
21843
|
+
serverExternalPackages: ${packagesArray},
|
|
21844
|
+
};
|
|
21845
|
+
|
|
21846
|
+
export default nextConfig;
|
|
21847
|
+
`;
|
|
21848
|
+
}
|
|
21849
|
+
async function patchNextConfig(cwd, database) {
|
|
21830
21850
|
const candidates = ["next.config.ts", "next.config.mjs", "next.config.js"];
|
|
21831
21851
|
let configPath = null;
|
|
21832
21852
|
for (const name of candidates) {
|
|
@@ -21843,7 +21863,11 @@ async function patchNextConfig(cwd) {
|
|
|
21843
21863
|
if (content.includes("serverExternalPackages")) {
|
|
21844
21864
|
return;
|
|
21845
21865
|
}
|
|
21846
|
-
const packagesArray = JSON.stringify(
|
|
21866
|
+
const packagesArray = JSON.stringify(
|
|
21867
|
+
getServerExternalPackages(database),
|
|
21868
|
+
null,
|
|
21869
|
+
2
|
|
21870
|
+
).replace(/\n/g, "\n ");
|
|
21847
21871
|
const configObjectPattern = /(const\s+\w+\s*(?::\s*NextConfig\s*)?=\s*\{)/;
|
|
21848
21872
|
if (configObjectPattern.test(content)) {
|
|
21849
21873
|
const patched = content.replace(
|
|
@@ -28613,6 +28637,10 @@ async function generatePackageJson(projectName, database, useYalc = false, proje
|
|
|
28613
28637
|
// don't ship a /search page simply won't invoke it.
|
|
28614
28638
|
pagefind: "^1.1.0"
|
|
28615
28639
|
};
|
|
28640
|
+
const onlyBuiltDependencies = ["sharp", "esbuild", "unrs-resolver"];
|
|
28641
|
+
if (database.type === "sqlite") {
|
|
28642
|
+
onlyBuiltDependencies.push("better-sqlite3");
|
|
28643
|
+
}
|
|
28616
28644
|
const pkg2 = {
|
|
28617
28645
|
name: projectName,
|
|
28618
28646
|
version: "0.1.0",
|
|
@@ -28643,7 +28671,10 @@ async function generatePackageJson(projectName, database, useYalc = false, proje
|
|
|
28643
28671
|
"types:generate": "nextly generate:types"
|
|
28644
28672
|
},
|
|
28645
28673
|
dependencies,
|
|
28646
|
-
devDependencies
|
|
28674
|
+
devDependencies,
|
|
28675
|
+
pnpm: {
|
|
28676
|
+
onlyBuiltDependencies
|
|
28677
|
+
}
|
|
28647
28678
|
};
|
|
28648
28679
|
return JSON.stringify(pkg2, null, 2) + "\n";
|
|
28649
28680
|
}
|
|
@@ -28749,6 +28780,11 @@ async function copyTemplate(options) {
|
|
|
28749
28780
|
if (database.type === "sqlite") {
|
|
28750
28781
|
await import_fs_extra8.default.ensureDir(path__default.default.join(targetDir, "data"));
|
|
28751
28782
|
}
|
|
28783
|
+
await import_fs_extra8.default.writeFile(
|
|
28784
|
+
path__default.default.join(targetDir, "next.config.ts"),
|
|
28785
|
+
buildNextConfigTemplate(database),
|
|
28786
|
+
"utf-8"
|
|
28787
|
+
);
|
|
28752
28788
|
const placeholders = buildPlaceholderMap({ database, databaseUrl });
|
|
28753
28789
|
if (approach) {
|
|
28754
28790
|
placeholders["{{approach}}"] = approach;
|
|
@@ -32058,11 +32094,7 @@ function cwdProjectName(cwd) {
|
|
|
32058
32094
|
return basename;
|
|
32059
32095
|
}
|
|
32060
32096
|
async function createNextly(options = {}) {
|
|
32061
|
-
const {
|
|
32062
|
-
defaults = false,
|
|
32063
|
-
skipInstall = false,
|
|
32064
|
-
useYalc = false
|
|
32065
|
-
} = options;
|
|
32097
|
+
const { defaults = false, skipInstall = false, useYalc = false } = options;
|
|
32066
32098
|
let installInCwd = options.installInCwd ?? false;
|
|
32067
32099
|
let { cwd = process.cwd() } = options;
|
|
32068
32100
|
let isFreshProject = false;
|
|
@@ -32330,7 +32362,7 @@ async function createNextly(options = {}) {
|
|
|
32330
32362
|
await generateAdminPage(cwd, projectInfo);
|
|
32331
32363
|
await generateMediaRoutes(cwd, projectInfo);
|
|
32332
32364
|
await generateTypesDirectory(cwd, projectInfo);
|
|
32333
|
-
await patchNextConfig(cwd);
|
|
32365
|
+
await patchNextConfig(cwd, database);
|
|
32334
32366
|
}
|
|
32335
32367
|
const envDatabase = databaseUrl ? { ...database, connectionUrl: databaseUrl, envExample: databaseUrl } : database;
|
|
32336
32368
|
await generateEnv(cwd, envDatabase);
|