create-newt-app 0.30.0 → 0.31.1
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/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +66 -309
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ type Extra = "anti-slop";
|
|
|
5
5
|
declare const TESTING_CHOICES: readonly ["jest", "vitest"];
|
|
6
6
|
declare const DATABASE_CHOICES: readonly ["sqlite", "postgres"];
|
|
7
7
|
declare const LINTER_CHOICES: readonly ["eslint", "oxc"];
|
|
8
|
-
declare const DEPLOYMENT_CHOICES: readonly ["none", "standalone", "
|
|
8
|
+
declare const DEPLOYMENT_CHOICES: readonly ["none", "standalone", "spa"];
|
|
9
9
|
type Testing = (typeof TESTING_CHOICES)[number];
|
|
10
10
|
type Database = (typeof DATABASE_CHOICES)[number];
|
|
11
11
|
type Linter = (typeof LINTER_CHOICES)[number];
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/templates/types.ts","../src/index.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/templates/types.ts","../src/index.ts"],"mappings":";KAgCY;;;cChBN;cACA;cACA;cACA;KAGD,kBAAkB;KAClB,mBAAmB;KACnB,iBAAiB;KACjB,qBAAqB;KAcrB;EACH;EACA;EACA;EACA;EACA;EACA,SAAS;EACT,UAAU;EACV,QAAQ;EACR,YAAY;EACZ;EACA;EACA,iBAAiB;;iBAWG,OAAO,SAAS,UAAO"}
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import ejs from "ejs";
|
|
|
10
10
|
import { existsSync, promises } from "fs";
|
|
11
11
|
import path from "path";
|
|
12
12
|
//#region package.json
|
|
13
|
-
var version = "0.
|
|
13
|
+
var version = "0.31.1";
|
|
14
14
|
var engines = { "node": ">=24.0.0" };
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region src/templates/root/index.ts
|
|
@@ -25,6 +25,7 @@ const root$2 = { templates: [
|
|
|
25
25
|
"dev": "turbo run dev",
|
|
26
26
|
"lint": "turbo run lint",
|
|
27
27
|
"test": "turbo run test",
|
|
28
|
+
"typecheck": "turbo run typecheck",
|
|
28
29
|
"db:make": "pnpm --filter @<%= projectName %>/db run make",
|
|
29
30
|
"db:migrate": "turbo run migrate",
|
|
30
31
|
"db:generate": "turbo run generate"
|
|
@@ -101,7 +102,7 @@ dist
|
|
|
101
102
|
template: ``
|
|
102
103
|
},
|
|
103
104
|
{
|
|
104
|
-
when: (s) => s.deployment !== "standalone"
|
|
105
|
+
when: (s) => s.deployment !== "standalone",
|
|
105
106
|
filename: "turbo.json",
|
|
106
107
|
template: `{
|
|
107
108
|
"$schema": "https://turborepo.dev/schema.json",
|
|
@@ -113,9 +114,10 @@ dist
|
|
|
113
114
|
"inputs": ["$TURBO_DEFAULT$", ".env*"],
|
|
114
115
|
"outputs": [".next/**", "!.next/cache/**"]
|
|
115
116
|
},
|
|
116
|
-
|
|
117
|
+
"typecheck": {
|
|
117
118
|
"dependsOn": ["^build"]
|
|
118
|
-
},<%
|
|
119
|
+
},<% if (linter !== "oxc") { %>
|
|
120
|
+
"lint": {
|
|
119
121
|
"dependsOn": ["^lint"],
|
|
120
122
|
"env": ["NODE_ENV"]
|
|
121
123
|
},
|
|
@@ -202,10 +204,10 @@ This version has breaking changes — APIs, conventions, and file structure may
|
|
|
202
204
|
] };
|
|
203
205
|
//#endregion
|
|
204
206
|
//#region src/templates/web/index.ts
|
|
205
|
-
const web$
|
|
207
|
+
const web$1 = {
|
|
206
208
|
templates: [
|
|
207
209
|
{
|
|
208
|
-
when: (s) => !s.nestDiOnly
|
|
210
|
+
when: (s) => !s.nestDiOnly,
|
|
209
211
|
filename: "apps/web/package.json",
|
|
210
212
|
template: `{
|
|
211
213
|
"name": "web",
|
|
@@ -216,6 +218,7 @@ const web$2 = {
|
|
|
216
218
|
"dev": "next dev --port 3000",
|
|
217
219
|
"build": "next build",
|
|
218
220
|
"start": "next start",
|
|
221
|
+
"typecheck": "next typegen && tsc --noEmit",
|
|
219
222
|
"db:migrate": "better-auth migrate"
|
|
220
223
|
},
|
|
221
224
|
"dependencies": {
|
|
@@ -347,7 +350,7 @@ export default nextConfig;`
|
|
|
347
350
|
template: `export { default } from "@<%= projectName %>/ui/postcss.config";`
|
|
348
351
|
},
|
|
349
352
|
{
|
|
350
|
-
when: (s) => !s.nestDiOnly
|
|
353
|
+
when: (s) => !s.nestDiOnly,
|
|
351
354
|
filename: "apps/web/tsconfig.json",
|
|
352
355
|
template: `{
|
|
353
356
|
"extends": "@<%= projectName %>/typescript-config/nextjs.json",
|
|
@@ -748,7 +751,7 @@ export const authClient: ReturnType<typeof createAuthClient> = createAuthClient(
|
|
|
748
751
|
//#region src/templates/api/index.ts
|
|
749
752
|
const api$1 = { templates: [
|
|
750
753
|
{
|
|
751
|
-
when: (s) => !s.nestDiOnly && s.deployment !== "spa"
|
|
754
|
+
when: (s) => !s.nestDiOnly && s.deployment !== "spa",
|
|
752
755
|
filename: "apps/api/package.json",
|
|
753
756
|
template: `{
|
|
754
757
|
"name": "api",
|
|
@@ -759,6 +762,7 @@ const api$1 = { templates: [
|
|
|
759
762
|
"license": "UNLICENSED",
|
|
760
763
|
"scripts": {
|
|
761
764
|
"build": "nest build",
|
|
765
|
+
"typecheck": "tsc -p tsconfig.build.json --noEmit",
|
|
762
766
|
"start": "nest start",
|
|
763
767
|
"dev": "nest start --watch",
|
|
764
768
|
"start:dev": "nest start --watch",
|
|
@@ -892,8 +896,8 @@ NestJS backend for the monorepo.
|
|
|
892
896
|
\`\`\`sh
|
|
893
897
|
pnpm dev # watch mode
|
|
894
898
|
pnpm build # production build
|
|
895
|
-
pnpm test # unit tests
|
|
896
|
-
pnpm test:e2e # e2e tests
|
|
899
|
+
pnpm test # unit tests<% if (!nestDiOnly) { %>
|
|
900
|
+
pnpm test:e2e # e2e tests<% } %>
|
|
897
901
|
\`\`\``
|
|
898
902
|
}
|
|
899
903
|
] };
|
|
@@ -910,6 +914,7 @@ const auth = { templates: [
|
|
|
910
914
|
".": "./src/index.ts"
|
|
911
915
|
},
|
|
912
916
|
"scripts": {
|
|
917
|
+
"typecheck": "tsc --noEmit",
|
|
913
918
|
"migrate": "dotenv -e ../../.env -- auth migrate -y --config src/index.ts",
|
|
914
919
|
"generate": "dotenv -e ../../.env -- auth generate --config src/index.ts"
|
|
915
920
|
},
|
|
@@ -1144,6 +1149,7 @@ var package_json_sqlite_default = {
|
|
|
1144
1149
|
".": "./src/index.ts"
|
|
1145
1150
|
},
|
|
1146
1151
|
"scripts": {
|
|
1152
|
+
"typecheck": "tsc --noEmit",
|
|
1147
1153
|
"migrate": "dotenv -e ../../.env -- tsx src/migrate.ts",
|
|
1148
1154
|
"make": "tsx scripts/new-migration.ts"
|
|
1149
1155
|
},
|
|
@@ -1172,6 +1178,7 @@ var package_json_postgres_default = {
|
|
|
1172
1178
|
".": "./src/index.ts"
|
|
1173
1179
|
},
|
|
1174
1180
|
"scripts": {
|
|
1181
|
+
"typecheck": "tsc --noEmit",
|
|
1175
1182
|
"migrate": "dotenv -e ../../.env -- tsx src/migrate.ts",
|
|
1176
1183
|
"make": "tsx scripts/new-migration.ts"
|
|
1177
1184
|
},
|
|
@@ -1269,7 +1276,7 @@ const ui$1 = { templates: [
|
|
|
1269
1276
|
"./*": "./src/*.tsx"
|
|
1270
1277
|
},
|
|
1271
1278
|
"scripts": {
|
|
1272
|
-
"
|
|
1279
|
+
"typecheck": "tsc --noEmit"
|
|
1273
1280
|
},
|
|
1274
1281
|
"devDependencies": {
|
|
1275
1282
|
"@<%= projectName %>/typescript-config": "workspace:*",
|
|
@@ -1595,7 +1602,9 @@ const shadcnUi = {
|
|
|
1595
1602
|
"./hooks/*": "./src/hooks/*.ts",
|
|
1596
1603
|
"./*": "./src/components/*.tsx"
|
|
1597
1604
|
},
|
|
1598
|
-
"scripts": {
|
|
1605
|
+
"scripts": {
|
|
1606
|
+
"typecheck": "tsc --noEmit"
|
|
1607
|
+
},
|
|
1599
1608
|
"dependencies": {
|
|
1600
1609
|
"@base-ui/react": "<%= versions["@base-ui/react"] %>",
|
|
1601
1610
|
"@shadcn/react": "<%= versions["@shadcn/react"] %>",
|
|
@@ -10105,7 +10114,7 @@ var prettierrc_default = {
|
|
|
10105
10114
|
};
|
|
10106
10115
|
//#endregion
|
|
10107
10116
|
//#region src/templates/eslint-config/index.ts
|
|
10108
|
-
const web
|
|
10117
|
+
const web = "apps/web";
|
|
10109
10118
|
const api = "apps/api";
|
|
10110
10119
|
const ui = "packages/ui";
|
|
10111
10120
|
const root$1 = "";
|
|
@@ -10123,13 +10132,13 @@ const eslintConfig = {
|
|
|
10123
10132
|
packages: [
|
|
10124
10133
|
{
|
|
10125
10134
|
package: "eslint",
|
|
10126
|
-
module: web
|
|
10135
|
+
module: web,
|
|
10127
10136
|
version: versions.eslint,
|
|
10128
10137
|
dev: true
|
|
10129
10138
|
},
|
|
10130
10139
|
{
|
|
10131
10140
|
package: "@<%= projectName %>/eslint-config",
|
|
10132
|
-
module: web
|
|
10141
|
+
module: web,
|
|
10133
10142
|
version: "workspace:*",
|
|
10134
10143
|
dev: true
|
|
10135
10144
|
},
|
|
@@ -10190,12 +10199,12 @@ const eslintConfig = {
|
|
|
10190
10199
|
],
|
|
10191
10200
|
scripts: [
|
|
10192
10201
|
{
|
|
10193
|
-
module: web
|
|
10202
|
+
module: web,
|
|
10194
10203
|
name: "lint",
|
|
10195
10204
|
script: "eslint --fix && next typegen && tsc --noEmit"
|
|
10196
10205
|
},
|
|
10197
10206
|
{
|
|
10198
|
-
module: web
|
|
10207
|
+
module: web,
|
|
10199
10208
|
name: "lint:check",
|
|
10200
10209
|
script: "eslint --max-warnings 0 && next typegen && tsc --noEmit"
|
|
10201
10210
|
},
|
|
@@ -10299,7 +10308,6 @@ var oxfmtrc_default = {
|
|
|
10299
10308
|
};
|
|
10300
10309
|
//#endregion
|
|
10301
10310
|
//#region src/templates/oxc/index.ts
|
|
10302
|
-
const web = "apps/web";
|
|
10303
10311
|
const root = "";
|
|
10304
10312
|
const oxc = {
|
|
10305
10313
|
templates: [oxlintrc_default, oxfmtrc_default],
|
|
@@ -10315,21 +10323,11 @@ const oxc = {
|
|
|
10315
10323
|
dev: true
|
|
10316
10324
|
}],
|
|
10317
10325
|
scripts: [
|
|
10318
|
-
{
|
|
10319
|
-
module: web,
|
|
10320
|
-
name: "typecheck",
|
|
10321
|
-
script: "next typegen && tsc --noEmit"
|
|
10322
|
-
},
|
|
10323
10326
|
{
|
|
10324
10327
|
module: root,
|
|
10325
10328
|
name: "lint",
|
|
10326
10329
|
script: "oxlint --fix"
|
|
10327
10330
|
},
|
|
10328
|
-
{
|
|
10329
|
-
module: root,
|
|
10330
|
-
name: "typecheck",
|
|
10331
|
-
script: "turbo run typecheck"
|
|
10332
|
-
},
|
|
10333
10331
|
{
|
|
10334
10332
|
module: root,
|
|
10335
10333
|
name: "lint:check",
|
|
@@ -10534,7 +10532,9 @@ const typescriptConfig = { templates: [
|
|
|
10534
10532
|
"$schema": "https://json.schemastore.org/tsconfig",
|
|
10535
10533
|
"extends": "./base.json",
|
|
10536
10534
|
"compilerOptions": {
|
|
10537
|
-
"jsx": "react-jsx"
|
|
10535
|
+
"jsx": "react-jsx",
|
|
10536
|
+
"module": "ESNext",
|
|
10537
|
+
"moduleResolution": "Bundler"
|
|
10538
10538
|
}
|
|
10539
10539
|
}`
|
|
10540
10540
|
}
|
|
@@ -10944,9 +10944,10 @@ export default nextConfig;`
|
|
|
10944
10944
|
"env": ["API_HOST", "DATABASE_URL"],
|
|
10945
10945
|
"outputs": [".next/**", "!.next/cache/**"]
|
|
10946
10946
|
},
|
|
10947
|
-
|
|
10947
|
+
"typecheck": {
|
|
10948
10948
|
"dependsOn": ["^build"]
|
|
10949
|
-
},<%
|
|
10949
|
+
},<% if (linter !== "oxc") { %>
|
|
10950
|
+
"lint": {
|
|
10950
10951
|
"dependsOn": ["^lint"],
|
|
10951
10952
|
"env": ["NODE_ENV"]
|
|
10952
10953
|
},
|
|
@@ -10977,251 +10978,6 @@ export default nextConfig;`
|
|
|
10977
10978
|
}
|
|
10978
10979
|
] };
|
|
10979
10980
|
//#endregion
|
|
10980
|
-
//#region src/templates/single-process-custom-server/index.ts
|
|
10981
|
-
const singleProcessCustomServer = { templates: [
|
|
10982
|
-
{
|
|
10983
|
-
filename: "apps/api/package.json",
|
|
10984
|
-
template: `{
|
|
10985
|
-
"name": "@<%= projectName %>/api",
|
|
10986
|
-
"version": "0.0.1",
|
|
10987
|
-
"description": "",
|
|
10988
|
-
"author": "",
|
|
10989
|
-
"private": true,
|
|
10990
|
-
"license": "UNLICENSED",
|
|
10991
|
-
"exports": {
|
|
10992
|
-
".": "./dist/index.js"
|
|
10993
|
-
},
|
|
10994
|
-
"scripts": {
|
|
10995
|
-
"build": "nest build",
|
|
10996
|
-
"start": "nest start",
|
|
10997
|
-
"start:dev": "nest start --watch",
|
|
10998
|
-
"start:debug": "nest start --debug --watch",
|
|
10999
|
-
"start:prod": "node dist/main"
|
|
11000
|
-
},
|
|
11001
|
-
"dependencies": {
|
|
11002
|
-
"@nestjs/common": "<%= versions["@nestjs/common"] %>",
|
|
11003
|
-
"@nestjs/core": "<%= versions["@nestjs/core"] %>",
|
|
11004
|
-
"@nestjs/platform-express": "<%= versions["@nestjs/platform-express"] %>",
|
|
11005
|
-
"@<%= projectName %>/auth": "workspace:*",
|
|
11006
|
-
"@<%= projectName %>/db": "workspace:*",
|
|
11007
|
-
"@thallesp/nestjs-better-auth": "<%= versions["@thallesp/nestjs-better-auth"] %>",
|
|
11008
|
-
"dotenv": "<%= versions.dotenv %>",
|
|
11009
|
-
"reflect-metadata": "<%= versions["reflect-metadata"] %>",
|
|
11010
|
-
"rxjs": "<%= versions.rxjs %>"
|
|
11011
|
-
},
|
|
11012
|
-
"devDependencies": {
|
|
11013
|
-
"@nestjs/cli": "<%= versions["@nestjs/cli"] %>",
|
|
11014
|
-
"@nestjs/schematics": "<%= versions["@nestjs/schematics"] %>",
|
|
11015
|
-
"@nestjs/testing": "<%= versions["@nestjs/testing"] %>",
|
|
11016
|
-
"@types/express": "<%= versions["@types/express"] %>",
|
|
11017
|
-
"@types/node": "<%= versions["@types/node"] %>",
|
|
11018
|
-
"@types/supertest": "<%= versions["@types/supertest"] %>",
|
|
11019
|
-
"supertest": "<%= versions.supertest %>",
|
|
11020
|
-
"ts-node": "<%= versions["ts-node"] %>",
|
|
11021
|
-
"tsconfig-paths": "<%= versions["tsconfig-paths"] %>",
|
|
11022
|
-
"typescript": "<%= versions.typescript %>"
|
|
11023
|
-
}
|
|
11024
|
-
}`
|
|
11025
|
-
},
|
|
11026
|
-
{
|
|
11027
|
-
filename: "apps/api/src/index.ts",
|
|
11028
|
-
template: `export { AppModule } from './app.module';`
|
|
11029
|
-
},
|
|
11030
|
-
{
|
|
11031
|
-
filename: "apps/web/server.ts",
|
|
11032
|
-
template: `import 'reflect-metadata';
|
|
11033
|
-
import dotenv from 'dotenv';
|
|
11034
|
-
import { resolve } from 'path';
|
|
11035
|
-
|
|
11036
|
-
// Load root .env first, then local .env (local takes precedence)
|
|
11037
|
-
dotenv.config({ path: resolve(process.cwd(), '../../.env') });
|
|
11038
|
-
dotenv.config({ path: resolve(process.cwd(), '.env') });
|
|
11039
|
-
|
|
11040
|
-
import { NestFactory } from '@nestjs/core';
|
|
11041
|
-
import { AppModule } from '@<%= projectName %>/api';
|
|
11042
|
-
import next from 'next';
|
|
11043
|
-
import { createServer, type IncomingMessage, type ServerResponse } from 'node:http';
|
|
11044
|
-
|
|
11045
|
-
const dev = process.env.NODE_ENV !== 'production';
|
|
11046
|
-
const port = parseInt(process.env.PORT ?? '3000', 10);
|
|
11047
|
-
|
|
11048
|
-
async function main() {
|
|
11049
|
-
const nextApp = next({ dev, port });
|
|
11050
|
-
const handle = nextApp.getRequestHandler();
|
|
11051
|
-
|
|
11052
|
-
await nextApp.prepare();
|
|
11053
|
-
|
|
11054
|
-
const nestApp = await NestFactory.create(AppModule);
|
|
11055
|
-
// apps/api/src/main.ts never runs here, so its prefix is set again
|
|
11056
|
-
nestApp.setGlobalPrefix('api');
|
|
11057
|
-
await nestApp.init();
|
|
11058
|
-
|
|
11059
|
-
const nestListener = nestApp
|
|
11060
|
-
.getHttpServer()
|
|
11061
|
-
.listeners('request')[0] as (req: IncomingMessage, res: ServerResponse) => void;
|
|
11062
|
-
|
|
11063
|
-
const server = createServer((req, res) => {
|
|
11064
|
-
if (req.url?.startsWith('/api/')) {
|
|
11065
|
-
nestListener(req, res);
|
|
11066
|
-
} else {
|
|
11067
|
-
handle(req, res);
|
|
11068
|
-
}
|
|
11069
|
-
});
|
|
11070
|
-
|
|
11071
|
-
server.listen(port, () => {
|
|
11072
|
-
console.log(\`> Server ready on http://localhost:\${port}\`);
|
|
11073
|
-
});
|
|
11074
|
-
}
|
|
11075
|
-
|
|
11076
|
-
main().catch(console.error);`
|
|
11077
|
-
},
|
|
11078
|
-
{
|
|
11079
|
-
filename: "apps/web/package.json",
|
|
11080
|
-
template: `{
|
|
11081
|
-
"name": "web",
|
|
11082
|
-
"version": "0.1.0",
|
|
11083
|
-
"type": "module",
|
|
11084
|
-
"private": true,
|
|
11085
|
-
"scripts": {
|
|
11086
|
-
"dev": "tsx watch --tsconfig tsconfig.server.json server.ts",
|
|
11087
|
-
"build": "next build && tsc -p tsconfig.server.json",
|
|
11088
|
-
"start": "node dist/server.js",
|
|
11089
|
-
"db:migrate": "better-auth migrate"
|
|
11090
|
-
},
|
|
11091
|
-
"dependencies": {
|
|
11092
|
-
"@<%= projectName %>/api": "workspace:*",
|
|
11093
|
-
"@<%= projectName %>/auth": "workspace:*",
|
|
11094
|
-
"@<%= projectName %>/ui": "workspace:*",
|
|
11095
|
-
"@nestjs/core": "<%= versions["@nestjs/core"] %>",
|
|
11096
|
-
"@tailwindcss/postcss": "<%= versions["@tailwindcss/postcss"] %>",
|
|
11097
|
-
"dotenv": "<%= versions.dotenv %>",
|
|
11098
|
-
"@tanstack/react-form": "<%= versions["@tanstack/react-form"] %>",
|
|
11099
|
-
"@tanstack/react-query": "<%= versions["@tanstack/react-query"] %>",
|
|
11100
|
-
"better-auth": "<%= versions["better-auth"] %>",
|
|
11101
|
-
"next": "<%= versions.next %>",
|
|
11102
|
-
"react": "<%= versions.react %>",
|
|
11103
|
-
"react-dom": "<%= versions["react-dom"] %>",
|
|
11104
|
-
"reflect-metadata": "<%= versions["reflect-metadata"] %>",
|
|
11105
|
-
"tailwindcss": "<%= versions.tailwindcss %>"
|
|
11106
|
-
},
|
|
11107
|
-
"devDependencies": {
|
|
11108
|
-
"@<%= projectName %>/typescript-config": "workspace:*",
|
|
11109
|
-
"@types/node": "<%= versions["@types/node"] %>",
|
|
11110
|
-
"@types/react": "<%= versions["@types/react"] %>",
|
|
11111
|
-
"@types/react-dom": "<%= versions["@types/react-dom"] %>",
|
|
11112
|
-
"tsx": "<%= versions.tsx %>",
|
|
11113
|
-
"typescript": "<%= versions.typescript %>"
|
|
11114
|
-
}
|
|
11115
|
-
}`
|
|
11116
|
-
},
|
|
11117
|
-
{
|
|
11118
|
-
when: (s) => !s.nestDiOnly,
|
|
11119
|
-
filename: "apps/web/next.config.js",
|
|
11120
|
-
template: `import dotenv from 'dotenv';
|
|
11121
|
-
import { resolve } from 'path';
|
|
11122
|
-
|
|
11123
|
-
// Load root .env first, then local .env (local takes precedence)
|
|
11124
|
-
dotenv.config({ path: resolve(process.cwd(), '../../.env') });
|
|
11125
|
-
dotenv.config({ path: resolve(process.cwd(), '.env') });
|
|
11126
|
-
|
|
11127
|
-
// No output setting: server.ts is the server, so Next runs in-process rather
|
|
11128
|
-
// than through its own standalone entrypoint.
|
|
11129
|
-
/** @type {import('next').NextConfig} */
|
|
11130
|
-
const nextConfig = {};
|
|
11131
|
-
|
|
11132
|
-
export default nextConfig;`
|
|
11133
|
-
},
|
|
11134
|
-
{
|
|
11135
|
-
filename: "apps/web/tsconfig.json",
|
|
11136
|
-
template: `{
|
|
11137
|
-
"extends": "@<%= projectName %>/typescript-config/nextjs.json",
|
|
11138
|
-
"compilerOptions": {
|
|
11139
|
-
"plugins": [
|
|
11140
|
-
{
|
|
11141
|
-
"name": "next"
|
|
11142
|
-
}
|
|
11143
|
-
],
|
|
11144
|
-
"strictNullChecks": true,
|
|
11145
|
-
"paths": {
|
|
11146
|
-
"@/*": ["./*"]
|
|
11147
|
-
}
|
|
11148
|
-
},
|
|
11149
|
-
"include": [
|
|
11150
|
-
"**/*.ts",
|
|
11151
|
-
"**/*.tsx",
|
|
11152
|
-
"next-env.d.ts",
|
|
11153
|
-
"next.config.js",
|
|
11154
|
-
".next/types/**/*.ts"
|
|
11155
|
-
],
|
|
11156
|
-
"exclude": ["node_modules", "server.ts"]
|
|
11157
|
-
}`
|
|
11158
|
-
},
|
|
11159
|
-
{
|
|
11160
|
-
filename: "apps/web/tsconfig.server.json",
|
|
11161
|
-
template: `{
|
|
11162
|
-
"compilerOptions": {
|
|
11163
|
-
"module": "esnext",
|
|
11164
|
-
"moduleResolution": "bundler",
|
|
11165
|
-
"outDir": "dist",
|
|
11166
|
-
"target": "ES2023",
|
|
11167
|
-
"esModuleInterop": true,
|
|
11168
|
-
"emitDecoratorMetadata": true,
|
|
11169
|
-
"experimentalDecorators": true,
|
|
11170
|
-
"allowSyntheticDefaultImports": true,
|
|
11171
|
-
"skipLibCheck": true,
|
|
11172
|
-
"strictNullChecks": true,
|
|
11173
|
-
"noImplicitAny": false
|
|
11174
|
-
},
|
|
11175
|
-
"include": ["server.ts"],
|
|
11176
|
-
"exclude": ["node_modules"]
|
|
11177
|
-
}`
|
|
11178
|
-
},
|
|
11179
|
-
{
|
|
11180
|
-
filename: "turbo.json",
|
|
11181
|
-
template: `{
|
|
11182
|
-
"$schema": "https://turborepo.dev/schema.json",
|
|
11183
|
-
"ui": "tui",
|
|
11184
|
-
"tasks": {
|
|
11185
|
-
"build": {
|
|
11186
|
-
"env": ["DATABASE_URL", "PORT"],
|
|
11187
|
-
"dependsOn": ["^build"],
|
|
11188
|
-
"inputs": ["$TURBO_DEFAULT$", ".env*"],
|
|
11189
|
-
"outputs": [".next/**", "!.next/cache/**", "dist/**"]
|
|
11190
|
-
},
|
|
11191
|
-
<% if (linter === "oxc") { %> "typecheck": {
|
|
11192
|
-
"dependsOn": ["^build"]
|
|
11193
|
-
},<% } else { %> "lint": {
|
|
11194
|
-
"dependsOn": ["^lint"],
|
|
11195
|
-
"env": ["NODE_ENV"]
|
|
11196
|
-
},
|
|
11197
|
-
"lint:check": {
|
|
11198
|
-
"dependsOn": ["^lint:check"],
|
|
11199
|
-
"env": ["NODE_ENV"]
|
|
11200
|
-
},<% } %>
|
|
11201
|
-
"test": {
|
|
11202
|
-
"dependsOn": ["^build"],
|
|
11203
|
-
"outputs": ["coverage/**"]
|
|
11204
|
-
},
|
|
11205
|
-
"dev": {
|
|
11206
|
-
"env": ["DATABASE_URL", "PORT"],
|
|
11207
|
-
"dependsOn": ["^migrate", "^build"],
|
|
11208
|
-
"cache": false,
|
|
11209
|
-
"persistent": true
|
|
11210
|
-
},
|
|
11211
|
-
"migrate": {
|
|
11212
|
-
"env": ["DATABASE_URL"],
|
|
11213
|
-
"dependsOn": ["^migrate"],
|
|
11214
|
-
"cache": false
|
|
11215
|
-
},
|
|
11216
|
-
"generate": {
|
|
11217
|
-
"env": ["DATABASE_URL"],
|
|
11218
|
-
"cache": false
|
|
11219
|
-
}
|
|
11220
|
-
}
|
|
11221
|
-
}`
|
|
11222
|
-
}
|
|
11223
|
-
] };
|
|
11224
|
-
//#endregion
|
|
11225
10981
|
//#region src/templates/single-process-static-export/index.ts
|
|
11226
10982
|
const singleProcessStaticExport = { templates: [{
|
|
11227
10983
|
filename: "apps/api/package.json",
|
|
@@ -11276,24 +11032,22 @@ dotenv.config({ path: resolve(process.cwd(), '.env') });
|
|
|
11276
11032
|
|
|
11277
11033
|
const isProduction = process.env.NODE_ENV === 'production';
|
|
11278
11034
|
|
|
11035
|
+
// Static export in production — served by NestJS via ServeStaticModule.
|
|
11036
|
+
// rewrites() is incompatible with output: "export", so dev uses the proxy
|
|
11037
|
+
// and production uses the static files.
|
|
11279
11038
|
/** @type {import('next').NextConfig} */
|
|
11280
|
-
const nextConfig =
|
|
11281
|
-
|
|
11282
|
-
|
|
11283
|
-
|
|
11284
|
-
|
|
11285
|
-
|
|
11286
|
-
|
|
11287
|
-
|
|
11288
|
-
|
|
11289
|
-
|
|
11290
|
-
|
|
11291
|
-
|
|
11292
|
-
},
|
|
11293
|
-
];
|
|
11294
|
-
},
|
|
11295
|
-
}),
|
|
11296
|
-
};
|
|
11039
|
+
const nextConfig = isProduction
|
|
11040
|
+
? { output: 'export' }
|
|
11041
|
+
: {
|
|
11042
|
+
async rewrites() {
|
|
11043
|
+
return [
|
|
11044
|
+
{
|
|
11045
|
+
source: '/api/:path*',
|
|
11046
|
+
destination: 'http://localhost:3001/api/:path*',
|
|
11047
|
+
},
|
|
11048
|
+
];
|
|
11049
|
+
},
|
|
11050
|
+
};
|
|
11297
11051
|
|
|
11298
11052
|
export default nextConfig;`
|
|
11299
11053
|
}] };
|
|
@@ -11360,7 +11114,7 @@ const nestDiOnly = { templates: [
|
|
|
11360
11114
|
"noImplicitAny": false,
|
|
11361
11115
|
"strictBindCallApply": false,
|
|
11362
11116
|
"noFallthroughCasesInSwitch": false,
|
|
11363
|
-
"types": [<% if (testing === 'jest') { %>"jest", <% } %>"node"]
|
|
11117
|
+
"types": [<% if (testing === 'jest') { %>"jest", <% } %><% if (testing === 'vitest') { %>"vitest/globals", <% } %>"node"]
|
|
11364
11118
|
},
|
|
11365
11119
|
"include": ["src/**/*"],
|
|
11366
11120
|
"exclude": ["node_modules", "dist"]
|
|
@@ -12610,13 +12364,24 @@ fileURLToPath(staticDir);
|
|
|
12610
12364
|
function getStaticFilePath(name) {
|
|
12611
12365
|
return fileURLToPath(new URL(`./static/${name}`, import.meta.url));
|
|
12612
12366
|
}
|
|
12367
|
+
const E2E_FILES = [
|
|
12368
|
+
"apps/api/test/app.e2e-spec.ts",
|
|
12369
|
+
"apps/api/test/jest-e2e.json",
|
|
12370
|
+
"apps/api/vitest.config.e2e.mts"
|
|
12371
|
+
];
|
|
12613
12372
|
function selectModules(selection) {
|
|
12614
12373
|
const { deployment, nestDiOnly: nestDiOnly$1, todoExample, shadcn, database, linter, testing, extras } = selection;
|
|
12615
|
-
const deploymentModule = deployment === "standalone" ? deploymentStandalone : deployment === "
|
|
12374
|
+
const deploymentModule = deployment === "standalone" ? deploymentStandalone : deployment === "spa" ? singleProcessStaticExport : null;
|
|
12616
12375
|
const webModule = deployment === "spa" ? {
|
|
12617
|
-
...web$
|
|
12618
|
-
templates: web$
|
|
12619
|
-
} : web$
|
|
12376
|
+
...web$1,
|
|
12377
|
+
templates: web$1.templates.filter((t) => t.filename !== "apps/web/app/api/auth/[...all]/route.ts")
|
|
12378
|
+
} : web$1;
|
|
12379
|
+
const selectedTesting = testing === "vitest" ? testingVitest : testingJest;
|
|
12380
|
+
const testingModule = nestDiOnly$1 ? {
|
|
12381
|
+
...selectedTesting,
|
|
12382
|
+
templates: selectedTesting.templates.filter((t) => !E2E_FILES.includes(t.filename)),
|
|
12383
|
+
scripts: selectedTesting.scripts?.filter((s) => s.name !== "test:e2e")
|
|
12384
|
+
} : selectedTesting;
|
|
12620
12385
|
return [
|
|
12621
12386
|
root$2,
|
|
12622
12387
|
webModule,
|
|
@@ -12627,7 +12392,7 @@ function selectModules(selection) {
|
|
|
12627
12392
|
linter === "oxc" ? oxc : eslintConfig,
|
|
12628
12393
|
...extras.includes("anti-slop") ? [antiSlop] : [],
|
|
12629
12394
|
typescriptConfig,
|
|
12630
|
-
|
|
12395
|
+
testingModule,
|
|
12631
12396
|
...deploymentModule ? [deploymentModule] : [],
|
|
12632
12397
|
...nestDiOnly$1 ? [nestDiOnly] : [apiControllers],
|
|
12633
12398
|
...nestDiOnly$1 && deployment === "standalone" ? [deploymentStandaloneDi] : [],
|
|
@@ -12746,10 +12511,6 @@ function validateDeploymentCombo(deployment, nestDiOnly) {
|
|
|
12746
12511
|
valid: false,
|
|
12747
12512
|
error: "--deployment spa cannot be combined with --nest-di-only.\nSPA mode statically exports Next.js (output: 'export'), which cannot include the\nAPI route handlers that DI-only mode depends on. Pick one: drop --nest-di-only to\nget SPA mode with NestJS controllers, or drop --deployment spa."
|
|
12748
12513
|
};
|
|
12749
|
-
if (deployment === "custom-server" && nestDiOnly) return {
|
|
12750
|
-
valid: false,
|
|
12751
|
-
error: "--deployment custom-server cannot be combined with --nest-di-only.\nDI-only keeps Next.js as the server and calls Nest in-process, so it overwrites the\nscripts that would run the custom server — apps/web/server.ts would be generated but\nnever invoked. Both already run Nest inside the Next.js process; pick one."
|
|
12752
|
-
};
|
|
12753
12514
|
return { valid: true };
|
|
12754
12515
|
}
|
|
12755
12516
|
const TOOL_HINTS = {
|
|
@@ -12809,6 +12570,7 @@ async function scaffold(modules, options) {
|
|
|
12809
12570
|
}
|
|
12810
12571
|
const templateData = {
|
|
12811
12572
|
projectName: options.name,
|
|
12573
|
+
nestDiOnly: options.selection.nestDiOnly,
|
|
12812
12574
|
testing: options.testing,
|
|
12813
12575
|
database: options.database,
|
|
12814
12576
|
deployment: options.deployment,
|
|
@@ -12856,7 +12618,6 @@ const LINTER_CHOICES = ["eslint", "oxc"];
|
|
|
12856
12618
|
const DEPLOYMENT_CHOICES = [
|
|
12857
12619
|
"none",
|
|
12858
12620
|
"standalone",
|
|
12859
|
-
"custom-server",
|
|
12860
12621
|
"spa"
|
|
12861
12622
|
];
|
|
12862
12623
|
const EXTRAS_CHOICES = ["anti-slop"];
|
|
@@ -12946,10 +12707,6 @@ async function doInit(options) {
|
|
|
12946
12707
|
hint: "Dockerfiles + docker-compose.yml"
|
|
12947
12708
|
},
|
|
12948
12709
|
...results.nestDiOnly ? [] : [{
|
|
12949
|
-
value: "custom-server",
|
|
12950
|
-
label: "Custom Server",
|
|
12951
|
-
hint: "single process, single port"
|
|
12952
|
-
}, {
|
|
12953
12710
|
value: "spa",
|
|
12954
12711
|
label: "SPA Mode",
|
|
12955
12712
|
hint: "static export served by NestJS"
|
|
@@ -13045,7 +12802,7 @@ async function doInit(options) {
|
|
|
13045
12802
|
}
|
|
13046
12803
|
}
|
|
13047
12804
|
const program = new Command();
|
|
13048
|
-
program.name("create-newt-app").version(version).description("Create a new newt-app monorepo").argument("[name]").option("-ni, --no-install", "Skip pnpm install", true).option("-ng, --no-git", "Skip git initialization", true).option("--shadcn", "Include shadcn/ui", false).option("--testing <framework>", "Testing framework: vitest or jest", "jest").option("--database <database>", "Database: sqlite or postgres", "sqlite").option("--linter <linter>", "Linter: eslint or oxc", "eslint").option("--deployment <strategy>", "Deployment: standalone,
|
|
12805
|
+
program.name("create-newt-app").version(version).description("Create a new newt-app monorepo").argument("[name]").option("-ni, --no-install", "Skip pnpm install", true).option("-ng, --no-git", "Skip git initialization", true).option("--shadcn", "Include shadcn/ui", false).option("--testing <framework>", "Testing framework: vitest or jest", "jest").option("--database <database>", "Database: sqlite or postgres", "sqlite").option("--linter <linter>", "Linter: eslint or oxc", "eslint").option("--deployment <strategy>", "Deployment: standalone, spa", "none").option("--nest-di-only", "Use NestJS for dependency injection only", false).option("--include-example", "Include the todo example", false).option("--extras <list>", "Extras, comma-separated: anti-slop", "").action(async (name, options, command) => {
|
|
13049
12806
|
intro(`Create a ${chalk.blue("newt")} app.`);
|
|
13050
12807
|
const nonInteractive = [
|
|
13051
12808
|
"shadcn",
|