create-authhero 0.7.0 → 0.9.0
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/cloudflare-multitenant/.dev.vars.example +20 -4
- package/dist/cloudflare-multitenant/README.md +238 -89
- package/dist/cloudflare-multitenant/drizzle.config.ts +8 -0
- package/dist/cloudflare-multitenant/migrations/0000_init.sql +782 -0
- package/dist/cloudflare-multitenant/migrations/meta/_journal.json +13 -0
- package/dist/cloudflare-multitenant/seed-helper.js +75 -0
- package/dist/cloudflare-multitenant/src/app.ts +3 -22
- package/dist/cloudflare-multitenant/src/db/schema.ts +845 -0
- package/dist/cloudflare-multitenant/src/index.ts +61 -55
- package/dist/cloudflare-multitenant/src/seed.ts +64 -0
- package/dist/cloudflare-multitenant/src/types.ts +17 -17
- package/dist/cloudflare-multitenant/wrangler.toml +40 -28
- package/dist/cloudflare-simple/.dev.vars.example +20 -0
- package/dist/cloudflare-simple/README.md +246 -10
- package/dist/cloudflare-simple/drizzle.config.ts +8 -0
- package/dist/cloudflare-simple/migrations/0000_init.sql +782 -0
- package/dist/cloudflare-simple/migrations/meta/0000_snapshot.json +5325 -0
- package/dist/cloudflare-simple/migrations/meta/_journal.json +13 -0
- package/dist/cloudflare-simple/seed-helper.js +75 -0
- package/dist/cloudflare-simple/src/app.ts +10 -0
- package/dist/cloudflare-simple/src/db/schema.ts +845 -0
- package/dist/cloudflare-simple/src/index.ts +64 -13
- package/dist/cloudflare-simple/src/seed.ts +64 -0
- package/dist/cloudflare-simple/src/types.ts +18 -0
- package/dist/cloudflare-simple/wrangler.toml +29 -0
- package/dist/create-authhero.js +199 -131
- package/package.json +1 -1
- package/dist/cloudflare-multitenant/src/database-factory.ts +0 -220
package/dist/create-authhero.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { Command as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { spawn as
|
|
7
|
-
const
|
|
2
|
+
import { Command as x } from "commander";
|
|
3
|
+
import c from "inquirer";
|
|
4
|
+
import i from "fs";
|
|
5
|
+
import f from "path";
|
|
6
|
+
import { spawn as b } from "child_process";
|
|
7
|
+
const D = new x(), n = {
|
|
8
8
|
local: {
|
|
9
9
|
name: "Local (SQLite)",
|
|
10
10
|
description: "Local development setup with SQLite database - great for getting started",
|
|
11
11
|
templateDir: "local",
|
|
12
|
-
packageJson: (
|
|
13
|
-
name:
|
|
12
|
+
packageJson: (r) => ({
|
|
13
|
+
name: r,
|
|
14
14
|
version: "1.0.0",
|
|
15
15
|
type: "module",
|
|
16
16
|
scripts: {
|
|
@@ -42,16 +42,22 @@ const w = new b(), r = {
|
|
|
42
42
|
name: "Cloudflare Simple (Single Tenant)",
|
|
43
43
|
description: "Single-tenant Cloudflare Workers setup with D1 database",
|
|
44
44
|
templateDir: "cloudflare-simple",
|
|
45
|
-
packageJson: (
|
|
46
|
-
name:
|
|
45
|
+
packageJson: (r) => ({
|
|
46
|
+
name: r,
|
|
47
47
|
version: "1.0.0",
|
|
48
48
|
type: "module",
|
|
49
49
|
scripts: {
|
|
50
|
-
dev: "wrangler dev",
|
|
50
|
+
"dev:local": "wrangler dev --port 3000 --local-protocol https",
|
|
51
|
+
"dev:remote": "wrangler dev --port 3000 --local-protocol https --remote",
|
|
52
|
+
dev: "wrangler dev --port 3000 --local-protocol https",
|
|
51
53
|
deploy: "wrangler deploy",
|
|
52
|
-
"db:migrate": "wrangler d1 migrations apply AUTH_DB --local",
|
|
53
|
-
"db:migrate:
|
|
54
|
-
|
|
54
|
+
"db:migrate:local": "wrangler d1 migrations apply AUTH_DB --local",
|
|
55
|
+
"db:migrate:remote": "wrangler d1 migrations apply AUTH_DB --remote",
|
|
56
|
+
migrate: "wrangler d1 migrations apply AUTH_DB --local",
|
|
57
|
+
"db:generate": "drizzle-kit generate",
|
|
58
|
+
"seed:local": "node seed-helper.js",
|
|
59
|
+
"seed:remote": "node seed-helper.js '' '' remote",
|
|
60
|
+
seed: "node seed-helper.js"
|
|
55
61
|
},
|
|
56
62
|
dependencies: {
|
|
57
63
|
"@authhero/kysely-adapter": "latest",
|
|
@@ -64,57 +70,63 @@ const w = new b(), r = {
|
|
|
64
70
|
},
|
|
65
71
|
devDependencies: {
|
|
66
72
|
"@cloudflare/workers-types": "^4.0.0",
|
|
73
|
+
"drizzle-kit": "^0.31.0",
|
|
74
|
+
"drizzle-orm": "^0.44.0",
|
|
67
75
|
typescript: "^5.5.0",
|
|
68
76
|
wrangler: "^3.0.0"
|
|
69
77
|
}
|
|
70
78
|
}),
|
|
71
|
-
seedFile: "seed.
|
|
79
|
+
seedFile: "seed.ts"
|
|
72
80
|
},
|
|
73
81
|
"cloudflare-multitenant": {
|
|
74
82
|
name: "Cloudflare Multi-Tenant (Production)",
|
|
75
|
-
description: "Production-grade multi-tenant setup with
|
|
83
|
+
description: "Production-grade multi-tenant setup with D1 database and tenant management",
|
|
76
84
|
templateDir: "cloudflare-multitenant",
|
|
77
|
-
packageJson: (
|
|
78
|
-
name:
|
|
85
|
+
packageJson: (r) => ({
|
|
86
|
+
name: r,
|
|
79
87
|
version: "1.0.0",
|
|
80
88
|
type: "module",
|
|
81
89
|
scripts: {
|
|
82
|
-
dev: "wrangler dev",
|
|
90
|
+
"dev:local": "wrangler dev --port 3000 --local-protocol https",
|
|
91
|
+
"dev:remote": "wrangler dev --port 3000 --local-protocol https --remote",
|
|
92
|
+
dev: "wrangler dev --port 3000 --local-protocol https",
|
|
83
93
|
deploy: "wrangler deploy",
|
|
84
|
-
"db:migrate": "wrangler d1 migrations apply
|
|
85
|
-
"db:migrate:
|
|
86
|
-
|
|
94
|
+
"db:migrate:local": "wrangler d1 migrations apply AUTH_DB --local",
|
|
95
|
+
"db:migrate:remote": "wrangler d1 migrations apply AUTH_DB --remote",
|
|
96
|
+
migrate: "wrangler d1 migrations apply AUTH_DB --local",
|
|
97
|
+
"db:generate": "drizzle-kit generate",
|
|
98
|
+
"seed:local": "node seed-helper.js",
|
|
99
|
+
"seed:remote": "node seed-helper.js '' '' remote",
|
|
100
|
+
seed: "node seed-helper.js"
|
|
87
101
|
},
|
|
88
102
|
dependencies: {
|
|
89
|
-
"@authhero/cloudflare-adapter": "latest",
|
|
90
103
|
"@authhero/kysely-adapter": "latest",
|
|
91
|
-
"@authhero/multi-tenancy": "latest",
|
|
92
104
|
"@hono/swagger-ui": "^0.5.0",
|
|
93
|
-
"@hono/zod-openapi": "^0.19.
|
|
105
|
+
"@hono/zod-openapi": "^0.19.0",
|
|
94
106
|
authhero: "latest",
|
|
95
107
|
hono: "^4.6.0",
|
|
96
108
|
kysely: "latest",
|
|
97
|
-
"kysely-d1": "latest"
|
|
98
|
-
wretch: "^3.0.0"
|
|
109
|
+
"kysely-d1": "latest"
|
|
99
110
|
},
|
|
100
111
|
devDependencies: {
|
|
101
112
|
"@cloudflare/workers-types": "^4.0.0",
|
|
113
|
+
"drizzle-kit": "^0.31.0",
|
|
114
|
+
"drizzle-orm": "^0.44.0",
|
|
102
115
|
typescript: "^5.5.0",
|
|
103
116
|
wrangler: "^3.0.0"
|
|
104
117
|
}
|
|
105
118
|
}),
|
|
106
|
-
seedFile: "seed.
|
|
119
|
+
seedFile: "seed.ts"
|
|
107
120
|
}
|
|
108
121
|
};
|
|
109
|
-
function
|
|
110
|
-
|
|
111
|
-
const
|
|
112
|
-
|
|
122
|
+
function A(r, a) {
|
|
123
|
+
i.readdirSync(r).forEach((o) => {
|
|
124
|
+
const t = f.join(r, o), e = f.join(a, o);
|
|
125
|
+
i.lstatSync(t).isDirectory() ? (i.mkdirSync(e, { recursive: !0 }), A(t, e)) : i.copyFileSync(t, e);
|
|
113
126
|
});
|
|
114
127
|
}
|
|
115
|
-
function
|
|
116
|
-
|
|
117
|
-
return `import { SqliteDialect, Kysely } from "kysely";
|
|
128
|
+
function $() {
|
|
129
|
+
return `import { SqliteDialect, Kysely } from "kysely";
|
|
118
130
|
import Database from "better-sqlite3";
|
|
119
131
|
import createAdapters from "@authhero/kysely-adapter";
|
|
120
132
|
import { seed } from "authhero";
|
|
@@ -146,61 +158,45 @@ async function main() {
|
|
|
146
158
|
|
|
147
159
|
main().catch(console.error);
|
|
148
160
|
`;
|
|
149
|
-
{
|
|
150
|
-
const e = (/* @__PURE__ */ new Date()).toISOString(), a = "default";
|
|
151
|
-
return `-- Seed file for AuthHero
|
|
152
|
-
--
|
|
153
|
-
-- IMPORTANT: This SQL file creates the basic structure but the password
|
|
154
|
-
-- cannot be properly hashed in SQL. After running this seed, you should
|
|
155
|
-
-- use the management API or run a script to set the admin password.
|
|
156
|
-
|
|
157
|
-
-- Create default tenant
|
|
158
|
-
INSERT OR IGNORE INTO tenants (id, friendly_name, audience, sender_email, sender_name, created_at, updated_at)
|
|
159
|
-
VALUES ('${a}', 'Default Tenant', 'https://api.example.com', 'noreply@example.com', 'AuthHero', '${e}', '${e}');
|
|
160
|
-
|
|
161
|
-
-- Create password connection
|
|
162
|
-
INSERT OR IGNORE INTO connections (id, tenant_id, name, strategy, options, created_at, updated_at)
|
|
163
|
-
VALUES ('conn_default', '${a}', 'Username-Password-Authentication', 'Username-Password-Authentication', '{}', '${e}', '${e}');
|
|
164
|
-
|
|
165
|
-
-- Create default client
|
|
166
|
-
INSERT OR IGNORE INTO clients (client_id, tenant_id, name, callbacks, allowed_origins, web_origins, connections, created_at, updated_at)
|
|
167
|
-
VALUES ('default', '${a}', 'Default Application', '["https://manage.authhero.net/auth-callback","https://local.authhero.net/auth-callback"]', '[]', '[]', '["Username-Password-Authentication"]', '${e}', '${e}');
|
|
168
|
-
|
|
169
|
-
-- Note: Admin user and password should be created via the management API
|
|
170
|
-
-- or using a TypeScript seed script with proper bcrypt hashing.
|
|
171
|
-
-- Example command: curl -X POST http://localhost:3000/api/v2/users ...
|
|
172
|
-
`;
|
|
173
|
-
}
|
|
174
161
|
}
|
|
175
|
-
function
|
|
176
|
-
return new Promise((
|
|
177
|
-
const
|
|
178
|
-
cwd:
|
|
162
|
+
function v(r, a) {
|
|
163
|
+
return new Promise((s, o) => {
|
|
164
|
+
const t = b(r, [], {
|
|
165
|
+
cwd: a,
|
|
179
166
|
shell: !0,
|
|
180
167
|
stdio: "inherit"
|
|
181
168
|
});
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}),
|
|
169
|
+
t.on("close", (e) => {
|
|
170
|
+
e === 0 ? s() : o(new Error(`Command failed with exit code ${e}`));
|
|
171
|
+
}), t.on("error", o);
|
|
185
172
|
});
|
|
186
173
|
}
|
|
187
|
-
function
|
|
188
|
-
return new Promise((
|
|
189
|
-
const
|
|
190
|
-
cwd:
|
|
174
|
+
function S(r, a, s) {
|
|
175
|
+
return new Promise((o, t) => {
|
|
176
|
+
const e = b(r, [], {
|
|
177
|
+
cwd: a,
|
|
191
178
|
shell: !0,
|
|
192
179
|
stdio: "inherit",
|
|
193
|
-
env: { ...process.env, ...
|
|
180
|
+
env: { ...process.env, ...s }
|
|
194
181
|
});
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}),
|
|
182
|
+
e.on("close", (g) => {
|
|
183
|
+
g === 0 ? o() : t(new Error(`Command failed with exit code ${g}`));
|
|
184
|
+
}), e.on("error", t);
|
|
198
185
|
});
|
|
199
186
|
}
|
|
200
|
-
|
|
187
|
+
D.version("1.0.0").description("Create a new AuthHero project").argument("[project-name]", "name of the project").option(
|
|
188
|
+
"-t, --template <type>",
|
|
189
|
+
"template type: local, cloudflare-simple, or cloudflare-multitenant"
|
|
190
|
+
).option("-e, --email <email>", "admin email address").option("-p, --password <password>", "admin password (min 8 characters)").option(
|
|
191
|
+
"--package-manager <pm>",
|
|
192
|
+
"package manager to use: npm, yarn, pnpm, or bun"
|
|
193
|
+
).option("--skip-install", "skip installing dependencies").option("--skip-migrate", "skip running database migrations").option("--skip-seed", "skip seeding the database").option("--skip-start", "skip starting the development server").option("--remote", "use remote mode for cloudflare-simple (production D1)").option("-y, --yes", "skip all prompts and use defaults/provided options").action(async (r, a) => {
|
|
194
|
+
const s = a.yes === !0;
|
|
201
195
|
console.log(`
|
|
202
196
|
🔐 Welcome to AuthHero!
|
|
203
|
-
`)
|
|
197
|
+
`);
|
|
198
|
+
let o = r;
|
|
199
|
+
o || (s ? (o = "auth-server", console.log(`Using default project name: ${o}`)) : o = (await c.prompt([
|
|
204
200
|
{
|
|
205
201
|
type: "input",
|
|
206
202
|
name: "projectName",
|
|
@@ -209,60 +205,71 @@ w.version("1.0.0").description("Create a new AuthHero project").argument("[proje
|
|
|
209
205
|
validate: (p) => p !== "" || "Project name cannot be empty"
|
|
210
206
|
}
|
|
211
207
|
])).projectName);
|
|
212
|
-
const
|
|
213
|
-
|
|
214
|
-
|
|
208
|
+
const t = f.join(process.cwd(), o);
|
|
209
|
+
i.existsSync(t) && (console.error(`❌ Project "${o}" already exists.`), process.exit(1));
|
|
210
|
+
let e;
|
|
211
|
+
a.template ? (["local", "cloudflare-simple", "cloudflare-multitenant"].includes(
|
|
212
|
+
a.template
|
|
213
|
+
) || (console.error(`❌ Invalid template: ${a.template}`), console.error(
|
|
214
|
+
"Valid options: local, cloudflare-simple, cloudflare-multitenant"
|
|
215
|
+
), process.exit(1)), e = a.template, console.log(`Using template: ${n[e].name}`)) : e = (await c.prompt([
|
|
215
216
|
{
|
|
216
217
|
type: "list",
|
|
217
218
|
name: "setupType",
|
|
218
219
|
message: "Select your setup type:",
|
|
219
220
|
choices: [
|
|
220
221
|
{
|
|
221
|
-
name: `${
|
|
222
|
-
${
|
|
222
|
+
name: `${n.local.name}
|
|
223
|
+
${n.local.description}`,
|
|
223
224
|
value: "local",
|
|
224
|
-
short:
|
|
225
|
+
short: n.local.name
|
|
225
226
|
},
|
|
226
227
|
{
|
|
227
|
-
name: `${
|
|
228
|
-
${
|
|
228
|
+
name: `${n["cloudflare-simple"].name}
|
|
229
|
+
${n["cloudflare-simple"].description}`,
|
|
229
230
|
value: "cloudflare-simple",
|
|
230
|
-
short:
|
|
231
|
+
short: n["cloudflare-simple"].name
|
|
231
232
|
},
|
|
232
233
|
{
|
|
233
|
-
name: `${
|
|
234
|
-
${
|
|
234
|
+
name: `${n["cloudflare-multitenant"].name}
|
|
235
|
+
${n["cloudflare-multitenant"].description}`,
|
|
235
236
|
value: "cloudflare-multitenant",
|
|
236
|
-
short:
|
|
237
|
+
short: n["cloudflare-multitenant"].name
|
|
237
238
|
}
|
|
238
239
|
]
|
|
239
240
|
}
|
|
240
|
-
])
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
241
|
+
])).setupType;
|
|
242
|
+
const g = n[e];
|
|
243
|
+
i.mkdirSync(t, { recursive: !0 }), i.writeFileSync(
|
|
244
|
+
f.join(t, "package.json"),
|
|
245
|
+
JSON.stringify(g.packageJson(o), null, 2)
|
|
244
246
|
);
|
|
245
|
-
const
|
|
247
|
+
const k = f.join(
|
|
246
248
|
import.meta.url.replace("file://", "").replace("/create-authhero.js", ""),
|
|
247
|
-
|
|
249
|
+
g.templateDir
|
|
248
250
|
);
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
251
|
+
if (i.existsSync(k) ? A(k, t) : (console.error(`❌ Template directory not found: ${k}`), process.exit(1)), e === "local") {
|
|
252
|
+
const l = $();
|
|
253
|
+
i.writeFileSync(f.join(t, "src/seed.ts"), l);
|
|
254
|
+
}
|
|
255
|
+
console.log(
|
|
252
256
|
`
|
|
253
|
-
✅ Project "${
|
|
257
|
+
✅ Project "${o}" has been created with ${g.name} setup!
|
|
254
258
|
`
|
|
255
259
|
);
|
|
256
|
-
|
|
260
|
+
let h;
|
|
261
|
+
if (a.skipInstall ? h = !1 : s ? h = !0 : h = (await c.prompt([
|
|
257
262
|
{
|
|
258
263
|
type: "confirm",
|
|
259
264
|
name: "shouldInstall",
|
|
260
265
|
message: "Would you like to install dependencies now?",
|
|
261
266
|
default: !0
|
|
262
267
|
}
|
|
263
|
-
])
|
|
264
|
-
|
|
265
|
-
|
|
268
|
+
])).shouldInstall, h) {
|
|
269
|
+
let l;
|
|
270
|
+
a.packageManager ? (["npm", "yarn", "pnpm", "bun"].includes(a.packageManager) || (console.error(
|
|
271
|
+
`❌ Invalid package manager: ${a.packageManager}`
|
|
272
|
+
), console.error("Valid options: npm, yarn, pnpm, bun"), process.exit(1)), l = a.packageManager) : s ? l = "npm" : l = (await c.prompt([
|
|
266
273
|
{
|
|
267
274
|
type: "list",
|
|
268
275
|
name: "packageManager",
|
|
@@ -275,70 +282,131 @@ w.version("1.0.0").description("Create a new AuthHero project").argument("[proje
|
|
|
275
282
|
],
|
|
276
283
|
default: "npm"
|
|
277
284
|
}
|
|
278
|
-
])
|
|
279
|
-
|
|
280
|
-
📦 Installing dependencies with ${i}...
|
|
285
|
+
])).packageManager, console.log(`
|
|
286
|
+
📦 Installing dependencies with ${l}...
|
|
281
287
|
`);
|
|
282
288
|
try {
|
|
283
|
-
const p =
|
|
284
|
-
|
|
289
|
+
const p = l === "pnpm" ? "pnpm install --ignore-workspace" : `${l} install`;
|
|
290
|
+
await v(p, t), e === "local" && (console.log(`
|
|
285
291
|
🔧 Building native modules...
|
|
286
|
-
`), await
|
|
292
|
+
`), await v("npm rebuild better-sqlite3", t)), console.log(`
|
|
287
293
|
✅ Dependencies installed successfully!
|
|
288
|
-
`)
|
|
289
|
-
|
|
294
|
+
`);
|
|
295
|
+
let w = a.remote ? "remote" : "local";
|
|
296
|
+
if (e === "local" || e === "cloudflare-simple" || e === "cloudflare-multitenant") {
|
|
297
|
+
(e === "cloudflare-simple" || e === "cloudflare-multitenant") && !s && !a.remote && (w = (await c.prompt([
|
|
298
|
+
{
|
|
299
|
+
type: "list",
|
|
300
|
+
name: "mode",
|
|
301
|
+
message: "Would you like to run in local mode or remote mode?",
|
|
302
|
+
choices: [
|
|
303
|
+
{
|
|
304
|
+
name: "Local (using local D1 database)",
|
|
305
|
+
value: "local",
|
|
306
|
+
short: "Local"
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
name: "Remote (using production D1 database)",
|
|
310
|
+
value: "remote",
|
|
311
|
+
short: "Remote"
|
|
312
|
+
}
|
|
313
|
+
],
|
|
314
|
+
default: "local"
|
|
315
|
+
}
|
|
316
|
+
])).mode);
|
|
317
|
+
let u;
|
|
318
|
+
if (a.skipMigrate && a.skipSeed ? u = !1 : s ? u = !a.skipMigrate || !a.skipSeed : u = (await c.prompt([
|
|
290
319
|
{
|
|
291
320
|
type: "confirm",
|
|
292
321
|
name: "shouldSetup",
|
|
293
322
|
message: "Would you like to run migrations and seed the database?",
|
|
294
323
|
default: !0
|
|
295
324
|
}
|
|
296
|
-
])
|
|
297
|
-
|
|
298
|
-
|
|
325
|
+
])).shouldSetup, u) {
|
|
326
|
+
let d;
|
|
327
|
+
if (a.email && a.password ? (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(a.email) || (console.error("❌ Invalid email address provided"), process.exit(1)), a.password.length < 8 && (console.error("❌ Password must be at least 8 characters"), process.exit(1)), d = {
|
|
328
|
+
username: a.email,
|
|
329
|
+
password: a.password
|
|
330
|
+
}, console.log(`Using admin email: ${a.email}`)) : d = await c.prompt([
|
|
299
331
|
{
|
|
300
332
|
type: "input",
|
|
301
333
|
name: "username",
|
|
302
334
|
message: "Admin email:",
|
|
303
335
|
default: "admin@example.com",
|
|
304
|
-
validate: (
|
|
336
|
+
validate: (m) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(m) || "Please enter a valid email address"
|
|
305
337
|
},
|
|
306
338
|
{
|
|
307
339
|
type: "password",
|
|
308
340
|
name: "password",
|
|
309
341
|
message: "Admin password:",
|
|
310
342
|
mask: "*",
|
|
311
|
-
validate: (
|
|
343
|
+
validate: (m) => m.length < 8 ? "Password must be at least 8 characters" : !0
|
|
312
344
|
}
|
|
313
|
-
])
|
|
314
|
-
|
|
345
|
+
]), !a.skipMigrate) {
|
|
346
|
+
console.log(`
|
|
315
347
|
🔄 Running migrations...
|
|
316
|
-
`)
|
|
348
|
+
`);
|
|
349
|
+
const m = (e === "cloudflare-simple" || e === "cloudflare-multitenant") && w === "remote" ? `${l} run db:migrate:remote` : `${l} run migrate`;
|
|
350
|
+
await v(m, t);
|
|
351
|
+
}
|
|
352
|
+
if (!a.skipSeed)
|
|
353
|
+
if (console.log(`
|
|
317
354
|
🌱 Seeding database...
|
|
318
|
-
`),
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
355
|
+
`), e === "local")
|
|
356
|
+
await S(
|
|
357
|
+
`${l} run seed`,
|
|
358
|
+
t,
|
|
359
|
+
{
|
|
360
|
+
ADMIN_EMAIL: d.username,
|
|
361
|
+
ADMIN_PASSWORD: d.password
|
|
362
|
+
}
|
|
363
|
+
);
|
|
364
|
+
else {
|
|
365
|
+
const m = w === "remote" ? `${l} run seed:remote` : `${l} run seed:local`;
|
|
366
|
+
await S(m, t, {
|
|
367
|
+
ADMIN_EMAIL: d.username,
|
|
368
|
+
ADMIN_PASSWORD: d.password
|
|
369
|
+
});
|
|
370
|
+
}
|
|
322
371
|
}
|
|
323
372
|
}
|
|
324
|
-
|
|
373
|
+
let y;
|
|
374
|
+
if (a.skipStart || s ? y = !1 : y = (await c.prompt([
|
|
325
375
|
{
|
|
326
376
|
type: "confirm",
|
|
327
377
|
name: "shouldStart",
|
|
328
378
|
message: "Would you like to start the development server?",
|
|
329
379
|
default: !0
|
|
330
380
|
}
|
|
331
|
-
])
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
381
|
+
])).shouldStart, y) {
|
|
382
|
+
console.log(
|
|
383
|
+
`
|
|
384
|
+
🚀 Starting development server on https://localhost:3000 ...
|
|
385
|
+
`
|
|
386
|
+
);
|
|
387
|
+
const u = (e === "cloudflare-simple" || e === "cloudflare-multitenant") && w === "remote" ? `${l} run dev:remote` : `${l} run dev`;
|
|
388
|
+
await v(u, t);
|
|
389
|
+
}
|
|
390
|
+
s && !y && (console.log(`
|
|
391
|
+
✅ Setup complete!`), console.log(`
|
|
392
|
+
To start the development server:`), console.log(` cd ${o}`), console.log((e === "cloudflare-simple" || e === "cloudflare-multitenant") && w === "remote" ? " npm run dev:remote" : " npm run dev"), (e === "cloudflare-simple" || e === "cloudflare-multitenant") && console.log(
|
|
393
|
+
`
|
|
394
|
+
Server will be available at: https://localhost:3000`
|
|
395
|
+
));
|
|
335
396
|
} catch (p) {
|
|
336
397
|
console.error(`
|
|
337
|
-
❌ An error occurred:`, p);
|
|
398
|
+
❌ An error occurred:`, p), process.exit(1);
|
|
338
399
|
}
|
|
339
400
|
}
|
|
340
|
-
h || (console.log("Next steps:"), console.log(` cd ${
|
|
401
|
+
h || (console.log("Next steps:"), console.log(` cd ${o}`), e === "local" ? (console.log(" npm install"), console.log(" npm run migrate"), console.log(
|
|
402
|
+
" ADMIN_EMAIL=admin@example.com ADMIN_PASSWORD=yourpassword npm run seed"
|
|
403
|
+
), console.log(" npm run dev")) : (e === "cloudflare-simple" || e === "cloudflare-multitenant") && (console.log(" npm install"), console.log(
|
|
404
|
+
" npm run migrate # or npm run db:migrate:remote for production"
|
|
405
|
+
), console.log(
|
|
406
|
+
" ADMIN_EMAIL=admin@example.com ADMIN_PASSWORD=yourpassword npm run seed"
|
|
407
|
+
), console.log(" npm run dev # or npm run dev:remote for production"), console.log(`
|
|
408
|
+
Server will be available at: https://localhost:3000`)), console.log(`
|
|
341
409
|
For more information, visit: https://authhero.net/docs
|
|
342
410
|
`));
|
|
343
411
|
});
|
|
344
|
-
|
|
412
|
+
D.parse(process.argv);
|