create-newt-app 0.31.7 → 0.31.9

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
@@ -9,12 +9,9 @@ import { execa } from "execa";
9
9
  import ejs from "ejs";
10
10
  import { existsSync, promises } from "fs";
11
11
  import path from "path";
12
- import { homedir } from "node:os";
13
- import { promises as promises$1 } from "node:fs";
14
12
  import https from "node:https";
15
- import path$1 from "node:path";
16
13
  //#region package.json
17
- var version = "0.31.7";
14
+ var version = "0.31.9";
18
15
  var engines = { "node": ">=24.0.0" };
19
16
  //#endregion
20
17
  //#region src/templates/root/index.ts
@@ -39,10 +36,7 @@ const root$2 = { templates: [
39
36
  "turbo": "<%= versions.turbo %>",
40
37
  "typescript": "<%= versions.typescript %>"
41
38
  },
42
- "pnpm": {
43
- "onlyBuiltDependencies": ["better-sqlite3", "esbuild", "sharp", "unrs-resolver"]
44
- },
45
- "packageManager": "pnpm@10.34.5",
39
+ "packageManager": "pnpm@11.25.0",
46
40
  "engines": {
47
41
  "node": ">=24.0.0"
48
42
  }
@@ -99,7 +93,10 @@ dist
99
93
  *.log
100
94
  .env
101
95
  .env.*
102
- !.env.example`
96
+ !.env.example
97
+ dev.db*
98
+ .git
99
+ coverage`
103
100
  },
104
101
  {
105
102
  filename: ".npmrc",
@@ -154,7 +151,15 @@ dist
154
151
  filename: "pnpm-workspace.yaml",
155
152
  template: `packages:
156
153
  - "apps/*"
157
- - "packages/*"`
154
+ - "packages/*"
155
+
156
+ allowBuilds:
157
+ "@parcel/watcher": true
158
+ "@swc/core": true
159
+ better-sqlite3: true
160
+ esbuild: true
161
+ sharp: true
162
+ unrs-resolver: true`
158
163
  },
159
164
  {
160
165
  filename: "README.md",
@@ -180,8 +185,11 @@ Open [http://localhost:3000](http://localhost:3000).
180
185
  ## Packages
181
186
 
182
187
  - **\`@<%= projectName %>/auth\`**: better-auth config
188
+ - **\`@<%= projectName %>/db\`**: Kysely client and migrations
183
189
  - **\`@<%= projectName %>/ui\`**: shared React components
190
+ <% if (linter === 'eslint') { -%>
184
191
  - **\`@<%= projectName %>/eslint-config\`**: shared ESLint config
192
+ <% } -%>
185
193
  - **\`@<%= projectName %>/typescript-config\`**: shared tsconfig
186
194
  `
187
195
  },
@@ -453,7 +461,7 @@ export default function Home() {
453
461
  return (
454
462
  <main className="max-w-lg mx-auto min-h-full px-4 py-8 space-y-4">
455
463
  <div className="pb-4 border-b">
456
- <p className="font-mono text-sm text-muted-foreground">apps/web/page.tsx</p>
464
+ <p className="font-mono text-sm text-muted-foreground">apps/web/app/page.tsx</p>
457
465
  <p className="text-sm text-muted-foreground">Delete me to get started!</p>
458
466
  </div>
459
467
 
@@ -469,7 +477,7 @@ export default function Home() {
469
477
 
470
478
  <div className="rounded-xl border p-6 space-y-1">
471
479
  <p className="text-xs font-mono uppercase tracking-widest text-muted-foreground">next.js</p>
472
- <p className="font-mono text-sm text-muted-foreground">apps/web/layout.tsx</p>
480
+ <p className="font-mono text-sm text-muted-foreground">apps/web/app/layout.tsx</p>
473
481
  <p className="text-sm text-muted-foreground">Next.js rendering</p>
474
482
  </div>
475
483
 
@@ -733,34 +741,6 @@ export const authClient: ReturnType<typeof createAuthClient> = createAuthClient(
733
741
  {
734
742
  src: "web/static/public/web-app-manifest-512x512.png",
735
743
  filename: "apps/web/public/web-app-manifest-512x512.png"
736
- },
737
- {
738
- src: "web/static/public/file-text.svg",
739
- filename: "apps/web/public/file-text.svg"
740
- },
741
- {
742
- src: "web/static/public/globe.svg",
743
- filename: "apps/web/public/globe.svg"
744
- },
745
- {
746
- src: "web/static/public/next.svg",
747
- filename: "apps/web/public/next.svg"
748
- },
749
- {
750
- src: "web/static/public/turborepo-dark.svg",
751
- filename: "apps/web/public/turborepo-dark.svg"
752
- },
753
- {
754
- src: "web/static/public/turborepo-light.svg",
755
- filename: "apps/web/public/turborepo-light.svg"
756
- },
757
- {
758
- src: "web/static/public/vercel.svg",
759
- filename: "apps/web/public/vercel.svg"
760
- },
761
- {
762
- src: "web/static/public/window.svg",
763
- filename: "apps/web/public/window.svg"
764
744
  }
765
745
  ]
766
746
  };
@@ -1020,6 +1000,7 @@ export interface SessionTable {
1020
1000
 
1021
1001
  export interface AccountTable {
1022
1002
  id: string;
1003
+ issuer: string;
1023
1004
  accountId: string;
1024
1005
  providerId: string;
1025
1006
  userId: string;
@@ -1343,50 +1324,6 @@ export const Button = ({ children, onClick, type = "button", disabled, className
1343
1324
  </button>
1344
1325
  );
1345
1326
  };`
1346
- },
1347
- {
1348
- filename: "packages/ui/src/card.tsx",
1349
- template: `import { type JSX } from "react";
1350
-
1351
- export function Card({
1352
- className,
1353
- title,
1354
- children,
1355
- href,
1356
- }: {
1357
- className?: string;
1358
- title: string;
1359
- children: React.ReactNode;
1360
- href: string;
1361
- }): JSX.Element {
1362
- return (
1363
- <a
1364
- className={className}
1365
- href={\`\${href}?utm_source=create-turbo&utm_medium=basic&utm_campaign=create-turbo"\`}
1366
- rel="noopener noreferrer"
1367
- target="_blank"
1368
- >
1369
- <h2>
1370
- {title} <span>-&gt;</span>
1371
- </h2>
1372
- <p>{children}</p>
1373
- </a>
1374
- );
1375
- }`
1376
- },
1377
- {
1378
- filename: "packages/ui/src/code.tsx",
1379
- template: `import { type JSX } from "react";
1380
-
1381
- export function Code({
1382
- children,
1383
- className,
1384
- }: {
1385
- children: React.ReactNode;
1386
- className?: string;
1387
- }): JSX.Element {
1388
- return <code className={className}>{children}</code>;
1389
- }`
1390
1327
  },
1391
1328
  {
1392
1329
  filename: "packages/ui/src/link.tsx",
@@ -1524,7 +1461,7 @@ const versions = {
1524
1461
  "@nestjs/schematics": "^11.0.0",
1525
1462
  "@nestjs/serve-static": "^5.0.0",
1526
1463
  "@nestjs/testing": "^11.0.1",
1527
- "@next/eslint-plugin-next": "^16.3.3",
1464
+ "@next/eslint-plugin-next": "^16.3.4",
1528
1465
  "@oxlint/plugins": "^1.74.0",
1529
1466
  "@shadcn/react": "^0.2.1",
1530
1467
  "@swc/core": "^1.10.0",
@@ -1562,7 +1499,7 @@ const versions = {
1562
1499
  jest: "^30.0.0",
1563
1500
  kysely: "^0.28.2",
1564
1501
  "lucide-react": "^1.16.0",
1565
- next: "16.3.3",
1502
+ next: "16.3.4",
1566
1503
  "next-themes": "^0.4.6",
1567
1504
  oxfmt: "^0.59.0",
1568
1505
  oxlint: "^1.74.0",
@@ -1975,7 +1912,7 @@ export default function Home() {
1975
1912
  <main className="max-w-lg mx-auto min-h-full px-4 py-8 space-y-4">
1976
1913
  <div className="pb-4 border-b flex items-start justify-between">
1977
1914
  <div>
1978
- <p className="font-mono text-sm text-muted-foreground">apps/web/page.tsx</p>
1915
+ <p className="font-mono text-sm text-muted-foreground">apps/web/app/page.tsx</p>
1979
1916
  <p className="text-sm text-muted-foreground">Delete me to get started!</p>
1980
1917
  </div>
1981
1918
  <ModeToggle />
@@ -1998,7 +1935,7 @@ export default function Home() {
1998
1935
  </CardTitle>
1999
1936
  </CardHeader>
2000
1937
  <CardContent>
2001
- <p className="font-mono text-sm text-muted-foreground">apps/web/layout.tsx</p>
1938
+ <p className="font-mono text-sm text-muted-foreground">apps/web/app/layout.tsx</p>
2002
1939
  <p className="text-sm text-muted-foreground">Next.js rendering</p>
2003
1940
  </CardContent>
2004
1941
  </Card>
@@ -11425,9 +11362,8 @@ describe('AppController', () => {
11425
11362
  filename: "apps/api/src/app.module.ts",
11426
11363
  template: `<% if (deployment === 'spa') { %>import { join } from 'path';
11427
11364
  <% } %>import { Module } from '@nestjs/common';
11428
- import { APP_GUARD } from '@nestjs/core';
11429
11365
  <% if (deployment === 'spa') { %>import { ServeStaticModule } from '@nestjs/serve-static';
11430
- <% } %>import { AuthGuard, AuthModule } from '@thallesp/nestjs-better-auth';
11366
+ <% } %>import { AuthModule } from '@thallesp/nestjs-better-auth';
11431
11367
  import { auth } from '@<%= projectName %>/auth';
11432
11368
  import { AppController } from './app.controller';
11433
11369
  import { AppService } from './app.service';
@@ -11444,7 +11380,7 @@ import { AppService } from './app.service';
11444
11380
  <% } else { %> imports: [AuthModule.forRoot({ auth })],
11445
11381
  <% } -%>
11446
11382
  controllers: [AppController],
11447
- providers: [AppService, { provide: APP_GUARD, useClass: AuthGuard }],
11383
+ providers: [AppService],
11448
11384
  })
11449
11385
  export class AppModule {}`
11450
11386
  },
@@ -11621,6 +11557,7 @@ export interface SessionTable {
11621
11557
 
11622
11558
  export interface AccountTable {
11623
11559
  id: string;
11560
+ issuer: string;
11624
11561
  accountId: string;
11625
11562
  providerId: string;
11626
11563
  userId: string;
@@ -11738,9 +11675,8 @@ var app_module_controllers_default = {
11738
11675
  filename: "apps/api/src/app.module.ts",
11739
11676
  template: `<% if (deployment === 'spa') { %>import { join } from 'path';
11740
11677
  <% } %>import { Module } from '@nestjs/common';
11741
- import { APP_GUARD } from '@nestjs/core';
11742
11678
  <% if (deployment === 'spa') { %>import { ServeStaticModule } from '@nestjs/serve-static';
11743
- <% } %>import { AuthGuard, AuthModule } from '@thallesp/nestjs-better-auth';
11679
+ <% } %>import { AuthModule } from '@thallesp/nestjs-better-auth';
11744
11680
  import { auth } from '@<%= projectName %>/auth';
11745
11681
  import { AppController } from './app.controller';
11746
11682
  import { AppService } from './app.service';
@@ -11759,7 +11695,7 @@ import { TodosModule } from './todos/todos.module';
11759
11695
  <% } else { %> imports: [AuthModule.forRoot({ auth }), TodosModule],
11760
11696
  <% } -%>
11761
11697
  controllers: [AppController],
11762
- providers: [AppService, { provide: APP_GUARD, useClass: AuthGuard }],
11698
+ providers: [AppService],
11763
11699
  })
11764
11700
  export class AppModule {}`
11765
11701
  };
@@ -12019,7 +11955,7 @@ export default function Home() {
12019
11955
  return (
12020
11956
  <main className="max-w-lg mx-auto min-h-full px-4 py-8 space-y-4">
12021
11957
  <div className="pb-4 border-b">
12022
- <p className="font-mono text-sm text-muted-foreground">apps/web/page.tsx</p>
11958
+ <p className="font-mono text-sm text-muted-foreground">apps/web/app/page.tsx</p>
12023
11959
  <p className="text-sm text-muted-foreground">Delete me to get started!</p>
12024
11960
  </div>
12025
11961
 
@@ -12035,7 +11971,7 @@ export default function Home() {
12035
11971
 
12036
11972
  <div className="rounded-xl border p-6 space-y-1">
12037
11973
  <p className="text-xs font-mono uppercase tracking-widest text-muted-foreground">next.js</p>
12038
- <p className="font-mono text-sm text-muted-foreground">apps/web/layout.tsx</p>
11974
+ <p className="font-mono text-sm text-muted-foreground">apps/web/app/layout.tsx</p>
12039
11975
  <p className="text-sm text-muted-foreground">Next.js rendering</p>
12040
11976
  </div>
12041
11977
 
@@ -12254,7 +12190,7 @@ export default function Home() {
12254
12190
  <main className="max-w-lg mx-auto min-h-full px-4 py-8 space-y-4">
12255
12191
  <div className="pb-4 border-b flex items-start justify-between">
12256
12192
  <div>
12257
- <p className="font-mono text-sm text-muted-foreground">apps/web/page.tsx</p>
12193
+ <p className="font-mono text-sm text-muted-foreground">apps/web/app/page.tsx</p>
12258
12194
  <p className="text-sm text-muted-foreground">Delete me to get started!</p>
12259
12195
  </div>
12260
12196
  <ModeToggle />
@@ -12277,7 +12213,7 @@ export default function Home() {
12277
12213
  </CardTitle>
12278
12214
  </CardHeader>
12279
12215
  <CardContent>
12280
- <p className="font-mono text-sm text-muted-foreground">apps/web/layout.tsx</p>
12216
+ <p className="font-mono text-sm text-muted-foreground">apps/web/app/layout.tsx</p>
12281
12217
  <p className="text-sm text-muted-foreground">Next.js rendering</p>
12282
12218
  </CardContent>
12283
12219
  </Card>
@@ -12609,8 +12545,7 @@ async function initGit(cwd) {
12609
12545
  //#endregion
12610
12546
  //#region src/telemetry.ts
12611
12547
  const ENDPOINT = "https://newt-telemetry.newt-app.workers.dev";
12612
- const SEND_TIMEOUT_MS = 2e3;
12613
- const UNREACHABLE_BACKOFF_MS = 2592e6;
12548
+ const SEND_TIMEOUT_MS = 1e3;
12614
12549
  const CI_PROVIDERS = [
12615
12550
  ["GITHUB_ACTIONS", "github-actions"],
12616
12551
  ["GITLAB_CI", "gitlab-ci"],
@@ -12637,24 +12572,6 @@ function isOptedOut(env = process.env) {
12637
12572
  function isEnabled(env = process.env) {
12638
12573
  return Boolean(ENDPOINT) && !isOptedOut(env);
12639
12574
  }
12640
- function statePath() {
12641
- const base = process.env.XDG_STATE_HOME ?? path$1.join(homedir(), ".local", "state");
12642
- return path$1.join(base, "create-newt-app", "telemetry.json");
12643
- }
12644
- async function readState() {
12645
- try {
12646
- return JSON.parse(await promises$1.readFile(statePath(), "utf8"));
12647
- } catch {
12648
- return {};
12649
- }
12650
- }
12651
- async function writeState(next) {
12652
- try {
12653
- const file = statePath();
12654
- await promises$1.mkdir(path$1.dirname(file), { recursive: true });
12655
- await promises$1.writeFile(file, JSON.stringify(next), "utf8");
12656
- } catch {}
12657
- }
12658
12575
  function nodeMajor(version = process.version) {
12659
12576
  const match = /^v?(\d+)/.exec(version);
12660
12577
  return match ? `v${match[1]}` : "other";
@@ -12691,26 +12608,22 @@ function post(body) {
12691
12608
  });
12692
12609
  req.on("response", (res) => {
12693
12610
  res.resume();
12694
- const status = res.statusCode ?? 0;
12695
- res.on("end", () => resolve(status >= 200 && status < 300));
12611
+ res.on("end", () => resolve());
12696
12612
  });
12697
12613
  req.on("timeout", () => {
12698
12614
  req.destroy();
12699
- resolve(false);
12615
+ resolve();
12700
12616
  });
12701
- req.on("error", () => resolve(false));
12617
+ req.on("error", () => resolve());
12702
12618
  req.end(body);
12703
12619
  } catch {
12704
- resolve(false);
12620
+ resolve();
12705
12621
  }
12706
12622
  });
12707
12623
  }
12708
12624
  async function reportRun(report) {
12709
12625
  if (!isEnabled()) return;
12710
- const state = await readState();
12711
- if (state.unreachableUntil && state.unreachableUntil > Date.now()) return;
12712
- if (!await post(JSON.stringify(buildPayload(report)))) await writeState({ unreachableUntil: Date.now() + UNREACHABLE_BACKOFF_MS });
12713
- else if (state.unreachableUntil) await writeState({});
12626
+ await post(JSON.stringify(buildPayload(report)));
12714
12627
  }
12715
12628
  //#endregion
12716
12629
  //#region src/index.ts
@@ -12815,10 +12728,14 @@ async function doInit(options) {
12815
12728
  }
12816
12729
  };
12817
12730
  try {
12818
- const preflight = [validateNodeVersion(process.version, engines.node), await checkRequiredTools({
12819
- install: options.install,
12820
- git: options.git
12821
- }, hasCommand)].find((result) => !result.valid);
12731
+ const preflight = [
12732
+ validateNodeVersion(process.version, engines.node),
12733
+ ...options.name ? [validateProjectName(options.name)] : [],
12734
+ await checkRequiredTools({
12735
+ install: options.install,
12736
+ git: options.git
12737
+ }, hasCommand)
12738
+ ].find((result) => !result.valid);
12822
12739
  if (preflight) throw new Error(preflight.error);
12823
12740
  const answers = await p.group(groupOpts, { onCancel: () => {
12824
12741
  console.log("Exiting.");