create-newt-app 0.35.5 → 0.35.6
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 +78 -124
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import { existsSync, promises, readdirSync } 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.
|
|
14
|
+
var version = "0.35.6";
|
|
15
15
|
var engines = { "node": ">=24.0.0" };
|
|
16
16
|
//#endregion
|
|
17
17
|
//#region src/templates/root/index.ts
|
|
@@ -177,44 +177,71 @@ pnpm dev
|
|
|
177
177
|
\`\`\`
|
|
178
178
|
|
|
179
179
|
Open [http://localhost:3000](http://localhost:3000).
|
|
180
|
-
<% if (deployment === '
|
|
180
|
+
<% if (deployment === 'none') { -%>
|
|
181
181
|
|
|
182
|
-
## Production
|
|
182
|
+
## Production
|
|
183
|
+
|
|
184
|
+
\`\`\`sh
|
|
185
|
+
pnpm db:migrate && pnpm build
|
|
186
|
+
pnpm --filter @<%= projectName %>/web start
|
|
187
|
+
\`\`\`
|
|
188
|
+
|
|
189
|
+
Open [http://localhost:3000](http://localhost:3000).
|
|
190
|
+
<% } else if (deployment === 'spa') { -%>
|
|
191
|
+
|
|
192
|
+
## Production
|
|
183
193
|
|
|
184
194
|
NestJS serves the static export and the API from one origin, so point \`BETTER_AUTH_URL\` at it:
|
|
185
195
|
|
|
186
196
|
\`\`\`sh
|
|
187
|
-
pnpm db:migrate
|
|
188
|
-
pnpm build
|
|
197
|
+
pnpm db:migrate && pnpm build
|
|
189
198
|
cd apps/api
|
|
190
199
|
BETTER_AUTH_URL=http://localhost:3001 pnpm start:prod
|
|
191
200
|
\`\`\`
|
|
192
201
|
|
|
193
202
|
Open [http://localhost:3001](http://localhost:3001). In a real deployment, set \`BETTER_AUTH_URL\` to the public URL.
|
|
203
|
+
<% } else if (deployment === 'standalone') { -%>
|
|
204
|
+
|
|
205
|
+
## Production
|
|
206
|
+
|
|
207
|
+
\`\`\`sh
|
|
208
|
+
docker compose up --build
|
|
209
|
+
\`\`\`
|
|
210
|
+
|
|
211
|
+
The \`migrate\` service applies migrations before the app starts. Open [http://localhost:3000](http://localhost:3000); set \`BETTER_AUTH_URL\` to the public URL in a real deployment.
|
|
194
212
|
<% } -%>
|
|
195
213
|
|
|
196
|
-
##
|
|
214
|
+
## Commands
|
|
197
215
|
|
|
198
|
-
-
|
|
216
|
+
- \`pnpm dev\`: run in development
|
|
217
|
+
- \`pnpm build\`, \`pnpm typecheck\`, \`pnpm test\`: build, type-check, and test every workspace
|
|
218
|
+
- \`pnpm lint:check\`: lint (fails on errors); \`pnpm format:fix\`: apply formatting
|
|
219
|
+
- \`pnpm db:migrate\`: run migrations; \`pnpm db:make <name>\`: scaffold a new one
|
|
199
220
|
<% if (nest === 'on') { -%>
|
|
200
|
-
-
|
|
201
|
-
<% } else if (nest === 'di-only') { -%>
|
|
202
|
-
- **api**: NestJS providers, resolved from the web process (no HTTP server)
|
|
221
|
+
- \`pnpm --filter @<%= projectName %>/api test:e2e\`: run the e2e suite
|
|
203
222
|
<% } -%>
|
|
204
223
|
|
|
205
|
-
##
|
|
224
|
+
## Environment
|
|
206
225
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
-
|
|
210
|
-
|
|
211
|
-
|
|
226
|
+
Set in \`.env\` (a committed \`.env.example\` documents each one):
|
|
227
|
+
|
|
228
|
+
- **BETTER_AUTH_URL**: the public origin of the app
|
|
229
|
+
- **BETTER_AUTH_SECRET**: a random secret used to sign sessions
|
|
230
|
+
<% if (database === 'postgres') { -%>
|
|
231
|
+
- **DATABASE_URL**: your Postgres connection string
|
|
232
|
+
<% } else { -%>
|
|
233
|
+
- **DATABASE_URL**: not set for SQLite (the app uses \`dev.db\` at the repo root); set it to a Postgres URL to use Postgres
|
|
212
234
|
<% } -%>
|
|
213
|
-
- **\`@<%= projectName %>/typescript-config\`**: shared tsconfig
|
|
214
235
|
|
|
215
|
-
##
|
|
236
|
+
## Layout
|
|
216
237
|
|
|
217
|
-
|
|
238
|
+
- **\`apps/web\`**: Next.js frontend (port 3000)
|
|
239
|
+
<% if (nest === 'on') { -%>
|
|
240
|
+
- **\`apps/api\`**: NestJS backend (port 3001)
|
|
241
|
+
<% } else if (nest === 'di-only') { -%>
|
|
242
|
+
- **\`apps/api\`**: NestJS providers, resolved in-process by the web app
|
|
243
|
+
<% } -%>
|
|
244
|
+
- **\`packages/\`**: \`auth\`, \`db\`, \`ui\`<% if (linter === 'eslint') { %>, \`eslint-config\`<% } %>, and shared \`typescript-config\`
|
|
218
245
|
`
|
|
219
246
|
},
|
|
220
247
|
{
|
|
@@ -252,7 +279,24 @@ Read \`docs/README.md\` inside that installed package first, then read the relev
|
|
|
252
279
|
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.
|
|
253
280
|
<!-- END:turborepo-agent-rules --><% if (shadcn) { %>
|
|
254
281
|
|
|
255
|
-
After making changes, run \`pnpm lint:check\` and fix all errors.<% }
|
|
282
|
+
After making changes, run \`pnpm lint:check\` and fix all errors.<% } %>
|
|
283
|
+
|
|
284
|
+
# Project notes
|
|
285
|
+
|
|
286
|
+
- **web** runs on port 3000<% if (nest === 'on') { %>; **api** (NestJS) runs on port 3001<% } %>.
|
|
287
|
+
<% if (nest === 'on') { -%>
|
|
288
|
+
- In development, \`apps/web\` rewrites \`/api/*\` to \`http://localhost:3001/api/*\` (see \`apps/web/next.config.js\`). The backend is a separate process; start both from the repo root with \`pnpm dev\`.
|
|
289
|
+
<% } else if (nest === 'di-only') { -%>
|
|
290
|
+
- There is no separate backend process. API routes are Next.js route handlers that resolve NestJS providers in-process.
|
|
291
|
+
<% } else { -%>
|
|
292
|
+
- There is no backend. API routes are served in-process by Next.js route handlers.
|
|
293
|
+
<% } -%>
|
|
294
|
+
- Migrations live in \`packages/db\`. Run \`pnpm db:migrate\`; scaffold a new one with \`pnpm db:make <name>\`.
|
|
295
|
+
- Environment is read from the root \`.env\` (see \`.env.example\`): \`DATABASE_URL\`, \`BETTER_AUTH_URL\`, \`BETTER_AUTH_SECRET\`.
|
|
296
|
+
<% if (nest !== 'off') { -%>
|
|
297
|
+
- NestJS controllers must validate request bodies with a schema (the api registers a global \`StandardSchemaValidationPipe\`); keep the todo controller as the reference for how to do it.
|
|
298
|
+
<% } -%>
|
|
299
|
+
`
|
|
256
300
|
},
|
|
257
301
|
{
|
|
258
302
|
filename: "CLAUDE.md",
|
|
@@ -337,45 +381,6 @@ yarn-error.log*
|
|
|
337
381
|
# typescript
|
|
338
382
|
*.tsbuildinfo
|
|
339
383
|
next-env.d.ts`
|
|
340
|
-
},
|
|
341
|
-
{
|
|
342
|
-
filename: "apps/web/README.md",
|
|
343
|
-
template: `This is a [Next.js](https://nextjs.org) project bootstrapped with [\`create-next-app\`](https://nextjs.org/docs/app/api-reference/create-next-app).
|
|
344
|
-
|
|
345
|
-
## Getting Started
|
|
346
|
-
|
|
347
|
-
First, run the development server:
|
|
348
|
-
|
|
349
|
-
\`\`\`bash
|
|
350
|
-
npm run dev
|
|
351
|
-
# or
|
|
352
|
-
yarn dev
|
|
353
|
-
# or
|
|
354
|
-
pnpm dev
|
|
355
|
-
# or
|
|
356
|
-
bun dev
|
|
357
|
-
\`\`\`
|
|
358
|
-
|
|
359
|
-
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
|
360
|
-
|
|
361
|
-
You can start editing the page by modifying \`app/page.tsx\`. The page auto-updates as you edit the file.
|
|
362
|
-
|
|
363
|
-
This project uses [\`next/font\`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load Inter, a custom Google Font.
|
|
364
|
-
|
|
365
|
-
## Learn More
|
|
366
|
-
|
|
367
|
-
To learn more about Next.js, take a look at the following resources:
|
|
368
|
-
|
|
369
|
-
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
|
370
|
-
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
|
371
|
-
|
|
372
|
-
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
|
|
373
|
-
|
|
374
|
-
## Deploy on Vercel
|
|
375
|
-
|
|
376
|
-
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
|
377
|
-
|
|
378
|
-
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.`
|
|
379
384
|
},
|
|
380
385
|
{
|
|
381
386
|
when: (s) => s.deployment === "none" && s.nest === "on",
|
|
@@ -938,21 +943,6 @@ describe('AppService', () => {
|
|
|
938
943
|
expect(service).toBeDefined();
|
|
939
944
|
});
|
|
940
945
|
});`
|
|
941
|
-
},
|
|
942
|
-
{
|
|
943
|
-
filename: "apps/api/README.md",
|
|
944
|
-
template: `# API
|
|
945
|
-
|
|
946
|
-
NestJS backend for the monorepo.
|
|
947
|
-
|
|
948
|
-
## Scripts
|
|
949
|
-
|
|
950
|
-
\`\`\`sh
|
|
951
|
-
pnpm dev # watch mode
|
|
952
|
-
pnpm build # production build
|
|
953
|
-
pnpm test # unit tests<% if (nest === 'on') { %>
|
|
954
|
-
pnpm test:e2e # e2e tests<% } %>
|
|
955
|
-
\`\`\``
|
|
956
946
|
}
|
|
957
947
|
] };
|
|
958
948
|
//#endregion
|
|
@@ -1106,12 +1096,21 @@ import { FileMigrationProvider, Migrator } from "kysely";
|
|
|
1106
1096
|
import { db } from "./index.js";
|
|
1107
1097
|
|
|
1108
1098
|
async function main() {
|
|
1099
|
+
const migrationFolder = path.join(process.cwd(), "src/migrations");
|
|
1100
|
+
try {
|
|
1101
|
+
await fs.access(migrationFolder);
|
|
1102
|
+
} catch {
|
|
1103
|
+
console.log("no migrations yet");
|
|
1104
|
+
await db.destroy();
|
|
1105
|
+
return;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1109
1108
|
const migrator = new Migrator({
|
|
1110
1109
|
db,
|
|
1111
1110
|
provider: new FileMigrationProvider({
|
|
1112
1111
|
fs,
|
|
1113
1112
|
path,
|
|
1114
|
-
migrationFolder
|
|
1113
|
+
migrationFolder,
|
|
1115
1114
|
}),
|
|
1116
1115
|
});
|
|
1117
1116
|
|
|
@@ -1178,23 +1177,6 @@ async function main() {
|
|
|
1178
1177
|
main();`
|
|
1179
1178
|
};
|
|
1180
1179
|
//#endregion
|
|
1181
|
-
//#region src/templates/db/templates/migrations-readme.ts
|
|
1182
|
-
var migrations_readme_default = {
|
|
1183
|
-
filename: "packages/db/src/migrations/README.md",
|
|
1184
|
-
template: `# Migrations
|
|
1185
|
-
|
|
1186
|
-
Kysely migrations run in filename order. Each file exports \`up\` and \`down\`.
|
|
1187
|
-
|
|
1188
|
-
\`\`\`bash
|
|
1189
|
-
pnpm db:make add_widgets # scaffold a new migration
|
|
1190
|
-
pnpm db:migrate # apply pending migrations
|
|
1191
|
-
\`\`\`
|
|
1192
|
-
|
|
1193
|
-
Migrations are written with Kysely's schema builder, so one file compiles to
|
|
1194
|
-
both SQLite (dev) and Postgres (prod). Prefer dialect-agnostic column types
|
|
1195
|
-
(\`text\`, \`integer\`) and app-generated string ids over auto-increment.`
|
|
1196
|
-
};
|
|
1197
|
-
//#endregion
|
|
1198
1180
|
//#region src/templates/db/templates/package-json-sqlite.ts
|
|
1199
1181
|
var package_json_sqlite_default = {
|
|
1200
1182
|
filename: "packages/db/package.json",
|
|
@@ -1310,8 +1292,7 @@ const shared = [
|
|
|
1310
1292
|
tsconfig_default$2,
|
|
1311
1293
|
src_schema_default,
|
|
1312
1294
|
src_migrate_default,
|
|
1313
|
-
scripts_new_migration_default
|
|
1314
|
-
migrations_readme_default
|
|
1295
|
+
scripts_new_migration_default
|
|
1315
1296
|
];
|
|
1316
1297
|
const dbSqlite = { templates: [
|
|
1317
1298
|
...shared,
|
|
@@ -1558,7 +1539,7 @@ const versions = {
|
|
|
1558
1539
|
"@nestjs/schematics": "^12.0.5",
|
|
1559
1540
|
"@nestjs/serve-static": "^12.0.0",
|
|
1560
1541
|
"@nestjs/testing": "^12.1.0",
|
|
1561
|
-
"@next/eslint-plugin-next": "^16.
|
|
1542
|
+
"@next/eslint-plugin-next": "^16.4.0",
|
|
1562
1543
|
"@oxlint/plugins": "^1.74.0",
|
|
1563
1544
|
"@shadcn/lint": "^0.1.0",
|
|
1564
1545
|
"@shadcn/react": "^0.2.1",
|
|
@@ -1602,7 +1583,7 @@ const versions = {
|
|
|
1602
1583
|
jest: "^30.0.0",
|
|
1603
1584
|
kysely: "^0.28.2",
|
|
1604
1585
|
"lucide-react": "^1.16.0",
|
|
1605
|
-
next: "16.
|
|
1586
|
+
next: "16.4.0",
|
|
1606
1587
|
"next-themes": "^0.4.6",
|
|
1607
1588
|
oxfmt: "^0.59.0",
|
|
1608
1589
|
oxlint: "^1.80.0",
|
|
@@ -11275,37 +11256,10 @@ var plugin_package_json_default = {
|
|
|
11275
11256
|
}`
|
|
11276
11257
|
};
|
|
11277
11258
|
//#endregion
|
|
11278
|
-
//#region src/templates/anti-slop/templates/plugin-readme.ts
|
|
11279
|
-
var plugin_readme_default = {
|
|
11280
|
-
filename: "tools/oxlint/anti-slop/README.md",
|
|
11281
|
-
template: `# anti-slop
|
|
11282
|
-
|
|
11283
|
-
Oxlint rules that reject low-evidence TypeScript patterns, vendored from
|
|
11284
|
-
[dmmulroy/anti-slop](https://github.com/dmmulroy/anti-slop) at \`6d538555cb15\` (MIT, see LICENSE).
|
|
11285
|
-
|
|
11286
|
-
Upstream ships these to be vendored rather than depended on, so these files are
|
|
11287
|
-
yours: read them, change the messages, delete the rules you disagree with.
|
|
11288
|
-
|
|
11289
|
-
\`.oxlintrc.json\` registers the plugin and turns every rule on as an error.
|
|
11290
|
-
Turn one off there:
|
|
11291
|
-
|
|
11292
|
-
\`\`\`json
|
|
11293
|
-
{
|
|
11294
|
-
"rules": {
|
|
11295
|
-
"anti-slop/no-runtime-typeof": "off"
|
|
11296
|
-
}
|
|
11297
|
-
}
|
|
11298
|
-
\`\`\`
|
|
11299
|
-
|
|
11300
|
-
Vendored shadcn components under \`packages/ui/src/components\` are exempt, since
|
|
11301
|
-
they are upstream code you re-pull rather than write.
|
|
11302
|
-
`
|
|
11303
|
-
};
|
|
11304
|
-
//#endregion
|
|
11305
11259
|
//#region src/templates/anti-slop/index.ts
|
|
11306
11260
|
const plugin = "tools/oxlint/anti-slop";
|
|
11307
11261
|
const antiSlop = {
|
|
11308
|
-
templates: [plugin_package_json_default
|
|
11262
|
+
templates: [plugin_package_json_default],
|
|
11309
11263
|
staticFiles: [
|
|
11310
11264
|
{
|
|
11311
11265
|
src: "anti-slop/static/LICENSE",
|