@newt-app/templates 0.3.0 → 0.4.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.js +27 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -177,7 +177,7 @@ Open [http://localhost:3000](http://localhost:3000).
|
|
|
177
177
|
|
|
178
178
|
// src/root/templates/env-example.ts
|
|
179
179
|
var env_example_default = {
|
|
180
|
-
filename: ".env
|
|
180
|
+
filename: ".env",
|
|
181
181
|
template: `DATABASE_URL=postgresql://user:password@localhost:5432/dbname
|
|
182
182
|
BETTER_AUTH_URL=http://localhost:3000
|
|
183
183
|
BETTER_AUTH_SECRET=your-secret-here`
|
|
@@ -218,6 +218,7 @@ var package_json_default2 = {
|
|
|
218
218
|
"@<%= projectName %>/auth": "workspace:*",
|
|
219
219
|
"@<%= projectName %>/ui": "workspace:*",
|
|
220
220
|
"@tailwindcss/postcss": "^4.2.1",
|
|
221
|
+
"dotenv": "^17.3.1",
|
|
221
222
|
"@tanstack/react-form": "^1.28.5",
|
|
222
223
|
"@tanstack/react-query": "^5.90.21",
|
|
223
224
|
"better-auth": "^1.2.8",
|
|
@@ -332,7 +333,14 @@ export default nextJsConfig;`
|
|
|
332
333
|
// src/web/templates/next-config.ts
|
|
333
334
|
var next_config_default = {
|
|
334
335
|
filename: "apps/web/next.config.js",
|
|
335
|
-
template:
|
|
336
|
+
template: `import dotenv from 'dotenv';
|
|
337
|
+
import { resolve } from 'path';
|
|
338
|
+
|
|
339
|
+
// Load root .env first, then local .env (local takes precedence)
|
|
340
|
+
dotenv.config({ path: resolve(process.cwd(), '../../.env') });
|
|
341
|
+
dotenv.config({ path: resolve(process.cwd(), '.env') });
|
|
342
|
+
|
|
343
|
+
/** @type {import('next').NextConfig} */
|
|
336
344
|
const nextConfig = {
|
|
337
345
|
output: "standalone",
|
|
338
346
|
async rewrites() {
|
|
@@ -448,7 +456,7 @@ export default function Home() {
|
|
|
448
456
|
return (
|
|
449
457
|
<main className="max-w-lg mx-auto min-h-full px-4 py-8 space-y-4">
|
|
450
458
|
<div className="pb-4 border-b">
|
|
451
|
-
<p className="font-mono text-
|
|
459
|
+
<p className="font-mono text-sm text-gray-400">apps/web/page.tsx</p>
|
|
452
460
|
<p className="text-sm text-gray-400">Delete me to get started!</p>
|
|
453
461
|
</div>
|
|
454
462
|
|
|
@@ -464,13 +472,13 @@ export default function Home() {
|
|
|
464
472
|
|
|
465
473
|
<div className="rounded-xl border p-6 space-y-1">
|
|
466
474
|
<p className="text-xs font-mono uppercase tracking-widest text-gray-400">next.js</p>
|
|
467
|
-
<p className="font-mono text-sm">apps/web/layout.tsx</p>
|
|
475
|
+
<p className="font-mono text-sm text-gray-400">apps/web/layout.tsx</p>
|
|
468
476
|
<p className="text-sm text-gray-400">Next.js rendering</p>
|
|
469
477
|
</div>
|
|
470
478
|
|
|
471
479
|
<div className="rounded-xl border p-6 space-y-1">
|
|
472
480
|
<p className="text-xs font-mono uppercase tracking-widest text-gray-400">nest.js</p>
|
|
473
|
-
<p className="font-mono text-sm">GET /api/hello</p>
|
|
481
|
+
<p className="font-mono text-sm text-gray-400">GET /api/hello</p>
|
|
474
482
|
<pre className="mt-2 border rounded-md p-3 text-sm bg-neutral-800">
|
|
475
483
|
<code>{JSON.stringify(hello, null, 2)}</code>
|
|
476
484
|
</pre>
|
|
@@ -1060,14 +1068,23 @@ export class AppModule {}`
|
|
|
1060
1068
|
// src/api/templates/main.ts
|
|
1061
1069
|
var main_default = {
|
|
1062
1070
|
filename: "apps/api/src/main.ts",
|
|
1063
|
-
template: `import 'dotenv
|
|
1071
|
+
template: `import dotenv from 'dotenv';
|
|
1072
|
+
import { resolve } from 'path';
|
|
1073
|
+
|
|
1074
|
+
// Load root .env first, then local .env (local takes precedence)
|
|
1075
|
+
dotenv.config({ path: resolve(process.cwd(), '../../.env') });
|
|
1076
|
+
dotenv.config({ path: resolve(process.cwd(), '.env') });
|
|
1077
|
+
|
|
1064
1078
|
import { NestFactory } from '@nestjs/core';
|
|
1065
1079
|
import { AppModule } from './app.module';
|
|
1066
1080
|
|
|
1067
1081
|
async function bootstrap() {
|
|
1068
1082
|
const app = await NestFactory.create(AppModule, { bodyParser: false });
|
|
1069
1083
|
app.setGlobalPrefix('api');
|
|
1070
|
-
app.enableCors({
|
|
1084
|
+
app.enableCors({
|
|
1085
|
+
origin: process.env.CORS_ORIGIN ?? 'http://localhost:3000',
|
|
1086
|
+
credentials: true,
|
|
1087
|
+
});
|
|
1071
1088
|
await app.listen(process.env.PORT ?? 3001);
|
|
1072
1089
|
}
|
|
1073
1090
|
void bootstrap();`
|
|
@@ -1972,7 +1989,7 @@ export default function Home() {
|
|
|
1972
1989
|
return (
|
|
1973
1990
|
<main className="max-w-lg mx-auto min-h-full px-4 py-8 space-y-4">
|
|
1974
1991
|
<div className="pb-4 border-b">
|
|
1975
|
-
<p className="font-mono text-
|
|
1992
|
+
<p className="font-mono text-sm text-muted-foreground">apps/web/page.tsx</p>
|
|
1976
1993
|
<p className="text-sm text-muted-foreground">Delete me to get started!</p>
|
|
1977
1994
|
</div>
|
|
1978
1995
|
|
|
@@ -1993,7 +2010,7 @@ export default function Home() {
|
|
|
1993
2010
|
</CardTitle>
|
|
1994
2011
|
</CardHeader>
|
|
1995
2012
|
<CardContent>
|
|
1996
|
-
<p className="font-mono text-sm">apps/web/layout.tsx</p>
|
|
2013
|
+
<p className="font-mono text-sm text-muted-foreground">apps/web/layout.tsx</p>
|
|
1997
2014
|
<p className="text-sm text-muted-foreground">Next.js rendering</p>
|
|
1998
2015
|
</CardContent>
|
|
1999
2016
|
</Card>
|
|
@@ -2005,7 +2022,7 @@ export default function Home() {
|
|
|
2005
2022
|
</CardTitle>
|
|
2006
2023
|
</CardHeader>
|
|
2007
2024
|
<CardContent>
|
|
2008
|
-
<p className="font-mono text-sm">GET /api/hello</p>
|
|
2025
|
+
<p className="font-mono text-sm text-muted-foreground">GET /api/hello</p>
|
|
2009
2026
|
<pre className="mt-2 rounded-md border p-3 text-sm bg-muted/50">
|
|
2010
2027
|
<code>{JSON.stringify(hello, null, 2)}</code>
|
|
2011
2028
|
</pre>
|