@newt-app/templates 0.5.0 → 0.7.0
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 +5 -0
- package/dist/index.js +968 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -42,6 +42,11 @@ declare const templates: {
|
|
|
42
42
|
typescriptConfig: Module;
|
|
43
43
|
testingJest: Module;
|
|
44
44
|
testingVitest: Module;
|
|
45
|
+
deploymentStandalone: Module;
|
|
46
|
+
deploymentCustomServer: Module;
|
|
47
|
+
deploymentSpa: Module;
|
|
48
|
+
deploymentVercel: Module;
|
|
49
|
+
nestDiOnly: Module;
|
|
45
50
|
};
|
|
46
51
|
|
|
47
52
|
export { type File, type Module, type Package, type Script, type Template, type TemplateData, getStaticFilePath, staticDir, staticDirPath, templates };
|
package/dist/index.js
CHANGED
|
@@ -1229,20 +1229,24 @@ var package_json_default4 = {
|
|
|
1229
1229
|
"version": "0.0.0",
|
|
1230
1230
|
"private": true,
|
|
1231
1231
|
"exports": {
|
|
1232
|
-
".":
|
|
1232
|
+
".": {
|
|
1233
|
+
"default": "./dist/index.js",
|
|
1234
|
+
"types": "./dist/index.d.ts"
|
|
1235
|
+
}
|
|
1233
1236
|
},
|
|
1234
1237
|
"scripts": {
|
|
1238
|
+
"build": "tsc",
|
|
1235
1239
|
"migrate": "dotenv -e .env -- auth migrate --config src/index.ts",
|
|
1236
1240
|
"generate": "dotenv -e .env -- auth generate --config src/index.ts"
|
|
1237
1241
|
},
|
|
1238
1242
|
"dependencies": {
|
|
1243
|
+
"auth": "^1.5.5",
|
|
1239
1244
|
"better-auth": "^1.2.8",
|
|
1240
1245
|
"pg": "^8.14.1"
|
|
1241
1246
|
},
|
|
1242
1247
|
"devDependencies": {
|
|
1243
1248
|
"@<%= projectName %>/typescript-config": "workspace:*",
|
|
1244
1249
|
"@types/pg": "^8.11.13",
|
|
1245
|
-
"auth": "^1.5.5",
|
|
1246
1250
|
"dotenv-cli": "^11.0.0",
|
|
1247
1251
|
"typescript": "6.0.2"
|
|
1248
1252
|
}
|
|
@@ -1270,10 +1274,18 @@ export type Auth = typeof auth;`
|
|
|
1270
1274
|
var tsconfig_default3 = {
|
|
1271
1275
|
filename: "packages/auth/tsconfig.json",
|
|
1272
1276
|
template: `{
|
|
1273
|
-
"extends": "@<%= projectName %>/typescript-config/base.json",
|
|
1274
1277
|
"compilerOptions": {
|
|
1278
|
+
"declaration": true,
|
|
1279
|
+
"declarationMap": true,
|
|
1280
|
+
"esModuleInterop": true,
|
|
1281
|
+
"lib": ["es2022"],
|
|
1282
|
+
"module": "NodeNext",
|
|
1283
|
+
"moduleResolution": "NodeNext",
|
|
1275
1284
|
"outDir": "dist",
|
|
1276
|
-
"
|
|
1285
|
+
"rootDir": "src",
|
|
1286
|
+
"skipLibCheck": true,
|
|
1287
|
+
"strict": true,
|
|
1288
|
+
"target": "ES2022"
|
|
1277
1289
|
},
|
|
1278
1290
|
"include": ["src"],
|
|
1279
1291
|
"exclude": ["node_modules", "dist"]
|
|
@@ -8458,6 +8470,952 @@ var testingVitest = {
|
|
|
8458
8470
|
};
|
|
8459
8471
|
var testing_vitest_default = testingVitest;
|
|
8460
8472
|
|
|
8473
|
+
// src/deployment-standalone/templates/dockerfile.ts
|
|
8474
|
+
var dockerfile_default = {
|
|
8475
|
+
filename: "Dockerfile",
|
|
8476
|
+
template: `FROM node:22-alpine AS base
|
|
8477
|
+
ENV PNPM_HOME="/pnpm"
|
|
8478
|
+
ENV PATH="$PNPM_HOME:$PATH"
|
|
8479
|
+
RUN corepack enable
|
|
8480
|
+
|
|
8481
|
+
FROM base AS build
|
|
8482
|
+
WORKDIR /app
|
|
8483
|
+
COPY . .
|
|
8484
|
+
RUN pnpm install --frozen-lockfile
|
|
8485
|
+
ARG API_HOST=localhost
|
|
8486
|
+
ENV API_HOST=$API_HOST
|
|
8487
|
+
RUN pnpm build --filter=web --filter=api --filter=@<%= projectName %>/auth
|
|
8488
|
+
RUN pnpm deploy --filter=api --prod /deploy/api
|
|
8489
|
+
RUN pnpm deploy --filter=@<%= projectName %>/auth --prod /deploy/auth
|
|
8490
|
+
|
|
8491
|
+
# --- web ---
|
|
8492
|
+
FROM base AS web
|
|
8493
|
+
WORKDIR /app
|
|
8494
|
+
ENV NODE_ENV=production
|
|
8495
|
+
COPY --from=build /app/apps/web/.next/standalone ./
|
|
8496
|
+
COPY --from=build /app/apps/web/.next/static ./apps/web/.next/static
|
|
8497
|
+
COPY --from=build /app/apps/web/public ./apps/web/public
|
|
8498
|
+
EXPOSE 3000
|
|
8499
|
+
CMD ["node", "apps/web/server.js"]
|
|
8500
|
+
|
|
8501
|
+
# --- api ---
|
|
8502
|
+
FROM base AS api
|
|
8503
|
+
ENV NODE_ENV=production
|
|
8504
|
+
COPY --from=build /deploy/api /app
|
|
8505
|
+
WORKDIR /app
|
|
8506
|
+
EXPOSE 3001
|
|
8507
|
+
CMD ["node", "dist/main"]
|
|
8508
|
+
|
|
8509
|
+
# --- migrate ---
|
|
8510
|
+
FROM base AS migrate
|
|
8511
|
+
COPY --from=build /deploy/auth /app
|
|
8512
|
+
WORKDIR /app
|
|
8513
|
+
CMD ["/app/node_modules/.bin/auth", "migrate", "--config", "src/index.ts", "-y"]`
|
|
8514
|
+
};
|
|
8515
|
+
|
|
8516
|
+
// src/deployment-standalone/templates/docker-compose.ts
|
|
8517
|
+
var docker_compose_default = {
|
|
8518
|
+
filename: "docker-compose.yml",
|
|
8519
|
+
template: `x-app-env: &app-env
|
|
8520
|
+
BETTER_AUTH_SECRET: \${BETTER_AUTH_SECRET}
|
|
8521
|
+
DATABASE_URL: postgresql://postgres:\${POSTGRES_PASSWORD:-postgres}@db:5432/postgres
|
|
8522
|
+
|
|
8523
|
+
services:
|
|
8524
|
+
web:
|
|
8525
|
+
build:
|
|
8526
|
+
context: .
|
|
8527
|
+
target: web
|
|
8528
|
+
args:
|
|
8529
|
+
- API_HOST=api
|
|
8530
|
+
ports:
|
|
8531
|
+
- "3000:3000"
|
|
8532
|
+
environment:
|
|
8533
|
+
<<: *app-env
|
|
8534
|
+
depends_on:
|
|
8535
|
+
- api
|
|
8536
|
+
|
|
8537
|
+
migrate:
|
|
8538
|
+
build:
|
|
8539
|
+
context: .
|
|
8540
|
+
target: migrate
|
|
8541
|
+
command: ["/app/node_modules/.bin/auth", "migrate", "--config", "src/index.ts", "-y"]
|
|
8542
|
+
environment:
|
|
8543
|
+
<<: *app-env
|
|
8544
|
+
depends_on:
|
|
8545
|
+
db:
|
|
8546
|
+
condition: service_healthy
|
|
8547
|
+
restart: "no"
|
|
8548
|
+
|
|
8549
|
+
api:
|
|
8550
|
+
build:
|
|
8551
|
+
context: .
|
|
8552
|
+
target: api
|
|
8553
|
+
ports:
|
|
8554
|
+
- "3001:3001"
|
|
8555
|
+
environment:
|
|
8556
|
+
<<: *app-env
|
|
8557
|
+
depends_on:
|
|
8558
|
+
db:
|
|
8559
|
+
condition: service_healthy
|
|
8560
|
+
migrate:
|
|
8561
|
+
condition: service_completed_successfully
|
|
8562
|
+
|
|
8563
|
+
db:
|
|
8564
|
+
image: postgres:17-alpine
|
|
8565
|
+
ports:
|
|
8566
|
+
- "5432:5432"
|
|
8567
|
+
environment:
|
|
8568
|
+
- POSTGRES_PASSWORD=\${POSTGRES_PASSWORD:-postgres}
|
|
8569
|
+
volumes:
|
|
8570
|
+
- db_data:/var/lib/postgresql/data
|
|
8571
|
+
healthcheck:
|
|
8572
|
+
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
8573
|
+
interval: 5s
|
|
8574
|
+
timeout: 5s
|
|
8575
|
+
retries: 5
|
|
8576
|
+
|
|
8577
|
+
volumes:
|
|
8578
|
+
db_data:`
|
|
8579
|
+
};
|
|
8580
|
+
|
|
8581
|
+
// src/deployment-standalone/templates/next-config.ts
|
|
8582
|
+
var next_config_default2 = {
|
|
8583
|
+
filename: "apps/web/next.config.js",
|
|
8584
|
+
template: `import dotenv from 'dotenv';
|
|
8585
|
+
import { resolve } from 'path';
|
|
8586
|
+
|
|
8587
|
+
// Load root .env first, then local .env (local takes precedence)
|
|
8588
|
+
dotenv.config({ path: resolve(process.cwd(), '../../.env') });
|
|
8589
|
+
dotenv.config({ path: resolve(process.cwd(), '.env') });
|
|
8590
|
+
|
|
8591
|
+
/** @type {import('next').NextConfig} */
|
|
8592
|
+
const nextConfig = {
|
|
8593
|
+
output: "standalone",
|
|
8594
|
+
async rewrites() {
|
|
8595
|
+
return [
|
|
8596
|
+
{
|
|
8597
|
+
source: '/api/:path*',
|
|
8598
|
+
destination: \`http://\${process.env.API_HOST ?? 'localhost'}:3001/api/:path*\`,
|
|
8599
|
+
},
|
|
8600
|
+
];
|
|
8601
|
+
},
|
|
8602
|
+
};
|
|
8603
|
+
|
|
8604
|
+
export default nextConfig;`
|
|
8605
|
+
};
|
|
8606
|
+
|
|
8607
|
+
// src/deployment-standalone/templates/turbo-json.ts
|
|
8608
|
+
var turbo_json_default2 = {
|
|
8609
|
+
filename: "turbo.json",
|
|
8610
|
+
template: `{
|
|
8611
|
+
"$schema": "https://turborepo.dev/schema.json",
|
|
8612
|
+
"ui": "tui",
|
|
8613
|
+
"tasks": {
|
|
8614
|
+
"build": {
|
|
8615
|
+
"dependsOn": ["^build"],
|
|
8616
|
+
"inputs": ["$TURBO_DEFAULT$", ".env*"],
|
|
8617
|
+
"env": ["API_HOST"],
|
|
8618
|
+
"outputs": [".next/**", "!.next/cache/**"]
|
|
8619
|
+
},
|
|
8620
|
+
"lint": {
|
|
8621
|
+
"dependsOn": ["^lint"],
|
|
8622
|
+
"env": ["NODE_ENV"]
|
|
8623
|
+
},
|
|
8624
|
+
"test": {
|
|
8625
|
+
"dependsOn": ["^build"],
|
|
8626
|
+
"outputs": ["coverage/**"]
|
|
8627
|
+
},
|
|
8628
|
+
"dev": {
|
|
8629
|
+
"cache": false,
|
|
8630
|
+
"persistent": true
|
|
8631
|
+
},
|
|
8632
|
+
"migrate": {
|
|
8633
|
+
"cache": false,
|
|
8634
|
+
"interactive": true
|
|
8635
|
+
},
|
|
8636
|
+
"generate": {
|
|
8637
|
+
"cache": false
|
|
8638
|
+
}
|
|
8639
|
+
}
|
|
8640
|
+
}`
|
|
8641
|
+
};
|
|
8642
|
+
|
|
8643
|
+
// src/deployment-standalone/index.ts
|
|
8644
|
+
var deploymentStandalone = {
|
|
8645
|
+
templates: [dockerfile_default, docker_compose_default, next_config_default2, turbo_json_default2]
|
|
8646
|
+
};
|
|
8647
|
+
var deployment_standalone_default = deploymentStandalone;
|
|
8648
|
+
|
|
8649
|
+
// src/single-process-custom-server/templates/api-package-json.ts
|
|
8650
|
+
var api_package_json_default = {
|
|
8651
|
+
filename: "apps/api/package.json",
|
|
8652
|
+
template: `{
|
|
8653
|
+
"name": "@<%= projectName %>/api",
|
|
8654
|
+
"version": "0.0.1",
|
|
8655
|
+
"description": "",
|
|
8656
|
+
"author": "",
|
|
8657
|
+
"private": true,
|
|
8658
|
+
"license": "UNLICENSED",
|
|
8659
|
+
"exports": {
|
|
8660
|
+
".": "./src/index.ts"
|
|
8661
|
+
},
|
|
8662
|
+
"scripts": {
|
|
8663
|
+
"build": "nest build",
|
|
8664
|
+
"start": "nest start",
|
|
8665
|
+
"dev": "nest start --watch",
|
|
8666
|
+
"start:dev": "nest start --watch",
|
|
8667
|
+
"start:debug": "nest start --debug --watch",
|
|
8668
|
+
"start:prod": "node dist/main",
|
|
8669
|
+
"lint": "eslint \\"{src,apps,libs,test}/**/*.ts\\" --fix"
|
|
8670
|
+
},
|
|
8671
|
+
"dependencies": {
|
|
8672
|
+
"@nestjs/common": "^11.0.1",
|
|
8673
|
+
"@nestjs/core": "^11.0.1",
|
|
8674
|
+
"@nestjs/platform-express": "^11.0.1",
|
|
8675
|
+
"@<%= projectName %>/auth": "workspace:*",
|
|
8676
|
+
"@thallesp/nestjs-better-auth": "^2.5.1",
|
|
8677
|
+
"dotenv": "^17.3.1",
|
|
8678
|
+
"reflect-metadata": "^0.2.2",
|
|
8679
|
+
"rxjs": "^7.8.1"
|
|
8680
|
+
},
|
|
8681
|
+
"devDependencies": {
|
|
8682
|
+
"@eslint/eslintrc": "^3.2.0",
|
|
8683
|
+
"@eslint/js": "^9.18.0",
|
|
8684
|
+
"@nestjs/cli": "^11.0.0",
|
|
8685
|
+
"@nestjs/schematics": "^11.0.0",
|
|
8686
|
+
"@nestjs/testing": "^11.0.1",
|
|
8687
|
+
"@types/express": "^5.0.0",
|
|
8688
|
+
"@types/node": "^22.10.7",
|
|
8689
|
+
"@types/supertest": "^6.0.2",
|
|
8690
|
+
"eslint": "^9.18.0",
|
|
8691
|
+
"eslint-config-prettier": "^10.0.1",
|
|
8692
|
+
"globals": "^16.0.0",
|
|
8693
|
+
"supertest": "^7.0.0",
|
|
8694
|
+
"ts-node": "^10.9.2",
|
|
8695
|
+
"tsconfig-paths": "^4.2.0",
|
|
8696
|
+
"typescript": "6.0.2",
|
|
8697
|
+
"typescript-eslint": "^8.20.0"
|
|
8698
|
+
}
|
|
8699
|
+
}`
|
|
8700
|
+
};
|
|
8701
|
+
|
|
8702
|
+
// src/single-process-custom-server/templates/api-src-index.ts
|
|
8703
|
+
var api_src_index_default = {
|
|
8704
|
+
filename: "apps/api/src/index.ts",
|
|
8705
|
+
template: `export { AppModule } from './app.module';`
|
|
8706
|
+
};
|
|
8707
|
+
|
|
8708
|
+
// src/single-process-custom-server/templates/web-server.ts
|
|
8709
|
+
var web_server_default = {
|
|
8710
|
+
filename: "apps/web/server.ts",
|
|
8711
|
+
template: `import 'reflect-metadata';
|
|
8712
|
+
import dotenv from 'dotenv';
|
|
8713
|
+
import { resolve } from 'path';
|
|
8714
|
+
|
|
8715
|
+
// Load root .env first, then local .env (local takes precedence)
|
|
8716
|
+
dotenv.config({ path: resolve(process.cwd(), '../../.env') });
|
|
8717
|
+
dotenv.config({ path: resolve(process.cwd(), '.env') });
|
|
8718
|
+
|
|
8719
|
+
import { NestFactory } from '@nestjs/core';
|
|
8720
|
+
import { AppModule } from '@<%= projectName %>/api';
|
|
8721
|
+
import next from 'next';
|
|
8722
|
+
import { createServer } from 'node:http';
|
|
8723
|
+
|
|
8724
|
+
const dev = process.env.NODE_ENV !== 'production';
|
|
8725
|
+
const port = parseInt(process.env.PORT ?? '3000', 10);
|
|
8726
|
+
|
|
8727
|
+
async function main() {
|
|
8728
|
+
const nextApp = next({ dev, port });
|
|
8729
|
+
const handle = nextApp.getRequestHandler();
|
|
8730
|
+
|
|
8731
|
+
await nextApp.prepare();
|
|
8732
|
+
|
|
8733
|
+
const nestApp = await NestFactory.create(AppModule);
|
|
8734
|
+
await nestApp.init();
|
|
8735
|
+
|
|
8736
|
+
const nestListener = nestApp
|
|
8737
|
+
.getHttpServer()
|
|
8738
|
+
.listeners('request')[0] as (req: any, res: any) => void;
|
|
8739
|
+
|
|
8740
|
+
const server = createServer((req, res) => {
|
|
8741
|
+
if (req.url?.startsWith('/api/')) {
|
|
8742
|
+
nestListener(req, res);
|
|
8743
|
+
} else {
|
|
8744
|
+
handle(req, res);
|
|
8745
|
+
}
|
|
8746
|
+
});
|
|
8747
|
+
|
|
8748
|
+
server.listen(port, () => {
|
|
8749
|
+
console.log(\`> Server ready on http://localhost:\${port}\`);
|
|
8750
|
+
});
|
|
8751
|
+
}
|
|
8752
|
+
|
|
8753
|
+
main().catch(console.error);`
|
|
8754
|
+
};
|
|
8755
|
+
|
|
8756
|
+
// src/single-process-custom-server/templates/web-package-json.ts
|
|
8757
|
+
var web_package_json_default = {
|
|
8758
|
+
filename: "apps/web/package.json",
|
|
8759
|
+
template: `{
|
|
8760
|
+
"name": "web",
|
|
8761
|
+
"version": "0.1.0",
|
|
8762
|
+
"type": "module",
|
|
8763
|
+
"private": true,
|
|
8764
|
+
"scripts": {
|
|
8765
|
+
"dev": "tsx watch --tsconfig tsconfig.server.json server.ts",
|
|
8766
|
+
"build": "next build",
|
|
8767
|
+
"start": "next start",
|
|
8768
|
+
"lint": "eslint --max-warnings 0 && next typegen && tsc --noEmit",
|
|
8769
|
+
"db:migrate": "better-auth migrate"
|
|
8770
|
+
},
|
|
8771
|
+
"dependencies": {
|
|
8772
|
+
"@<%= projectName %>/api": "workspace:*",
|
|
8773
|
+
"@<%= projectName %>/auth": "workspace:*",
|
|
8774
|
+
"@<%= projectName %>/ui": "workspace:*",
|
|
8775
|
+
"@tailwindcss/postcss": "^4.2.1",
|
|
8776
|
+
"dotenv": "^17.3.1",
|
|
8777
|
+
"@tanstack/react-form": "^1.28.5",
|
|
8778
|
+
"@tanstack/react-query": "^5.90.21",
|
|
8779
|
+
"better-auth": "^1.2.8",
|
|
8780
|
+
"next": "16.2.1",
|
|
8781
|
+
"react": "^19.2.4",
|
|
8782
|
+
"react-dom": "^19.2.4",
|
|
8783
|
+
"tailwindcss": "^4.2.1"
|
|
8784
|
+
},
|
|
8785
|
+
"devDependencies": {
|
|
8786
|
+
"@<%= projectName %>/eslint-config": "workspace:*",
|
|
8787
|
+
"@<%= projectName %>/typescript-config": "workspace:*",
|
|
8788
|
+
"@types/node": "^22.15.3",
|
|
8789
|
+
"@types/react": "19.2.14",
|
|
8790
|
+
"@types/react-dom": "19.2.3",
|
|
8791
|
+
"eslint": "^9.39.1",
|
|
8792
|
+
"tsx": "^4.19.4",
|
|
8793
|
+
"typescript": "6.0.2"
|
|
8794
|
+
}
|
|
8795
|
+
}`
|
|
8796
|
+
};
|
|
8797
|
+
|
|
8798
|
+
// src/single-process-custom-server/templates/web-next-config.ts
|
|
8799
|
+
var web_next_config_default = {
|
|
8800
|
+
filename: "apps/web/next.config.js",
|
|
8801
|
+
template: `import dotenv from 'dotenv';
|
|
8802
|
+
import { resolve } from 'path';
|
|
8803
|
+
|
|
8804
|
+
// Load root .env first, then local .env (local takes precedence)
|
|
8805
|
+
dotenv.config({ path: resolve(process.cwd(), '../../.env') });
|
|
8806
|
+
dotenv.config({ path: resolve(process.cwd(), '.env') });
|
|
8807
|
+
|
|
8808
|
+
/** @type {import('next').NextConfig} */
|
|
8809
|
+
const nextConfig = {
|
|
8810
|
+
output: "standalone",
|
|
8811
|
+
};
|
|
8812
|
+
|
|
8813
|
+
export default nextConfig;`
|
|
8814
|
+
};
|
|
8815
|
+
|
|
8816
|
+
// src/single-process-custom-server/templates/web-tsconfig-server.ts
|
|
8817
|
+
var web_tsconfig_server_default = {
|
|
8818
|
+
filename: "apps/web/tsconfig.server.json",
|
|
8819
|
+
template: `{
|
|
8820
|
+
"compilerOptions": {
|
|
8821
|
+
"module": "nodenext",
|
|
8822
|
+
"moduleResolution": "nodenext",
|
|
8823
|
+
"target": "ES2023",
|
|
8824
|
+
"esModuleInterop": true,
|
|
8825
|
+
"emitDecoratorMetadata": true,
|
|
8826
|
+
"experimentalDecorators": true,
|
|
8827
|
+
"allowSyntheticDefaultImports": true,
|
|
8828
|
+
"skipLibCheck": true,
|
|
8829
|
+
"strictNullChecks": true,
|
|
8830
|
+
"noImplicitAny": false
|
|
8831
|
+
},
|
|
8832
|
+
"include": ["server.ts"],
|
|
8833
|
+
"exclude": ["node_modules"]
|
|
8834
|
+
}`
|
|
8835
|
+
};
|
|
8836
|
+
|
|
8837
|
+
// src/single-process-custom-server/index.ts
|
|
8838
|
+
var singleProcessCustomServer = {
|
|
8839
|
+
templates: [
|
|
8840
|
+
api_package_json_default,
|
|
8841
|
+
api_src_index_default,
|
|
8842
|
+
web_server_default,
|
|
8843
|
+
web_package_json_default,
|
|
8844
|
+
web_next_config_default,
|
|
8845
|
+
web_tsconfig_server_default
|
|
8846
|
+
]
|
|
8847
|
+
};
|
|
8848
|
+
var single_process_custom_server_default = singleProcessCustomServer;
|
|
8849
|
+
|
|
8850
|
+
// src/single-process-static-export/templates/api-app-module.ts
|
|
8851
|
+
var api_app_module_default = {
|
|
8852
|
+
filename: "apps/api/src/app.module.ts",
|
|
8853
|
+
template: `import { join } from 'path';
|
|
8854
|
+
import { Module } from '@nestjs/common';
|
|
8855
|
+
import { APP_GUARD } from '@nestjs/core';
|
|
8856
|
+
import { ServeStaticModule } from '@nestjs/serve-static';
|
|
8857
|
+
import { AuthGuard, AuthModule } from '@thallesp/nestjs-better-auth';
|
|
8858
|
+
import { auth } from '@<%= projectName %>/auth';
|
|
8859
|
+
import { AppController } from './app.controller';
|
|
8860
|
+
import { TodosModule } from './todos/todos.module';
|
|
8861
|
+
|
|
8862
|
+
@Module({
|
|
8863
|
+
imports: [
|
|
8864
|
+
ServeStaticModule.forRoot({
|
|
8865
|
+
rootPath: join(process.cwd(), '../web/out'),
|
|
8866
|
+
exclude: ['/api/(.*)'],
|
|
8867
|
+
}),
|
|
8868
|
+
AuthModule.forRoot({ auth }),
|
|
8869
|
+
TodosModule,
|
|
8870
|
+
],
|
|
8871
|
+
controllers: [AppController],
|
|
8872
|
+
providers: [{ provide: APP_GUARD, useClass: AuthGuard }],
|
|
8873
|
+
})
|
|
8874
|
+
export class AppModule {}`
|
|
8875
|
+
};
|
|
8876
|
+
|
|
8877
|
+
// src/single-process-static-export/templates/api-package-json.ts
|
|
8878
|
+
var api_package_json_default2 = {
|
|
8879
|
+
filename: "apps/api/package.json",
|
|
8880
|
+
template: `{
|
|
8881
|
+
"name": "api",
|
|
8882
|
+
"version": "0.0.1",
|
|
8883
|
+
"description": "",
|
|
8884
|
+
"author": "",
|
|
8885
|
+
"private": true,
|
|
8886
|
+
"license": "UNLICENSED",
|
|
8887
|
+
"scripts": {
|
|
8888
|
+
"build": "nest build",
|
|
8889
|
+
"start": "nest start",
|
|
8890
|
+
"dev": "nest start --watch",
|
|
8891
|
+
"start:dev": "nest start --watch",
|
|
8892
|
+
"start:debug": "nest start --debug --watch",
|
|
8893
|
+
"start:prod": "node dist/main",
|
|
8894
|
+
"lint": "eslint \\"{src,apps,libs,test}/**/*.ts\\" --fix"
|
|
8895
|
+
},
|
|
8896
|
+
"dependencies": {
|
|
8897
|
+
"@nestjs/common": "^11.0.1",
|
|
8898
|
+
"@nestjs/core": "^11.0.1",
|
|
8899
|
+
"@nestjs/platform-express": "^11.0.1",
|
|
8900
|
+
"@nestjs/serve-static": "^5.0.0",
|
|
8901
|
+
"@<%= projectName %>/auth": "workspace:*",
|
|
8902
|
+
"@thallesp/nestjs-better-auth": "^2.5.1",
|
|
8903
|
+
"dotenv": "^17.3.1",
|
|
8904
|
+
"reflect-metadata": "^0.2.2",
|
|
8905
|
+
"rxjs": "^7.8.1"
|
|
8906
|
+
},
|
|
8907
|
+
"devDependencies": {
|
|
8908
|
+
"@eslint/eslintrc": "^3.2.0",
|
|
8909
|
+
"@eslint/js": "^9.18.0",
|
|
8910
|
+
"@nestjs/cli": "^11.0.0",
|
|
8911
|
+
"@nestjs/schematics": "^11.0.0",
|
|
8912
|
+
"@nestjs/testing": "^11.0.1",
|
|
8913
|
+
"@types/express": "^5.0.0",
|
|
8914
|
+
"@types/node": "^22.10.7",
|
|
8915
|
+
"@types/supertest": "^6.0.2",
|
|
8916
|
+
"eslint": "^9.18.0",
|
|
8917
|
+
"eslint-config-prettier": "^10.0.1",
|
|
8918
|
+
"globals": "^16.0.0",
|
|
8919
|
+
"supertest": "^7.0.0",
|
|
8920
|
+
"ts-node": "^10.9.2",
|
|
8921
|
+
"tsconfig-paths": "^4.2.0",
|
|
8922
|
+
"typescript": "6.0.2",
|
|
8923
|
+
"typescript-eslint": "^8.20.0"
|
|
8924
|
+
}
|
|
8925
|
+
}`
|
|
8926
|
+
};
|
|
8927
|
+
|
|
8928
|
+
// src/single-process-static-export/templates/web-next-config.ts
|
|
8929
|
+
var web_next_config_default2 = {
|
|
8930
|
+
filename: "apps/web/next.config.js",
|
|
8931
|
+
template: `import dotenv from 'dotenv';
|
|
8932
|
+
import { resolve } from 'path';
|
|
8933
|
+
|
|
8934
|
+
// Load root .env first, then local .env (local takes precedence)
|
|
8935
|
+
dotenv.config({ path: resolve(process.cwd(), '../../.env') });
|
|
8936
|
+
dotenv.config({ path: resolve(process.cwd(), '.env') });
|
|
8937
|
+
|
|
8938
|
+
const isProduction = process.env.NODE_ENV === 'production';
|
|
8939
|
+
|
|
8940
|
+
/** @type {import('next').NextConfig} */
|
|
8941
|
+
const nextConfig = {
|
|
8942
|
+
// Static export in production \u2014 served by NestJS via ServeStaticModule.
|
|
8943
|
+
// rewrites() is incompatible with output: "export", so dev uses the proxy
|
|
8944
|
+
// and production uses the static files.
|
|
8945
|
+
...(isProduction
|
|
8946
|
+
? { output: 'export' }
|
|
8947
|
+
: {
|
|
8948
|
+
async rewrites() {
|
|
8949
|
+
return [
|
|
8950
|
+
{
|
|
8951
|
+
source: '/api/:path*',
|
|
8952
|
+
destination: 'http://localhost:3001/api/:path*',
|
|
8953
|
+
},
|
|
8954
|
+
];
|
|
8955
|
+
},
|
|
8956
|
+
}),
|
|
8957
|
+
};
|
|
8958
|
+
|
|
8959
|
+
export default nextConfig;`
|
|
8960
|
+
};
|
|
8961
|
+
|
|
8962
|
+
// src/single-process-static-export/index.ts
|
|
8963
|
+
var singleProcessStaticExport = {
|
|
8964
|
+
templates: [api_app_module_default, api_package_json_default2, web_next_config_default2]
|
|
8965
|
+
};
|
|
8966
|
+
var single_process_static_export_default = singleProcessStaticExport;
|
|
8967
|
+
|
|
8968
|
+
// src/single-process-pages/templates/api-package-json.ts
|
|
8969
|
+
var api_package_json_default3 = {
|
|
8970
|
+
filename: "apps/api/package.json",
|
|
8971
|
+
template: `{
|
|
8972
|
+
"name": "@<%= projectName %>/api",
|
|
8973
|
+
"version": "0.0.1",
|
|
8974
|
+
"description": "",
|
|
8975
|
+
"author": "",
|
|
8976
|
+
"private": true,
|
|
8977
|
+
"license": "UNLICENSED",
|
|
8978
|
+
"exports": {
|
|
8979
|
+
".": "./src/index.ts"
|
|
8980
|
+
},
|
|
8981
|
+
"scripts": {
|
|
8982
|
+
"build": "nest build",
|
|
8983
|
+
"start": "nest start",
|
|
8984
|
+
"dev": "nest start --watch",
|
|
8985
|
+
"start:dev": "nest start --watch",
|
|
8986
|
+
"start:debug": "nest start --debug --watch",
|
|
8987
|
+
"start:prod": "node dist/main",
|
|
8988
|
+
"lint": "eslint \\"{src,apps,libs,test}/**/*.ts\\" --fix"
|
|
8989
|
+
},
|
|
8990
|
+
"dependencies": {
|
|
8991
|
+
"@nestjs/common": "^11.0.1",
|
|
8992
|
+
"@nestjs/core": "^11.0.1",
|
|
8993
|
+
"@nestjs/platform-express": "^11.0.1",
|
|
8994
|
+
"@<%= projectName %>/auth": "workspace:*",
|
|
8995
|
+
"@thallesp/nestjs-better-auth": "^2.5.1",
|
|
8996
|
+
"dotenv": "^17.3.1",
|
|
8997
|
+
"reflect-metadata": "^0.2.2",
|
|
8998
|
+
"rxjs": "^7.8.1"
|
|
8999
|
+
},
|
|
9000
|
+
"devDependencies": {
|
|
9001
|
+
"@eslint/eslintrc": "^3.2.0",
|
|
9002
|
+
"@eslint/js": "^9.18.0",
|
|
9003
|
+
"@nestjs/cli": "^11.0.0",
|
|
9004
|
+
"@nestjs/schematics": "^11.0.0",
|
|
9005
|
+
"@nestjs/testing": "^11.0.1",
|
|
9006
|
+
"@types/express": "^5.0.0",
|
|
9007
|
+
"@types/node": "^22.10.7",
|
|
9008
|
+
"@types/supertest": "^6.0.2",
|
|
9009
|
+
"eslint": "^9.18.0",
|
|
9010
|
+
"eslint-config-prettier": "^10.0.1",
|
|
9011
|
+
"globals": "^16.0.0",
|
|
9012
|
+
"supertest": "^7.0.0",
|
|
9013
|
+
"ts-node": "^10.9.2",
|
|
9014
|
+
"tsconfig-paths": "^4.2.0",
|
|
9015
|
+
"typescript": "6.0.2",
|
|
9016
|
+
"typescript-eslint": "^8.20.0"
|
|
9017
|
+
}
|
|
9018
|
+
}`
|
|
9019
|
+
};
|
|
9020
|
+
|
|
9021
|
+
// src/single-process-pages/templates/api-src-index.ts
|
|
9022
|
+
var api_src_index_default2 = {
|
|
9023
|
+
filename: "apps/api/src/index.ts",
|
|
9024
|
+
template: `export { AppModule } from './app.module';`
|
|
9025
|
+
};
|
|
9026
|
+
|
|
9027
|
+
// src/single-process-pages/templates/web-api-catchall.ts
|
|
9028
|
+
var web_api_catchall_default = {
|
|
9029
|
+
filename: "apps/web/pages/api/[...path].ts",
|
|
9030
|
+
template: `import 'reflect-metadata';
|
|
9031
|
+
import type { NextApiRequest, NextApiResponse } from 'next';
|
|
9032
|
+
import type { INestApplication } from '@nestjs/common';
|
|
9033
|
+
|
|
9034
|
+
export const config = {
|
|
9035
|
+
api: {
|
|
9036
|
+
bodyParser: false,
|
|
9037
|
+
externalResolver: true,
|
|
9038
|
+
},
|
|
9039
|
+
};
|
|
9040
|
+
|
|
9041
|
+
let app: INestApplication | null = null;
|
|
9042
|
+
|
|
9043
|
+
async function getApp(): Promise<INestApplication> {
|
|
9044
|
+
if (!app) {
|
|
9045
|
+
const { NestFactory } = await import('@nestjs/core');
|
|
9046
|
+
const { AppModule } = await import('@<%= projectName %>/api');
|
|
9047
|
+
app = await NestFactory.create(AppModule, { bodyParser: false });
|
|
9048
|
+
app.setGlobalPrefix('api');
|
|
9049
|
+
await app.init();
|
|
9050
|
+
}
|
|
9051
|
+
return app;
|
|
9052
|
+
}
|
|
9053
|
+
|
|
9054
|
+
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
|
9055
|
+
const nestApp = await getApp();
|
|
9056
|
+
const express = nestApp.getHttpAdapter().getInstance() as (
|
|
9057
|
+
req: NextApiRequest,
|
|
9058
|
+
res: NextApiResponse
|
|
9059
|
+
) => void;
|
|
9060
|
+
express(req, res);
|
|
9061
|
+
}`
|
|
9062
|
+
};
|
|
9063
|
+
|
|
9064
|
+
// src/single-process-pages/templates/web-package-json.ts
|
|
9065
|
+
var web_package_json_default2 = {
|
|
9066
|
+
filename: "apps/web/package.json",
|
|
9067
|
+
template: `{
|
|
9068
|
+
"name": "web",
|
|
9069
|
+
"version": "0.1.0",
|
|
9070
|
+
"type": "module",
|
|
9071
|
+
"private": true,
|
|
9072
|
+
"scripts": {
|
|
9073
|
+
"dev": "next dev --port 3000",
|
|
9074
|
+
"build": "next build",
|
|
9075
|
+
"start": "next start",
|
|
9076
|
+
"lint": "eslint --max-warnings 0 && next typegen && tsc --noEmit",
|
|
9077
|
+
"db:migrate": "better-auth migrate"
|
|
9078
|
+
},
|
|
9079
|
+
"dependencies": {
|
|
9080
|
+
"@<%= projectName %>/api": "workspace:*",
|
|
9081
|
+
"@<%= projectName %>/auth": "workspace:*",
|
|
9082
|
+
"@<%= projectName %>/ui": "workspace:*",
|
|
9083
|
+
"@tailwindcss/postcss": "^4.2.1",
|
|
9084
|
+
"dotenv": "^17.3.1",
|
|
9085
|
+
"@tanstack/react-form": "^1.28.5",
|
|
9086
|
+
"@tanstack/react-query": "^5.90.21",
|
|
9087
|
+
"better-auth": "^1.2.8",
|
|
9088
|
+
"next": "16.2.1",
|
|
9089
|
+
"react": "^19.2.4",
|
|
9090
|
+
"react-dom": "^19.2.4",
|
|
9091
|
+
"tailwindcss": "^4.2.1"
|
|
9092
|
+
},
|
|
9093
|
+
"devDependencies": {
|
|
9094
|
+
"@<%= projectName %>/eslint-config": "workspace:*",
|
|
9095
|
+
"@<%= projectName %>/typescript-config": "workspace:*",
|
|
9096
|
+
"@types/node": "^22.15.3",
|
|
9097
|
+
"@types/react": "19.2.14",
|
|
9098
|
+
"@types/react-dom": "19.2.3",
|
|
9099
|
+
"eslint": "^9.39.1",
|
|
9100
|
+
"typescript": "6.0.2"
|
|
9101
|
+
}
|
|
9102
|
+
}`
|
|
9103
|
+
};
|
|
9104
|
+
|
|
9105
|
+
// src/single-process-pages/templates/web-next-config.ts
|
|
9106
|
+
var web_next_config_default3 = {
|
|
9107
|
+
filename: "apps/web/next.config.js",
|
|
9108
|
+
template: `import dotenv from 'dotenv';
|
|
9109
|
+
import { resolve } from 'path';
|
|
9110
|
+
|
|
9111
|
+
// Load root .env first, then local .env (local takes precedence)
|
|
9112
|
+
dotenv.config({ path: resolve(process.cwd(), '../../.env') });
|
|
9113
|
+
dotenv.config({ path: resolve(process.cwd(), '.env') });
|
|
9114
|
+
|
|
9115
|
+
/** @type {import('next').NextConfig} */
|
|
9116
|
+
const nextConfig = {
|
|
9117
|
+
output: "standalone",
|
|
9118
|
+
};
|
|
9119
|
+
|
|
9120
|
+
export default nextConfig;`
|
|
9121
|
+
};
|
|
9122
|
+
|
|
9123
|
+
// src/single-process-pages/index.ts
|
|
9124
|
+
var singleProcessPages = {
|
|
9125
|
+
templates: [
|
|
9126
|
+
api_package_json_default3,
|
|
9127
|
+
api_src_index_default2,
|
|
9128
|
+
web_api_catchall_default,
|
|
9129
|
+
web_package_json_default2,
|
|
9130
|
+
web_next_config_default3
|
|
9131
|
+
]
|
|
9132
|
+
};
|
|
9133
|
+
var single_process_pages_default = singleProcessPages;
|
|
9134
|
+
|
|
9135
|
+
// src/nest-di-only/templates/api-package-json.ts
|
|
9136
|
+
var api_package_json_default4 = {
|
|
9137
|
+
filename: "packages/api/package.json",
|
|
9138
|
+
template: `{
|
|
9139
|
+
"name": "@<%= projectName %>/api",
|
|
9140
|
+
"version": "0.0.1",
|
|
9141
|
+
"private": true,
|
|
9142
|
+
"exports": {
|
|
9143
|
+
".": {
|
|
9144
|
+
"default": "./dist/index.js",
|
|
9145
|
+
"types": "./dist/index.d.ts"
|
|
9146
|
+
}
|
|
9147
|
+
},
|
|
9148
|
+
"scripts": {
|
|
9149
|
+
"build": "tsc",
|
|
9150
|
+
"dev": "tsc --watch"
|
|
9151
|
+
},
|
|
9152
|
+
"dependencies": {
|
|
9153
|
+
"@<%= projectName %>/auth": "workspace:*",
|
|
9154
|
+
"@nestjs/common": "^11.0.1",
|
|
9155
|
+
"@nestjs/core": "^11.0.1",
|
|
9156
|
+
"reflect-metadata": "^0.2.2",
|
|
9157
|
+
"rxjs": "^7.8.1"
|
|
9158
|
+
},
|
|
9159
|
+
"devDependencies": {
|
|
9160
|
+
"@<%= projectName %>/typescript-config": "workspace:*",
|
|
9161
|
+
"@types/node": "^22.15.3",
|
|
9162
|
+
"typescript": "6.0.2"
|
|
9163
|
+
}
|
|
9164
|
+
}`
|
|
9165
|
+
};
|
|
9166
|
+
|
|
9167
|
+
// src/nest-di-only/templates/api-tsconfig.ts
|
|
9168
|
+
var api_tsconfig_default = {
|
|
9169
|
+
filename: "packages/api/tsconfig.json",
|
|
9170
|
+
template: `{
|
|
9171
|
+
"compilerOptions": {
|
|
9172
|
+
"declaration": true,
|
|
9173
|
+
"declarationMap": true,
|
|
9174
|
+
"emitDecoratorMetadata": true,
|
|
9175
|
+
"experimentalDecorators": true,
|
|
9176
|
+
"module": "CommonJS",
|
|
9177
|
+
"outDir": "dist",
|
|
9178
|
+
"rootDir": "src",
|
|
9179
|
+
"skipLibCheck": true,
|
|
9180
|
+
"strict": true,
|
|
9181
|
+
"target": "ES2021"
|
|
9182
|
+
},
|
|
9183
|
+
"include": ["src"],
|
|
9184
|
+
"exclude": ["node_modules", "dist"]
|
|
9185
|
+
}`
|
|
9186
|
+
};
|
|
9187
|
+
|
|
9188
|
+
// src/nest-di-only/templates/api-index.ts
|
|
9189
|
+
var api_index_default = {
|
|
9190
|
+
filename: "packages/api/src/index.ts",
|
|
9191
|
+
template: `export { AppModule } from './app.module';
|
|
9192
|
+
export { TodosService } from './todos/todos.service';
|
|
9193
|
+
export type { Todo } from './todos/todos.service';`
|
|
9194
|
+
};
|
|
9195
|
+
|
|
9196
|
+
// src/nest-di-only/templates/api-app-module.ts
|
|
9197
|
+
var api_app_module_default2 = {
|
|
9198
|
+
filename: "packages/api/src/app.module.ts",
|
|
9199
|
+
template: `import { Module } from '@nestjs/common';
|
|
9200
|
+
import { TodosModule } from './todos/todos.module';
|
|
9201
|
+
|
|
9202
|
+
@Module({
|
|
9203
|
+
imports: [TodosModule],
|
|
9204
|
+
})
|
|
9205
|
+
export class AppModule {}`
|
|
9206
|
+
};
|
|
9207
|
+
|
|
9208
|
+
// src/nest-di-only/templates/api-todos-service.ts
|
|
9209
|
+
var api_todos_service_default = {
|
|
9210
|
+
filename: "packages/api/src/todos/todos.service.ts",
|
|
9211
|
+
template: `import { Injectable, NotFoundException } from '@nestjs/common';
|
|
9212
|
+
|
|
9213
|
+
export interface Todo {
|
|
9214
|
+
id: number;
|
|
9215
|
+
title: string;
|
|
9216
|
+
done: boolean;
|
|
9217
|
+
}
|
|
9218
|
+
|
|
9219
|
+
@Injectable()
|
|
9220
|
+
export class TodosService {
|
|
9221
|
+
private todos: Todo[] = [];
|
|
9222
|
+
private nextId = 1;
|
|
9223
|
+
|
|
9224
|
+
findAll(): Todo[] {
|
|
9225
|
+
return this.todos;
|
|
9226
|
+
}
|
|
9227
|
+
|
|
9228
|
+
create(title: string): Todo {
|
|
9229
|
+
const todo: Todo = { id: this.nextId++, title, done: false };
|
|
9230
|
+
this.todos.push(todo);
|
|
9231
|
+
return todo;
|
|
9232
|
+
}
|
|
9233
|
+
|
|
9234
|
+
toggle(id: number): Todo {
|
|
9235
|
+
const todo = this.todos.find((t) => t.id === id);
|
|
9236
|
+
if (!todo) throw new NotFoundException(\`Todo \${id} not found\`);
|
|
9237
|
+
todo.done = !todo.done;
|
|
9238
|
+
return todo;
|
|
9239
|
+
}
|
|
9240
|
+
|
|
9241
|
+
remove(id: number): void {
|
|
9242
|
+
const index = this.todos.findIndex((t) => t.id === id);
|
|
9243
|
+
if (index === -1) throw new NotFoundException(\`Todo \${id} not found\`);
|
|
9244
|
+
this.todos.splice(index, 1);
|
|
9245
|
+
}
|
|
9246
|
+
}`
|
|
9247
|
+
};
|
|
9248
|
+
|
|
9249
|
+
// src/nest-di-only/templates/api-todos-module.ts
|
|
9250
|
+
var api_todos_module_default = {
|
|
9251
|
+
filename: "packages/api/src/todos/todos.module.ts",
|
|
9252
|
+
template: `import { Module } from '@nestjs/common';
|
|
9253
|
+
import { TodosService } from './todos.service';
|
|
9254
|
+
|
|
9255
|
+
@Module({
|
|
9256
|
+
providers: [TodosService],
|
|
9257
|
+
exports: [TodosService],
|
|
9258
|
+
})
|
|
9259
|
+
export class TodosModule {}`
|
|
9260
|
+
};
|
|
9261
|
+
|
|
9262
|
+
// src/nest-di-only/templates/web-nest-context.ts
|
|
9263
|
+
var web_nest_context_default = {
|
|
9264
|
+
filename: "apps/web/lib/nest.ts",
|
|
9265
|
+
template: `import 'reflect-metadata';
|
|
9266
|
+
import { NestFactory } from '@nestjs/core';
|
|
9267
|
+
import { AppModule } from '@<%= projectName %>/api';
|
|
9268
|
+
import type { INestApplicationContext } from '@nestjs/common';
|
|
9269
|
+
|
|
9270
|
+
let context: INestApplicationContext | null = null;
|
|
9271
|
+
|
|
9272
|
+
export async function getNestApp(): Promise<INestApplicationContext> {
|
|
9273
|
+
if (!context) {
|
|
9274
|
+
context = await NestFactory.createApplicationContext(AppModule, {
|
|
9275
|
+
logger: false,
|
|
9276
|
+
});
|
|
9277
|
+
}
|
|
9278
|
+
return context;
|
|
9279
|
+
}`
|
|
9280
|
+
};
|
|
9281
|
+
|
|
9282
|
+
// src/nest-di-only/templates/web-todos-route.ts
|
|
9283
|
+
var web_todos_route_default = {
|
|
9284
|
+
filename: "apps/web/app/api/todos/route.ts",
|
|
9285
|
+
template: `import { NextResponse } from 'next/server';
|
|
9286
|
+
import { getNestApp } from '@/lib/nest';
|
|
9287
|
+
import { TodosService } from '@<%= projectName %>/api';
|
|
9288
|
+
|
|
9289
|
+
export async function GET() {
|
|
9290
|
+
const app = await getNestApp();
|
|
9291
|
+
const todos = app.get(TodosService);
|
|
9292
|
+
return NextResponse.json(todos.findAll());
|
|
9293
|
+
}
|
|
9294
|
+
|
|
9295
|
+
export async function POST(req: Request) {
|
|
9296
|
+
const { title } = await req.json();
|
|
9297
|
+
const app = await getNestApp();
|
|
9298
|
+
const todos = app.get(TodosService);
|
|
9299
|
+
return NextResponse.json(todos.create(title), { status: 201 });
|
|
9300
|
+
}`
|
|
9301
|
+
};
|
|
9302
|
+
|
|
9303
|
+
// src/nest-di-only/templates/web-todos-id-route.ts
|
|
9304
|
+
var web_todos_id_route_default = {
|
|
9305
|
+
filename: "apps/web/app/api/todos/[id]/route.ts",
|
|
9306
|
+
template: `import { NextResponse } from 'next/server';
|
|
9307
|
+
import { getNestApp } from '@/lib/nest';
|
|
9308
|
+
import { TodosService } from '@<%= projectName %>/api';
|
|
9309
|
+
|
|
9310
|
+
export async function DELETE(_req: Request, { params }: { params: Promise<{ id: string }> }) {
|
|
9311
|
+
const { id } = await params;
|
|
9312
|
+
const app = await getNestApp();
|
|
9313
|
+
const todos = app.get(TodosService);
|
|
9314
|
+
todos.remove(Number(id));
|
|
9315
|
+
return new NextResponse(null, { status: 204 });
|
|
9316
|
+
}`
|
|
9317
|
+
};
|
|
9318
|
+
|
|
9319
|
+
// src/nest-di-only/templates/web-todos-toggle-route.ts
|
|
9320
|
+
var web_todos_toggle_route_default = {
|
|
9321
|
+
filename: "apps/web/app/api/todos/[id]/toggle/route.ts",
|
|
9322
|
+
template: `import { NextResponse } from 'next/server';
|
|
9323
|
+
import { getNestApp } from '@/lib/nest';
|
|
9324
|
+
import { TodosService } from '@<%= projectName %>/api';
|
|
9325
|
+
|
|
9326
|
+
export async function PATCH(_req: Request, { params }: { params: Promise<{ id: string }> }) {
|
|
9327
|
+
const { id } = await params;
|
|
9328
|
+
const app = await getNestApp();
|
|
9329
|
+
const todos = app.get(TodosService);
|
|
9330
|
+
return NextResponse.json(todos.toggle(Number(id)));
|
|
9331
|
+
}`
|
|
9332
|
+
};
|
|
9333
|
+
|
|
9334
|
+
// src/nest-di-only/templates/web-package-json.ts
|
|
9335
|
+
var web_package_json_default3 = {
|
|
9336
|
+
filename: "apps/web/package.json",
|
|
9337
|
+
template: `{
|
|
9338
|
+
"name": "web",
|
|
9339
|
+
"version": "0.1.0",
|
|
9340
|
+
"type": "module",
|
|
9341
|
+
"private": true,
|
|
9342
|
+
"scripts": {
|
|
9343
|
+
"dev": "next dev --port 3000",
|
|
9344
|
+
"build": "next build",
|
|
9345
|
+
"start": "next start",
|
|
9346
|
+
"lint": "eslint --max-warnings 0 && next typegen && tsc --noEmit",
|
|
9347
|
+
"db:migrate": "better-auth migrate"
|
|
9348
|
+
},
|
|
9349
|
+
"dependencies": {
|
|
9350
|
+
"@<%= projectName %>/api": "workspace:*",
|
|
9351
|
+
"@<%= projectName %>/auth": "workspace:*",
|
|
9352
|
+
"@<%= projectName %>/ui": "workspace:*",
|
|
9353
|
+
"@nestjs/common": "^11.0.1",
|
|
9354
|
+
"@nestjs/core": "^11.0.1",
|
|
9355
|
+
"reflect-metadata": "^0.2.2",
|
|
9356
|
+
"@tailwindcss/postcss": "^4.2.1",
|
|
9357
|
+
"dotenv": "^17.3.1",
|
|
9358
|
+
"@tanstack/react-form": "^1.28.5",
|
|
9359
|
+
"@tanstack/react-query": "^5.90.21",
|
|
9360
|
+
"better-auth": "^1.2.8",
|
|
9361
|
+
"next": "16.2.1",
|
|
9362
|
+
"react": "^19.2.4",
|
|
9363
|
+
"react-dom": "^19.2.4",
|
|
9364
|
+
"tailwindcss": "^4.2.1"
|
|
9365
|
+
},
|
|
9366
|
+
"devDependencies": {
|
|
9367
|
+
"@<%= projectName %>/eslint-config": "workspace:*",
|
|
9368
|
+
"@<%= projectName %>/typescript-config": "workspace:*",
|
|
9369
|
+
"@types/node": "^22.15.3",
|
|
9370
|
+
"@types/react": "19.2.14",
|
|
9371
|
+
"@types/react-dom": "19.2.3",
|
|
9372
|
+
"eslint": "^9.39.1",
|
|
9373
|
+
"typescript": "6.0.2"
|
|
9374
|
+
}
|
|
9375
|
+
}`
|
|
9376
|
+
};
|
|
9377
|
+
|
|
9378
|
+
// src/nest-di-only/templates/web-next-config.ts
|
|
9379
|
+
var web_next_config_default4 = {
|
|
9380
|
+
filename: "apps/web/next.config.js",
|
|
9381
|
+
template: `import dotenv from 'dotenv';
|
|
9382
|
+
import { resolve } from 'path';
|
|
9383
|
+
|
|
9384
|
+
dotenv.config({ path: resolve(process.cwd(), '../../.env') });
|
|
9385
|
+
dotenv.config({ path: resolve(process.cwd(), '.env') });
|
|
9386
|
+
|
|
9387
|
+
/** @type {import('next').NextConfig} */
|
|
9388
|
+
const nextConfig = {
|
|
9389
|
+
serverExternalPackages: [
|
|
9390
|
+
'@<%= projectName %>/api',
|
|
9391
|
+
'@nestjs/core',
|
|
9392
|
+
'@nestjs/common',
|
|
9393
|
+
'reflect-metadata',
|
|
9394
|
+
],
|
|
9395
|
+
};
|
|
9396
|
+
|
|
9397
|
+
export default nextConfig;`
|
|
9398
|
+
};
|
|
9399
|
+
|
|
9400
|
+
// src/nest-di-only/index.ts
|
|
9401
|
+
var nestDiOnly = {
|
|
9402
|
+
templates: [
|
|
9403
|
+
api_package_json_default4,
|
|
9404
|
+
api_tsconfig_default,
|
|
9405
|
+
api_index_default,
|
|
9406
|
+
api_app_module_default2,
|
|
9407
|
+
api_todos_service_default,
|
|
9408
|
+
api_todos_module_default,
|
|
9409
|
+
web_nest_context_default,
|
|
9410
|
+
web_todos_route_default,
|
|
9411
|
+
web_todos_id_route_default,
|
|
9412
|
+
web_todos_toggle_route_default,
|
|
9413
|
+
web_package_json_default3,
|
|
9414
|
+
web_next_config_default4
|
|
9415
|
+
]
|
|
9416
|
+
};
|
|
9417
|
+
var nest_di_only_default = nestDiOnly;
|
|
9418
|
+
|
|
8461
9419
|
// src/index.ts
|
|
8462
9420
|
var staticDir = new URL("./static/", import.meta.url);
|
|
8463
9421
|
var staticDirPath = fileURLToPath(staticDir);
|
|
@@ -8474,7 +9432,12 @@ var templates = {
|
|
|
8474
9432
|
eslintConfig: eslint_config_default5,
|
|
8475
9433
|
typescriptConfig: typescript_config_default,
|
|
8476
9434
|
testingJest: testing_jest_default,
|
|
8477
|
-
testingVitest: testing_vitest_default
|
|
9435
|
+
testingVitest: testing_vitest_default,
|
|
9436
|
+
deploymentStandalone: deployment_standalone_default,
|
|
9437
|
+
deploymentCustomServer: single_process_custom_server_default,
|
|
9438
|
+
deploymentSpa: single_process_static_export_default,
|
|
9439
|
+
deploymentVercel: single_process_pages_default,
|
|
9440
|
+
nestDiOnly: nest_di_only_default
|
|
8478
9441
|
};
|
|
8479
9442
|
export {
|
|
8480
9443
|
getStaticFilePath,
|