@newt-app/templates 0.19.3 → 0.20.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 +22 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -41,6 +41,7 @@ node_modules
|
|
|
41
41
|
|
|
42
42
|
# Local env files
|
|
43
43
|
.env
|
|
44
|
+
dev.db*
|
|
44
45
|
.env.local
|
|
45
46
|
.env.development.local
|
|
46
47
|
.env.test.local
|
|
@@ -153,7 +154,7 @@ Full-stack monorepo: Next.js 16 + NestJS 11 + better-auth + PostgreSQL.
|
|
|
153
154
|
## Quick start
|
|
154
155
|
|
|
155
156
|
\`\`\`sh
|
|
156
|
-
|
|
157
|
+
# optional: set DATABASE_URL in .env for Postgres (defaults to local SQLite)
|
|
157
158
|
pnpm install
|
|
158
159
|
pnpm db:migrate
|
|
159
160
|
pnpm dev
|
|
@@ -178,7 +179,8 @@ Open [http://localhost:3000](http://localhost:3000).
|
|
|
178
179
|
// src/root/templates/env-example.ts
|
|
179
180
|
var env_example_default = {
|
|
180
181
|
filename: ".env",
|
|
181
|
-
template:
|
|
182
|
+
template: `# Uses a local SQLite file (dev.db) unless DATABASE_URL is set
|
|
183
|
+
# DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres
|
|
182
184
|
BETTER_AUTH_URL=http://localhost:3000
|
|
183
185
|
BETTER_AUTH_SECRET=your-secret-here`
|
|
184
186
|
};
|
|
@@ -995,16 +997,18 @@ var package_json_default4 = {
|
|
|
995
997
|
".": "./src/index.ts"
|
|
996
998
|
},
|
|
997
999
|
"scripts": {
|
|
998
|
-
"migrate": "dotenv -e
|
|
999
|
-
"generate": "dotenv -e
|
|
1000
|
+
"migrate": "dotenv -e ../../.env -- auth migrate -y --config src/index.ts",
|
|
1001
|
+
"generate": "dotenv -e ../../.env -- auth generate --config src/index.ts"
|
|
1000
1002
|
},
|
|
1001
1003
|
"dependencies": {
|
|
1002
1004
|
"auth": "^1.5.5",
|
|
1003
1005
|
"better-auth": "^1.2.8",
|
|
1006
|
+
"better-sqlite3": "^12.11.1",
|
|
1004
1007
|
"pg": "^8.14.1"
|
|
1005
1008
|
},
|
|
1006
1009
|
"devDependencies": {
|
|
1007
1010
|
"@<%= projectName %>/typescript-config": "workspace:*",
|
|
1011
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
1008
1012
|
"@types/pg": "^8.11.13",
|
|
1009
1013
|
"dotenv-cli": "^11.0.0",
|
|
1010
1014
|
"typescript": "6.0.2"
|
|
@@ -1017,11 +1021,15 @@ var src_index_default = {
|
|
|
1017
1021
|
filename: "packages/auth/src/index.ts",
|
|
1018
1022
|
template: `import { betterAuth } from "better-auth";
|
|
1019
1023
|
import { Pool } from "pg";
|
|
1024
|
+
import Database from "better-sqlite3";
|
|
1025
|
+
import path from "node:path";
|
|
1026
|
+
|
|
1027
|
+
const database = process.env.DATABASE_URL
|
|
1028
|
+
? new Pool({ connectionString: process.env.DATABASE_URL })
|
|
1029
|
+
: new Database(path.resolve(process.cwd(), "../../dev.db"));
|
|
1020
1030
|
|
|
1021
1031
|
export const auth = betterAuth({
|
|
1022
|
-
database
|
|
1023
|
-
connectionString: process.env.DATABASE_URL,
|
|
1024
|
-
}),
|
|
1032
|
+
database,
|
|
1025
1033
|
emailAndPassword: { enabled: true },
|
|
1026
1034
|
trustedOrigins: [process.env.BETTER_AUTH_URL ?? "http://localhost:3000"],
|
|
1027
1035
|
});
|
|
@@ -1703,6 +1711,7 @@ var layout_default2 = {
|
|
|
1703
1711
|
template: `import type { Metadata } from "next";
|
|
1704
1712
|
import localFont from "next/font/local";
|
|
1705
1713
|
import Providers from "@/app/providers";
|
|
1714
|
+
import { Toaster } from "@<%= projectName %>/ui/sonner";
|
|
1706
1715
|
import "@<%= projectName %>/ui/globals.css";
|
|
1707
1716
|
|
|
1708
1717
|
const geistSans = localFont({
|
|
@@ -1734,7 +1743,10 @@ export default function RootLayout({
|
|
|
1734
1743
|
return (
|
|
1735
1744
|
<html lang="en" suppressHydrationWarning>
|
|
1736
1745
|
<body className={\`\${geistSans.variable} \${geistMono.variable} h-full\`}>
|
|
1737
|
-
<Providers>
|
|
1746
|
+
<Providers>
|
|
1747
|
+
{children}
|
|
1748
|
+
<Toaster />
|
|
1749
|
+
</Providers>
|
|
1738
1750
|
</body>
|
|
1739
1751
|
</html>
|
|
1740
1752
|
);
|
|
@@ -9058,7 +9070,8 @@ var shadcnUi = {
|
|
|
9058
9070
|
components_json_default
|
|
9059
9071
|
],
|
|
9060
9072
|
packages: [
|
|
9061
|
-
{ package: "next-themes", module: "apps/web", version: "^0.4.6" }
|
|
9073
|
+
{ package: "next-themes", module: "apps/web", version: "^0.4.6" },
|
|
9074
|
+
{ package: "sonner", module: "apps/web", version: "^2.0.7" }
|
|
9062
9075
|
]
|
|
9063
9076
|
};
|
|
9064
9077
|
var shadcn_ui_default = shadcnUi;
|