create-newt-app 0.35.0 → 0.35.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 CHANGED
@@ -11,7 +11,7 @@ import { existsSync, promises } from "fs";
11
11
  import path from "path";
12
12
  import https from "node:https";
13
13
  //#region package.json
14
- var version = "0.35.0";
14
+ var version = "0.35.1";
15
15
  var engines = { "node": ">=24.0.0" };
16
16
  //#endregion
17
17
  //#region src/templates/root/index.ts
@@ -224,7 +224,18 @@ BETTER_AUTH_SECRET=generate-with-openssl-rand-base64-32
224
224
  # This is NOT the Next.js you know
225
225
 
226
226
  This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in \`node_modules/next/dist/docs/\` before writing any code. Heed deprecation notices.
227
- <!-- END:nextjs-agent-rules --><% if (shadcn) { %>
227
+ <!-- END:nextjs-agent-rules -->
228
+
229
+ <!-- BEGIN:turborepo-agent-rules -->
230
+
231
+ # This is NOT the Turborepo you know
232
+
233
+ Turborepo configuration, task behavior, and CLI commands can vary between installed versions and may differ from your training data. Resolve the \`turbo\` package from this file's directory or relevant workspace; in monorepos, it may not be visible from the repository root. For example, run \`node -p "require.resolve('turbo/package.json')"\` from a workspace that depends on \`turbo\`.
234
+
235
+ Read \`docs/README.md\` inside that installed package first, then read the relevant pages from its \`docs/\` directory before changing Turborepo configuration or commands. Heed deprecation notices. These bundled docs match the installed package version and are available without network access.
236
+
237
+ This block is written and re-added by \`turbo\` before repository-scoped commands when an AI agent is detected. In the Turborepo source repository, its template is defined in \`crates/turborepo-cli/src/cli/agent_guidance.rs\`. Removing the managed block while updates are enabled means a later qualifying invocation will add it again. Set \`"agentGuidance": false\` in the root \`turbo.json\` or \`turbo.jsonc\` to opt out; this does not remove an existing block. Keep the block committed with your work to avoid an uncommitted change on the next agent invocation.
238
+ <!-- END:turborepo-agent-rules --><% if (shadcn) { %>
228
239
 
229
240
  After making changes, run \`pnpm lint:check\` and fix all errors.<% } %>`
230
241
  },
@@ -1569,7 +1580,8 @@ const versions = {
1569
1580
  typescript: "6.0.2",
1570
1581
  "typescript-eslint": "^8.50.0",
1571
1582
  "unplugin-swc": "^1.5.9",
1572
- vitest: "^4.1.10"
1583
+ vitest: "^4.1.10",
1584
+ zod: "^4.6.5"
1573
1585
  };
1574
1586
  //#endregion
1575
1587
  //#region src/templates/shadcn-ui/index.ts
@@ -12273,12 +12285,14 @@ import { resolve } from 'path';
12273
12285
  dotenv.config({ path: resolve(process.cwd(), '../../.env') });
12274
12286
  dotenv.config({ path: resolve(process.cwd(), '.env') });
12275
12287
 
12288
+ import { StandardSchemaValidationPipe } from '@nestjs/common';
12276
12289
  import { NestFactory } from '@nestjs/core';
12277
12290
  import { AppModule } from './app.module';
12278
12291
 
12279
12292
  async function bootstrap() {
12280
12293
  const app = await NestFactory.create(AppModule, { bodyParser: false });
12281
12294
  app.setGlobalPrefix('api');
12295
+ app.useGlobalPipes(new StandardSchemaValidationPipe());
12282
12296
  app.enableCors({
12283
12297
  origin: process.env.CORS_ORIGIN ?? 'http://localhost:3000',
12284
12298
  credentials: true,
@@ -12507,6 +12521,7 @@ var todos_controller_default = {
12507
12521
  } from '@nestjs/common';
12508
12522
  import { Session } from '@thallesp/nestjs-better-auth';
12509
12523
  import type { UserSession } from '@thallesp/nestjs-better-auth';
12524
+ import { z } from 'zod';
12510
12525
  import { TodosService } from './todos.service';
12511
12526
 
12512
12527
  @Controller('todos')
@@ -12519,7 +12534,10 @@ export class TodosController {
12519
12534
  }
12520
12535
 
12521
12536
  @Post()
12522
- create(@Session() session: UserSession, @Body('title') title: string) {
12537
+ create(
12538
+ @Session() session: UserSession,
12539
+ @Body('title', { schema: z.string().trim().min(1) }) title: string,
12540
+ ) {
12523
12541
  return this.todosService.create(session.user.id, title);
12524
12542
  }
12525
12543
 
@@ -12635,6 +12653,7 @@ export async function POST(req: Request) {
12635
12653
  var web_todos_id_route_default = {
12636
12654
  filename: "apps/web/app/api/todos/[id]/route.ts",
12637
12655
  template: `import { NextResponse } from 'next/server';
12656
+ import { HttpException } from '@nestjs/common';
12638
12657
  import { headers } from 'next/headers';
12639
12658
  import { inject } from '@/lib/nest';
12640
12659
  import { auth } from '@<%= projectName %>/auth';
@@ -12645,8 +12664,15 @@ export async function DELETE(_req: Request, { params }: { params: Promise<{ id:
12645
12664
  if (!session) return new NextResponse('Unauthorized', { status: 401 });
12646
12665
  const { id } = await params;
12647
12666
  const todos = await inject(TodosService);
12648
- await todos.remove(session.user.id, id);
12649
- return new NextResponse(null, { status: 204 });
12667
+ try {
12668
+ await todos.remove(session.user.id, id);
12669
+ return new NextResponse(null, { status: 204 });
12670
+ } catch (err) {
12671
+ if (err instanceof HttpException) {
12672
+ return NextResponse.json(err.getResponse(), { status: err.getStatus() });
12673
+ }
12674
+ throw err;
12675
+ }
12650
12676
  }`
12651
12677
  };
12652
12678
  //#endregion
@@ -12654,6 +12680,7 @@ export async function DELETE(_req: Request, { params }: { params: Promise<{ id:
12654
12680
  var web_todos_toggle_route_default = {
12655
12681
  filename: "apps/web/app/api/todos/[id]/toggle/route.ts",
12656
12682
  template: `import { NextResponse } from 'next/server';
12683
+ import { HttpException } from '@nestjs/common';
12657
12684
  import { headers } from 'next/headers';
12658
12685
  import { inject } from '@/lib/nest';
12659
12686
  import { auth } from '@<%= projectName %>/auth';
@@ -12664,7 +12691,14 @@ export async function PATCH(_req: Request, { params }: { params: Promise<{ id: s
12664
12691
  if (!session) return new NextResponse('Unauthorized', { status: 401 });
12665
12692
  const { id } = await params;
12666
12693
  const todos = await inject(TodosService);
12667
- return NextResponse.json(await todos.toggle(session.user.id, id));
12694
+ try {
12695
+ return NextResponse.json(await todos.toggle(session.user.id, id));
12696
+ } catch (err) {
12697
+ if (err instanceof HttpException) {
12698
+ return NextResponse.json(err.getResponse(), { status: err.getStatus() });
12699
+ }
12700
+ throw err;
12701
+ }
12668
12702
  }`
12669
12703
  };
12670
12704
  //#endregion
@@ -13576,11 +13610,18 @@ const todoExampleApi = { templates: [
13576
13610
  db_schema_default,
13577
13611
  db_migration_todos_default
13578
13612
  ] };
13579
- const todoExampleControllers = { templates: [
13580
- todos_controller_default,
13581
- todos_module_controllers_default,
13582
- app_module_controllers_default
13583
- ] };
13613
+ const todoExampleControllers = {
13614
+ templates: [
13615
+ todos_controller_default,
13616
+ todos_module_controllers_default,
13617
+ app_module_controllers_default
13618
+ ],
13619
+ packages: [{
13620
+ package: "zod",
13621
+ module: "apps/api",
13622
+ version: versions.zod
13623
+ }]
13624
+ };
13584
13625
  const todoExampleDi = { templates: [
13585
13626
  web_todos_route_default,
13586
13627
  web_todos_id_route_default,
@@ -14170,7 +14211,7 @@ async function doInit(options) {
14170
14211
  console.log(chalk.blue(` cd ${name}`));
14171
14212
  if (!options.install) {
14172
14213
  console.log(chalk.blue(` pnpm install`));
14173
- console.log(chalk.blue(` pnpm format`));
14214
+ console.log(chalk.blue(` pnpm format:fix`));
14174
14215
  }
14175
14216
  if (!committed) console.log(chalk.blue(` git commit -m "Initial commit"`));
14176
14217
  console.log(chalk.blue(` pnpm dev`));