create-authhero 0.21.0 → 0.22.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.
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { Command as b } from "commander";
2
+ import { Command as T } from "commander";
3
3
  import d from "inquirer";
4
4
  import s from "fs";
5
- import l from "path";
6
- import { spawn as x } from "child_process";
7
- const P = new b(), m = {
5
+ import i from "path";
6
+ import { spawn as D } from "child_process";
7
+ const I = new T(), m = {
8
8
  local: {
9
9
  name: "Local (SQLite)",
10
10
  description: "Local development setup with SQLite database - great for getting started",
@@ -85,10 +85,10 @@ const P = new b(), m = {
85
85
  seedFile: "seed.ts"
86
86
  }
87
87
  };
88
- function I(t, e) {
88
+ function x(t, e) {
89
89
  s.readdirSync(t).forEach((o) => {
90
- const n = l.join(t, o), a = l.join(e, o);
91
- s.lstatSync(n).isDirectory() ? (s.mkdirSync(a, { recursive: !0 }), I(n, a)) : s.copyFileSync(n, a);
90
+ const n = i.join(t, o), r = i.join(e, o);
91
+ s.lstatSync(n).isDirectory() ? (s.mkdirSync(r, { recursive: !0 }), x(n, r)) : s.copyFileSync(n, r);
92
92
  });
93
93
  }
94
94
  function E(t) {
@@ -128,77 +128,32 @@ async function main() {
128
128
  main().catch(console.error);
129
129
  `;
130
130
  }
131
- function _(t) {
131
+ function j(t) {
132
132
  return t ? `import { Context } from "hono";
133
- import { HTTPException } from "hono/http-exception";
134
133
  import { swaggerUI } from "@hono/swagger-ui";
135
- import { init, AuthHeroConfig, fetchAll } from "authhero";
134
+ import { AuthHeroConfig } from "authhero";
136
135
  import { serveStatic } from "@hono/node-server/serve-static";
137
- import {
138
- createSyncHooks,
139
- createTenantsOpenAPIRouter,
140
- createProtectSyncedMiddleware,
141
- } from "@authhero/multi-tenancy";
136
+ import { initMultiTenant } from "@authhero/multi-tenancy";
142
137
  import { DataAdapters } from "@authhero/adapter-interfaces";
143
138
 
144
139
  // Control plane tenant ID - the tenant that manages all other tenants
145
140
  const CONTROL_PLANE_TENANT_ID = "control_plane";
146
141
 
147
142
  export default function createApp(config: AuthHeroConfig & { dataAdapter: DataAdapters }) {
148
- // Create sync hooks for syncing entities from control plane to child tenants
149
- const { entityHooks, tenantHooks } = createSyncHooks({
150
- controlPlaneTenantId: CONTROL_PLANE_TENANT_ID,
151
- getChildTenantIds: async () => {
152
- const allTenants = await fetchAll<{ id: string }>(
153
- (params) => config.dataAdapter.tenants.list(params),
154
- "tenants",
155
- { cursorField: "id", pageSize: 100 },
156
- );
157
- return allTenants
158
- .filter((t) => t.id !== CONTROL_PLANE_TENANT_ID)
159
- .map((t) => t.id);
160
- },
161
- getAdapters: async () => config.dataAdapter,
162
- getControlPlaneAdapters: async () => config.dataAdapter,
163
- sync: {
164
- resourceServers: true,
165
- roles: true,
166
- connections: true,
167
- },
168
- });
169
-
170
- // Create tenants router
171
- const tenantsRouter = createTenantsOpenAPIRouter(
172
- {
173
- accessControl: {
174
- controlPlaneTenantId: CONTROL_PLANE_TENANT_ID,
175
- requireOrganizationMatch: false,
176
- defaultPermissions: ["tenant:admin"],
177
- },
178
- },
179
- { tenants: tenantHooks },
180
- );
181
-
182
- // Initialize AuthHero with sync hooks and tenant routes
183
- const { app } = init({
143
+ // Initialize multi-tenant AuthHero - syncs resource servers, roles, and connections by default
144
+ const { app } = initMultiTenant({
184
145
  ...config,
185
- entityHooks,
186
- managementApiExtensions: [
187
- ...(config.managementApiExtensions || []),
188
- { path: "/tenants", router: tenantsRouter },
189
- ],
146
+ controlPlaneTenantId: CONTROL_PLANE_TENANT_ID,
190
147
  });
191
148
 
192
- // Add middleware to protect synced entities from modification on child tenants
193
- app.use("/api/v2/*", createProtectSyncedMiddleware());
194
-
195
149
  app
196
150
  .onError((err, ctx) => {
197
- if (err instanceof HTTPException) {
198
- return err.getResponse();
151
+ // Use duck-typing to avoid instanceof issues with bundled dependencies
152
+ if (err && typeof err === "object" && "getResponse" in err) {
153
+ return (err as { getResponse: () => Response }).getResponse();
199
154
  }
200
155
  console.error(err);
201
- return ctx.text(err.message, 500);
156
+ return ctx.text(err instanceof Error ? err.message : "Internal Server Error", 500);
202
157
  })
203
158
  .get("/", async (ctx: Context) => {
204
159
  return ctx.json({
@@ -230,7 +185,6 @@ export default function createApp(config: AuthHeroConfig & { dataAdapter: DataAd
230
185
  return app;
231
186
  }
232
187
  ` : `import { Context } from "hono";
233
- import { HTTPException } from "hono/http-exception";
234
188
  import { AuthHeroConfig, init } from "authhero";
235
189
  import { swaggerUI } from "@hono/swagger-ui";
236
190
  import { serveStatic } from "@hono/node-server/serve-static";
@@ -240,11 +194,12 @@ export default function createApp(config: AuthHeroConfig) {
240
194
 
241
195
  app
242
196
  .onError((err, ctx) => {
243
- if (err instanceof HTTPException) {
244
- return err.getResponse();
197
+ // Use duck-typing to avoid instanceof issues with bundled dependencies
198
+ if (err && typeof err === "object" && "getResponse" in err) {
199
+ return (err as { getResponse: () => Response }).getResponse();
245
200
  }
246
201
  console.error(err);
247
- return ctx.text(err.message, 500);
202
+ return ctx.text(err instanceof Error ? err.message : "Internal Server Error", 500);
248
203
  })
249
204
  .get("/", async (ctx: Context) => {
250
205
  return ctx.json({
@@ -274,7 +229,7 @@ export default function createApp(config: AuthHeroConfig) {
274
229
  }
275
230
  `;
276
231
  }
277
- function H(t) {
232
+ function _(t) {
278
233
  return `import { D1Dialect } from "kysely-d1";
279
234
  import { Kysely } from "kysely";
280
235
  import createAdapters from "@authhero/kysely-adapter";
@@ -347,76 +302,31 @@ export default {
347
302
  };
348
303
  `;
349
304
  }
350
- function j(t) {
305
+ function R(t) {
351
306
  return t ? `import { Context } from "hono";
352
- import { HTTPException } from "hono/http-exception";
353
307
  import { swaggerUI } from "@hono/swagger-ui";
354
- import { init, AuthHeroConfig, fetchAll } from "authhero";
355
- import {
356
- createSyncHooks,
357
- createTenantsOpenAPIRouter,
358
- createProtectSyncedMiddleware,
359
- } from "@authhero/multi-tenancy";
308
+ import { AuthHeroConfig } from "authhero";
309
+ import { initMultiTenant } from "@authhero/multi-tenancy";
360
310
  import { DataAdapters } from "@authhero/adapter-interfaces";
361
311
 
362
312
  // Control plane tenant ID - the tenant that manages all other tenants
363
313
  const CONTROL_PLANE_TENANT_ID = "control_plane";
364
314
 
365
315
  export default function createApp(config: AuthHeroConfig & { dataAdapter: DataAdapters }) {
366
- // Create sync hooks for syncing entities from control plane to child tenants
367
- const { entityHooks, tenantHooks } = createSyncHooks({
368
- controlPlaneTenantId: CONTROL_PLANE_TENANT_ID,
369
- getChildTenantIds: async () => {
370
- const allTenants = await fetchAll<{ id: string }>(
371
- (params) => config.dataAdapter.tenants.list(params),
372
- "tenants",
373
- { cursorField: "id", pageSize: 100 },
374
- );
375
- return allTenants
376
- .filter((t) => t.id !== CONTROL_PLANE_TENANT_ID)
377
- .map((t) => t.id);
378
- },
379
- getAdapters: async () => config.dataAdapter,
380
- getControlPlaneAdapters: async () => config.dataAdapter,
381
- sync: {
382
- resourceServers: true,
383
- roles: true,
384
- connections: true,
385
- },
386
- });
387
-
388
- // Create tenants router
389
- const tenantsRouter = createTenantsOpenAPIRouter(
390
- {
391
- accessControl: {
392
- controlPlaneTenantId: CONTROL_PLANE_TENANT_ID,
393
- requireOrganizationMatch: false,
394
- defaultPermissions: ["tenant:admin"],
395
- },
396
- },
397
- { tenants: tenantHooks },
398
- );
399
-
400
- // Initialize AuthHero with sync hooks and tenant routes
401
- const { app } = init({
316
+ // Initialize multi-tenant AuthHero - syncs resource servers, roles, and connections by default
317
+ const { app } = initMultiTenant({
402
318
  ...config,
403
- entityHooks,
404
- managementApiExtensions: [
405
- ...(config.managementApiExtensions || []),
406
- { path: "/tenants", router: tenantsRouter },
407
- ],
319
+ controlPlaneTenantId: CONTROL_PLANE_TENANT_ID,
408
320
  });
409
321
 
410
- // Add middleware to protect synced entities from modification on child tenants
411
- app.use("/api/v2/*", createProtectSyncedMiddleware());
412
-
413
322
  app
414
323
  .onError((err, ctx) => {
415
- if (err instanceof HTTPException) {
416
- return err.getResponse();
324
+ // Use duck-typing to avoid instanceof issues with bundled dependencies
325
+ if (err && typeof err === "object" && "getResponse" in err) {
326
+ return (err as { getResponse: () => Response }).getResponse();
417
327
  }
418
328
  console.error(err);
419
- return ctx.text(err.message, 500);
329
+ return ctx.text(err instanceof Error ? err.message : "Internal Server Error", 500);
420
330
  })
421
331
  .get("/", async (ctx: Context) => {
422
332
  return ctx.json({
@@ -432,7 +342,6 @@ export default function createApp(config: AuthHeroConfig & { dataAdapter: DataAd
432
342
  return app;
433
343
  }
434
344
  ` : `import { Context } from "hono";
435
- import { HTTPException } from "hono/http-exception";
436
345
  import { cors } from "hono/cors";
437
346
  import { AuthHeroConfig, init } from "authhero";
438
347
  import { swaggerUI } from "@hono/swagger-ui";
@@ -451,11 +360,12 @@ export default function createApp(config: AuthHeroConfig) {
451
360
 
452
361
  app
453
362
  .onError((err, ctx) => {
454
- if (err instanceof HTTPException) {
455
- return err.getResponse();
363
+ // Use duck-typing to avoid instanceof issues with bundled dependencies
364
+ if (err && typeof err === "object" && "getResponse" in err) {
365
+ return (err as { getResponse: () => Response }).getResponse();
456
366
  }
457
367
  console.error(err);
458
- return ctx.text(err.message, 500);
368
+ return ctx.text(err instanceof Error ? err.message : "Internal Server Error", 500);
459
369
  })
460
370
  .get("/", async (ctx: Context) => {
461
371
  return ctx.json({
@@ -469,10 +379,10 @@ export default function createApp(config: AuthHeroConfig) {
469
379
  }
470
380
  `;
471
381
  }
472
- function R(t) {
473
- const e = l.join(t, ".github", "workflows");
382
+ function M(t) {
383
+ const e = i.join(t, ".github", "workflows");
474
384
  s.mkdirSync(e, { recursive: !0 });
475
- const r = `name: Unit tests
385
+ const a = `name: Unit tests
476
386
 
477
387
  on: push
478
388
 
@@ -558,9 +468,9 @@ jobs:
558
468
  apiToken: \${{ secrets.PROD_CLOUDFLARE_API_TOKEN }}
559
469
  command: deploy --env production
560
470
  `;
561
- s.writeFileSync(l.join(e, "unit-tests.yml"), r), s.writeFileSync(l.join(e, "deploy-dev.yml"), o), s.writeFileSync(l.join(e, "release.yml"), n), console.log("\\n📦 GitHub CI workflows created!");
471
+ s.writeFileSync(i.join(e, "unit-tests.yml"), a), s.writeFileSync(i.join(e, "deploy-dev.yml"), o), s.writeFileSync(i.join(e, "release.yml"), n), console.log("\\n📦 GitHub CI workflows created!");
562
472
  }
563
- function O(t) {
473
+ function $(t) {
564
474
  const e = {
565
475
  branches: ["main"],
566
476
  plugins: [
@@ -570,10 +480,10 @@ function O(t) {
570
480
  ]
571
481
  };
572
482
  s.writeFileSync(
573
- l.join(t, ".releaserc.json"),
483
+ i.join(t, ".releaserc.json"),
574
484
  JSON.stringify(e, null, 2)
575
485
  );
576
- const r = l.join(t, "package.json"), o = JSON.parse(s.readFileSync(r, "utf-8"));
486
+ const a = i.join(t, "package.json"), o = JSON.parse(s.readFileSync(a, "utf-8"));
577
487
  o.devDependencies = {
578
488
  ...o.devDependencies,
579
489
  "semantic-release": "^24.0.0"
@@ -581,41 +491,41 @@ function O(t) {
581
491
  ...o.scripts,
582
492
  test: 'echo "No tests yet"',
583
493
  "type-check": "tsc --noEmit"
584
- }, s.writeFileSync(r, JSON.stringify(o, null, 2));
494
+ }, s.writeFileSync(a, JSON.stringify(o, null, 2));
585
495
  }
586
496
  function v(t, e) {
587
- return new Promise((r, o) => {
588
- const n = x(t, [], {
497
+ return new Promise((a, o) => {
498
+ const n = D(t, [], {
589
499
  cwd: e,
590
500
  shell: !0,
591
501
  stdio: "inherit"
592
502
  });
593
- n.on("close", (a) => {
594
- a === 0 ? r() : o(new Error(`Command failed with exit code ${a}`));
503
+ n.on("close", (r) => {
504
+ r === 0 ? a() : o(new Error(`Command failed with exit code ${r}`));
595
505
  }), n.on("error", o);
596
506
  });
597
507
  }
598
- function T(t, e, r) {
508
+ function b(t, e, a) {
599
509
  return new Promise((o, n) => {
600
- const a = x(t, [], {
510
+ const r = D(t, [], {
601
511
  cwd: e,
602
512
  shell: !0,
603
513
  stdio: "inherit",
604
- env: { ...process.env, ...r }
514
+ env: { ...process.env, ...a }
605
515
  });
606
- a.on("close", (c) => {
516
+ r.on("close", (c) => {
607
517
  c === 0 ? o() : n(new Error(`Command failed with exit code ${c}`));
608
- }), a.on("error", n);
518
+ }), r.on("error", n);
609
519
  });
610
520
  }
611
- function M(t, e) {
612
- const r = l.join(t, "src");
521
+ function O(t, e) {
522
+ const a = i.join(t, "src");
613
523
  s.writeFileSync(
614
- l.join(r, "app.ts"),
615
- j(e)
524
+ i.join(a, "app.ts"),
525
+ R(e)
616
526
  ), s.writeFileSync(
617
- l.join(r, "seed.ts"),
618
- H(e)
527
+ i.join(a, "seed.ts"),
528
+ _(e)
619
529
  );
620
530
  }
621
531
  function k(t) {
@@ -628,16 +538,16 @@ function C(t) {
628
538
  ` + "─".repeat(50)), console.log("✅ Self-signed certificates generated with openssl"), console.log("⚠️ You may need to trust the certificate in your browser"), console.log("🔐 AuthHero server running at https://localhost:3000"), console.log("📚 API documentation available at https://localhost:3000/docs"), console.log("🌐 Portal available at https://local.authhero.net"), console.log(t ? "🏢 Multi-tenant mode enabled with control_plane tenant" : "🏠 Single-tenant mode with 'main' tenant"), console.log("─".repeat(50) + `
629
539
  `);
630
540
  }
631
- P.version("1.0.0").description("Create a new AuthHero project").argument("[project-name]", "name of the project").option("-t, --template <type>", "template type: local or cloudflare").option("-e, --email <email>", "admin email address").option("-p, --password <password>", "admin password (min 8 characters)").option(
541
+ I.version("1.0.0").description("Create a new AuthHero project").argument("[project-name]", "name of the project").option("-t, --template <type>", "template type: local or cloudflare").option("-e, --email <email>", "admin email address").option("-p, --password <password>", "admin password (min 8 characters)").option(
632
542
  "--package-manager <pm>",
633
543
  "package manager to use: npm, yarn, pnpm, or bun"
634
544
  ).option("--multi-tenant", "enable multi-tenant mode").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("--github-ci", "include GitHub CI workflows with semantic versioning").option("-y, --yes", "skip all prompts and use defaults/provided options").action(async (t, e) => {
635
- const r = e.yes === !0;
545
+ const a = e.yes === !0;
636
546
  console.log(`
637
547
  🔐 Welcome to AuthHero!
638
548
  `);
639
549
  let o = t;
640
- o || (r ? (o = "auth-server", console.log(`Using default project name: ${o}`)) : o = (await d.prompt([
550
+ o || (a ? (o = "auth-server", console.log(`Using default project name: ${o}`)) : o = (await d.prompt([
641
551
  {
642
552
  type: "input",
643
553
  name: "projectName",
@@ -646,10 +556,10 @@ P.version("1.0.0").description("Create a new AuthHero project").argument("[proje
646
556
  validate: (p) => p !== "" || "Project name cannot be empty"
647
557
  }
648
558
  ])).projectName);
649
- const n = l.join(process.cwd(), o);
559
+ const n = i.join(process.cwd(), o);
650
560
  s.existsSync(n) && (console.error(`❌ Project "${o}" already exists.`), process.exit(1));
651
- let a;
652
- e.template ? (["local", "cloudflare"].includes(e.template) || (console.error(`❌ Invalid template: ${e.template}`), console.error("Valid options: local, cloudflare"), process.exit(1)), a = e.template, console.log(`Using template: ${m[a].name}`)) : a = (await d.prompt([
561
+ let r;
562
+ e.template ? (["local", "cloudflare"].includes(e.template) || (console.error(`❌ Invalid template: ${e.template}`), console.error("Valid options: local, cloudflare"), process.exit(1)), r = e.template, console.log(`Using template: ${m[r].name}`)) : r = (await d.prompt([
653
563
  {
654
564
  type: "list",
655
565
  name: "setupType",
@@ -671,7 +581,7 @@ P.version("1.0.0").description("Create a new AuthHero project").argument("[proje
671
581
  }
672
582
  ])).setupType;
673
583
  let c;
674
- e.multiTenant !== void 0 ? (c = e.multiTenant, console.log(`Multi-tenant mode: ${c ? "enabled" : "disabled"}`)) : r ? c = !1 : c = (await d.prompt([
584
+ e.multiTenant !== void 0 ? (c = e.multiTenant, console.log(`Multi-tenant mode: ${c ? "enabled" : "disabled"}`)) : a ? c = !1 : c = (await d.prompt([
675
585
  {
676
586
  type: "confirm",
677
587
  name: "multiTenant",
@@ -680,45 +590,45 @@ P.version("1.0.0").description("Create a new AuthHero project").argument("[proje
680
590
  default: !1
681
591
  }
682
592
  ])).multiTenant;
683
- const A = m[a];
593
+ const S = m[r];
684
594
  s.mkdirSync(n, { recursive: !0 }), s.writeFileSync(
685
- l.join(n, "package.json"),
686
- JSON.stringify(A.packageJson(o, c), null, 2)
595
+ i.join(n, "package.json"),
596
+ JSON.stringify(S.packageJson(o, c), null, 2)
687
597
  );
688
- const D = A.templateDir, S = l.join(
598
+ const N = S.templateDir, A = i.join(
689
599
  import.meta.url.replace("file://", "").replace("/create-authhero.js", ""),
690
- D
600
+ N
691
601
  );
692
- if (s.existsSync(S) ? I(S, n) : (console.error(`❌ Template directory not found: ${S}`), process.exit(1)), a === "cloudflare" && M(n, c), a === "cloudflare") {
693
- const i = l.join(n, "wrangler.toml"), p = l.join(n, "wrangler.local.toml");
694
- s.existsSync(i) && s.copyFileSync(i, p);
695
- const u = l.join(n, ".dev.vars.example"), g = l.join(n, ".dev.vars");
602
+ if (s.existsSync(A) ? x(A, n) : (console.error(`❌ Template directory not found: ${A}`), process.exit(1)), r === "cloudflare" && O(n, c), r === "cloudflare") {
603
+ const l = i.join(n, "wrangler.toml"), p = i.join(n, "wrangler.local.toml");
604
+ s.existsSync(l) && s.copyFileSync(l, p);
605
+ const u = i.join(n, ".dev.vars.example"), g = i.join(n, ".dev.vars");
696
606
  s.existsSync(u) && s.copyFileSync(u, g), console.log(
697
607
  "📁 Created wrangler.local.toml and .dev.vars for local development"
698
608
  );
699
609
  }
700
610
  let w = !1;
701
- if (a === "cloudflare" && (e.githubCi !== void 0 ? (w = e.githubCi, w && console.log("Including GitHub CI workflows with semantic versioning")) : r || (w = (await d.prompt([
611
+ if (r === "cloudflare" && (e.githubCi !== void 0 ? (w = e.githubCi, w && console.log("Including GitHub CI workflows with semantic versioning")) : a || (w = (await d.prompt([
702
612
  {
703
613
  type: "confirm",
704
614
  name: "includeGithubCi",
705
615
  message: "Would you like to include GitHub CI with semantic versioning?",
706
616
  default: !1
707
617
  }
708
- ])).includeGithubCi), w && (R(n), O(n))), a === "local") {
709
- const i = E(c);
710
- s.writeFileSync(l.join(n, "src/seed.ts"), i);
711
- const p = _(c);
712
- s.writeFileSync(l.join(n, "src/app.ts"), p);
618
+ ])).includeGithubCi), w && (M(n), $(n))), r === "local") {
619
+ const l = E(c);
620
+ s.writeFileSync(i.join(n, "src/seed.ts"), l);
621
+ const p = j(c);
622
+ s.writeFileSync(i.join(n, "src/app.ts"), p);
713
623
  }
714
- const N = c ? "multi-tenant" : "single-tenant";
624
+ const P = c ? "multi-tenant" : "single-tenant";
715
625
  console.log(
716
626
  `
717
- ✅ Project "${o}" has been created with ${A.name} (${N}) setup!
627
+ ✅ Project "${o}" has been created with ${S.name} (${P}) setup!
718
628
  `
719
629
  );
720
630
  let f;
721
- if (e.skipInstall ? f = !1 : r ? f = !0 : f = (await d.prompt([
631
+ if (e.skipInstall ? f = !1 : a ? f = !0 : f = (await d.prompt([
722
632
  {
723
633
  type: "confirm",
724
634
  name: "shouldInstall",
@@ -726,10 +636,10 @@ P.version("1.0.0").description("Create a new AuthHero project").argument("[proje
726
636
  default: !0
727
637
  }
728
638
  ])).shouldInstall, f) {
729
- let i;
639
+ let l;
730
640
  e.packageManager ? (["npm", "yarn", "pnpm", "bun"].includes(e.packageManager) || (console.error(
731
641
  `❌ Invalid package manager: ${e.packageManager}`
732
- ), console.error("Valid options: npm, yarn, pnpm, bun"), process.exit(1)), i = e.packageManager) : r ? i = "pnpm" : i = (await d.prompt([
642
+ ), console.error("Valid options: npm, yarn, pnpm, bun"), process.exit(1)), l = e.packageManager) : a ? l = "pnpm" : l = (await d.prompt([
733
643
  {
734
644
  type: "list",
735
645
  name: "packageManager",
@@ -743,17 +653,17 @@ P.version("1.0.0").description("Create a new AuthHero project").argument("[proje
743
653
  default: "pnpm"
744
654
  }
745
655
  ])).packageManager, console.log(`
746
- 📦 Installing dependencies with ${i}...
656
+ 📦 Installing dependencies with ${l}...
747
657
  `);
748
658
  try {
749
- const p = i === "pnpm" ? "pnpm install --ignore-workspace" : `${i} install`;
750
- if (await v(p, n), a === "local" && (console.log(`
659
+ const p = l === "pnpm" ? "pnpm install --ignore-workspace" : `${l} install`;
660
+ if (await v(p, n), r === "local" && (console.log(`
751
661
  🔧 Building native modules...
752
662
  `), await v("npm rebuild better-sqlite3", n)), console.log(`
753
663
  ✅ Dependencies installed successfully!
754
- `), a === "local" || a === "cloudflare") {
664
+ `), r === "local" || r === "cloudflare") {
755
665
  let g;
756
- if (e.skipMigrate && e.skipSeed ? g = !1 : r ? g = !e.skipMigrate || !e.skipSeed : g = (await d.prompt([
666
+ if (e.skipMigrate && e.skipSeed ? g = !1 : a ? g = !e.skipMigrate || !e.skipSeed : g = (await d.prompt([
757
667
  {
758
668
  type: "confirm",
759
669
  name: "shouldSetup",
@@ -782,17 +692,17 @@ P.version("1.0.0").description("Create a new AuthHero project").argument("[proje
782
692
  }
783
693
  ]), e.skipMigrate || (console.log(`
784
694
  🔄 Running migrations...
785
- `), await v(`${i} run migrate`, n)), e.skipSeed || (console.log(`
695
+ `), await v(`${l} run migrate`, n)), e.skipSeed || (console.log(`
786
696
  🌱 Seeding database...
787
- `), a === "local" ? await T(
788
- `${i} run seed`,
697
+ `), r === "local" ? await b(
698
+ `${l} run seed`,
789
699
  n,
790
700
  {
791
701
  ADMIN_EMAIL: h.username,
792
702
  ADMIN_PASSWORD: h.password
793
703
  }
794
- ) : await T(
795
- `${i} run seed:local`,
704
+ ) : await b(
705
+ `${l} run seed:local`,
796
706
  n,
797
707
  {
798
708
  ADMIN_EMAIL: h.username,
@@ -802,25 +712,25 @@ P.version("1.0.0").description("Create a new AuthHero project").argument("[proje
802
712
  }
803
713
  }
804
714
  let u;
805
- e.skipStart || r ? u = !1 : u = (await d.prompt([
715
+ e.skipStart || a ? u = !1 : u = (await d.prompt([
806
716
  {
807
717
  type: "confirm",
808
718
  name: "shouldStart",
809
719
  message: "Would you like to start the development server?",
810
720
  default: !0
811
721
  }
812
- ])).shouldStart, u && (a === "cloudflare" ? k(c) : C(c), console.log(`🚀 Starting development server...
813
- `), await v(`${i} run dev`, n)), r && !u && (console.log(`
722
+ ])).shouldStart, u && (r === "cloudflare" ? k(c) : C(c), console.log(`🚀 Starting development server...
723
+ `), await v(`${l} run dev`, n)), a && !u && (console.log(`
814
724
  ✅ Setup complete!`), console.log(`
815
- To start the development server:`), console.log(` cd ${o}`), console.log(" npm run dev"), a === "cloudflare" ? k(c) : C(c));
725
+ To start the development server:`), console.log(` cd ${o}`), console.log(" npm run dev"), r === "cloudflare" ? k(c) : C(c));
816
726
  } catch (p) {
817
727
  console.error(`
818
728
  ❌ An error occurred:`, p), process.exit(1);
819
729
  }
820
730
  }
821
- f || (console.log("Next steps:"), console.log(` cd ${o}`), a === "local" ? (console.log(" npm install"), console.log(" npm run migrate"), console.log(
731
+ f || (console.log("Next steps:"), console.log(` cd ${o}`), r === "local" ? (console.log(" npm install"), console.log(" npm run migrate"), console.log(
822
732
  " ADMIN_EMAIL=admin@example.com ADMIN_PASSWORD=yourpassword npm run seed"
823
- ), console.log(" npm run dev")) : a === "cloudflare" && (console.log(" npm install"), console.log(
733
+ ), console.log(" npm run dev")) : r === "cloudflare" && (console.log(" npm install"), console.log(
824
734
  " npm run migrate # or npm run db:migrate:remote for production"
825
735
  ), console.log(
826
736
  " ADMIN_EMAIL=admin@example.com ADMIN_PASSWORD=yourpassword npm run seed"
@@ -829,4 +739,4 @@ Server will be available at: https://localhost:3000`), console.log("Portal avail
829
739
  For more information, visit: https://authhero.net/docs
830
740
  `));
831
741
  });
832
- P.parse(process.argv);
742
+ I.parse(process.argv);
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "type": "git",
6
6
  "url": "https://github.com/markusahlstrand/authhero"
7
7
  },
8
- "version": "0.21.0",
8
+ "version": "0.22.0",
9
9
  "type": "module",
10
10
  "main": "dist/create-authhero.js",
11
11
  "bin": {