create-authhero 0.35.0 → 0.37.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.
@@ -103,11 +103,15 @@ try {
103
103
  // Inject runtime config into index.html
104
104
  // Uses window.location.origin so the admin UI automatically points to its own server
105
105
  const adminIndexPath = path.join(adminSourceDir, "index.html");
106
- const adminHtml = fs.readFileSync(adminIndexPath, "utf-8")
106
+ const adminHtml = fs
107
+ .readFileSync(adminIndexPath, "utf-8")
107
108
  .replace(/src="\.\/assets\//g, 'src="/admin/assets/')
108
109
  .replace(/href="\.\/assets\//g, 'href="/admin/assets/');
109
- const configScript = `<script>window.__AUTHHERO_ADMIN_CONFIG__={domain:window.location.origin,basePath:"/admin"}</script>`;
110
- const injectedHtml = adminHtml.replace("</head>", configScript + "\n</head>");
110
+ const configScript = `<script>window.__AUTHHERO_ADMIN_CONFIG__={domain:window.location.origin,clientId:"default",basePath:"/admin"}</script>`;
111
+ const injectedHtml = adminHtml.replace(
112
+ "</head>",
113
+ configScript + "\n</head>",
114
+ );
111
115
 
112
116
  // Write injected HTML to CDN assets (for direct /admin/ access)
113
117
  fs.writeFileSync(path.join(adminTargetDir, "index.html"), injectedHtml);
@@ -9,10 +9,10 @@ const D = new P(), p = {
9
9
  name: "Local (SQLite)",
10
10
  description: "Local development setup with SQLite database - great for getting started",
11
11
  templateDir: "local",
12
- packageJson: (n, e, r, a, o) => {
13
- const t = a ? "workspace:*" : "latest";
12
+ packageJson: (a, e, n, r, o) => {
13
+ const t = r ? "workspace:*" : "latest";
14
14
  return {
15
- name: n,
15
+ name: a,
16
16
  version: "1.0.0",
17
17
  type: "module",
18
18
  scripts: {
@@ -33,7 +33,7 @@ const D = new P(), p = {
33
33
  hono: "^4.6.0",
34
34
  kysely: "latest",
35
35
  ...e && { "@authhero/multi-tenancy": t },
36
- ...r && { bcryptjs: "latest" }
36
+ ...n && { bcryptjs: "latest" }
37
37
  },
38
38
  devDependencies: {
39
39
  "@types/better-sqlite3": "^7.6.0",
@@ -49,10 +49,10 @@ const D = new P(), p = {
49
49
  name: "Cloudflare Workers (D1)",
50
50
  description: "Cloudflare Workers setup with D1 database",
51
51
  templateDir: "cloudflare",
52
- packageJson: (n, e, r, a, o) => {
53
- const t = a ? "workspace:*" : "latest";
52
+ packageJson: (a, e, n, r, o) => {
53
+ const t = r ? "workspace:*" : "latest";
54
54
  return {
55
- name: n,
55
+ name: a,
56
56
  version: "1.0.0",
57
57
  type: "module",
58
58
  scripts: {
@@ -81,7 +81,7 @@ const D = new P(), p = {
81
81
  kysely: "latest",
82
82
  "kysely-d1": "latest",
83
83
  ...e && { "@authhero/multi-tenancy": t },
84
- ...r && { bcryptjs: "latest" }
84
+ ...n && { bcryptjs: "latest" }
85
85
  },
86
86
  devDependencies: {
87
87
  "@cloudflare/workers-types": "^4.0.0",
@@ -98,10 +98,10 @@ const D = new P(), p = {
98
98
  name: "AWS SST (Lambda + DynamoDB)",
99
99
  description: "Serverless AWS deployment with Lambda, DynamoDB, and SST",
100
100
  templateDir: "aws-sst",
101
- packageJson: (n, e, r, a, o) => {
102
- const t = a ? "workspace:*" : "latest";
101
+ packageJson: (a, e, n, r, o) => {
102
+ const t = r ? "workspace:*" : "latest";
103
103
  return {
104
- name: n,
104
+ name: a,
105
105
  version: "1.0.0",
106
106
  type: "module",
107
107
  scripts: {
@@ -122,7 +122,7 @@ const D = new P(), p = {
122
122
  authhero: t,
123
123
  hono: "^4.6.0",
124
124
  ...e && { "@authhero/multi-tenancy": t },
125
- ...r && { bcryptjs: "latest" }
125
+ ...n && { bcryptjs: "latest" }
126
126
  },
127
127
  devDependencies: {
128
128
  "@types/aws-lambda": "^8.10.0",
@@ -136,22 +136,22 @@ const D = new P(), p = {
136
136
  seedFile: "seed.ts"
137
137
  }
138
138
  };
139
- function N(n, e) {
140
- s.readdirSync(n).forEach((a) => {
141
- const o = i.join(n, a), t = i.join(e, a);
139
+ function N(a, e) {
140
+ s.readdirSync(a).forEach((r) => {
141
+ const o = i.join(a, r), t = i.join(e, r);
142
142
  s.lstatSync(o).isDirectory() ? (s.mkdirSync(t, { recursive: !0 }), N(o, t)) : s.copyFileSync(o, t);
143
143
  });
144
144
  }
145
- function R(n, e = !1, r = "authhero-local", a) {
146
- const o = n ? "control_plane" : "main", t = n ? "Control Plane" : "Main", c = [
145
+ function R(a, e = !1, n = "authhero-local", r) {
146
+ const o = a ? "control_plane" : "main", t = a ? "Control Plane" : "Main", c = [
147
147
  "https://manage.authhero.net/auth-callback",
148
148
  "https://local.authhero.net/auth-callback",
149
149
  "http://localhost:5173/auth-callback",
150
150
  "https://localhost:3000/auth-callback",
151
- ...a ? ["https://localhost:3000/admin/auth-callback"] : []
151
+ ...r ? ["https://localhost:3000/admin/auth-callback"] : []
152
152
  ], d = e ? [
153
- `https://localhost.emobix.co.uk:8443/test/a/${r}/callback`,
154
- `https://localhost:8443/test/a/${r}/callback`
153
+ `https://localhost.emobix.co.uk:8443/test/a/${n}/callback`,
154
+ `https://localhost:8443/test/a/${n}/callback`
155
155
  ] : [], f = [...c, ...d], h = [
156
156
  "https://manage.authhero.net",
157
157
  "https://local.authhero.net",
@@ -162,8 +162,8 @@ function R(n, e = !1, r = "authhero-local", a) {
162
162
  console.log("Creating conformance test clients and user...");
163
163
 
164
164
  const conformanceCallbacks = [
165
- "https://localhost.emobix.co.uk:8443/test/a/${r}/callback",
166
- "https://localhost:8443/test/a/${r}/callback",
165
+ "https://localhost.emobix.co.uk:8443/test/a/${n}/callback",
166
+ "https://localhost:8443/test/a/${n}/callback",
167
167
  ];
168
168
  const conformanceLogoutUrls = [
169
169
  "https://localhost:8443/",
@@ -282,8 +282,8 @@ async function main() {
282
282
  adminPassword,
283
283
  tenantId: "${o}",
284
284
  tenantName: "${t}",
285
- isControlPlane: ${!!n},${n ? `
286
- clientId: "default_client",` : ""}
285
+ isControlPlane: ${!!a},
286
+ clientId: "default"
287
287
  callbacks: ${JSON.stringify(f)},
288
288
  allowedLogoutUrls: ${JSON.stringify(y)},
289
289
  });
@@ -294,9 +294,9 @@ ${S}
294
294
  main().catch(console.error);
295
295
  `;
296
296
  }
297
- function U(n, e) {
298
- const r = e ? `import fs from "fs";
299
- ` : "", a = e ? `
297
+ function U(a, e) {
298
+ const n = e ? `import fs from "fs";
299
+ ` : "", r = e ? `
300
300
  const adminDistPath = path.resolve(
301
301
  __dirname,
302
302
  "../node_modules/@authhero/react-admin/dist",
@@ -311,8 +311,8 @@ const adminIndexPath = path.join(adminDistPath, "index.html");
311
311
  .replace(/src="\\.\\//g, 'src="/admin/')
312
312
  .replace(/href="\\.\\//g, 'href="/admin/');
313
313
  const configJson = JSON.stringify({
314
- domain: issuer.replace(/\\/$/, ""),${n ? `
315
- clientId: CONTROL_PLANE_CLIENT_ID,` : ""}
314
+ domain: issuer.replace(/\\/$/, ""),
315
+ clientId: ${a ? "CONTROL_PLANE_CLIENT_ID," : '"default",'}
316
316
  basePath: "/admin",
317
317
  }).replace(/</g, "\\\\u003c");
318
318
  configWithHandlers.adminIndexHtml = rawHtml.replace(
@@ -325,13 +325,13 @@ const adminIndexPath = path.join(adminDistPath, "index.html");
325
325
  });
326
326
  }
327
327
  ` : "";
328
- return n ? `import { Context } from "hono";
328
+ return a ? `import { Context } from "hono";
329
329
  import { swaggerUI } from "@hono/swagger-ui";
330
330
  import { AuthHeroConfig, DataAdapters } from "authhero";
331
331
  import { serveStatic } from "@hono/node-server/serve-static";
332
332
  import { initMultiTenant } from "@authhero/multi-tenancy";
333
333
  import path from "path";
334
- ${r}import { fileURLToPath } from "url";
334
+ ${n}import { fileURLToPath } from "url";
335
335
 
336
336
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
337
337
 
@@ -339,10 +339,10 @@ const widgetPath = path.resolve(
339
339
  __dirname,
340
340
  "../node_modules/@authhero/widget/dist/authhero-widget",
341
341
  );
342
- ${a}
342
+ ${r}
343
343
  // Control plane configuration
344
344
  const CONTROL_PLANE_TENANT_ID = "control_plane";
345
- const CONTROL_PLANE_CLIENT_ID = "default_client";
345
+ const CONTROL_PLANE_CLIENT_ID = "default";
346
346
 
347
347
  export default function createApp(config: AuthHeroConfig & { dataAdapter: DataAdapters }) {
348
348
  const configWithHandlers: AuthHeroConfig & { dataAdapter: DataAdapters } = {
@@ -389,7 +389,7 @@ import { AuthHeroConfig, init } from "authhero";
389
389
  import { swaggerUI } from "@hono/swagger-ui";
390
390
  import { serveStatic } from "@hono/node-server/serve-static";
391
391
  import path from "path";
392
- ${r}import { fileURLToPath } from "url";
392
+ ${n}import { fileURLToPath } from "url";
393
393
 
394
394
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
395
395
 
@@ -397,7 +397,7 @@ const widgetPath = path.resolve(
397
397
  __dirname,
398
398
  "../node_modules/@authhero/widget/dist/authhero-widget",
399
399
  );
400
- ${a}
400
+ ${r}
401
401
  export default function createApp(config: AuthHeroConfig) {
402
402
  const configWithHandlers: AuthHeroConfig = {
403
403
  ...config,
@@ -430,7 +430,7 @@ ${o}
430
430
  }
431
431
  `;
432
432
  }
433
- function O(n) {
433
+ function O(a) {
434
434
  return `import { D1Dialect } from "kysely-d1";
435
435
  import { Kysely } from "kysely";
436
436
  import createAdapters from "@authhero/kysely-adapter";
@@ -457,9 +457,10 @@ export default {
457
457
  adminUsername,
458
458
  adminPassword,
459
459
  issuer,
460
- tenantId: "${n ? "control_plane" : "main"}",
461
- tenantName: "${n ? "Control Plane" : "Main"}",
462
- isControlPlane: ${!!n},
460
+ tenantId: "${a ? "control_plane" : "main"}",
461
+ tenantName: "${a ? "Control Plane" : "Main"}",
462
+ isControlPlane: ${!!a},
463
+ clientId: "default",
463
464
  });
464
465
 
465
466
  return new Response(
@@ -490,24 +491,24 @@ export default {
490
491
  };
491
492
  `;
492
493
  }
493
- function L(n, e) {
494
- const r = e ? `import adminIndexHtml from "./admin-index-html";
495
- ` : "", a = e ? ` adminIndexHtml,
494
+ function L(a, e) {
495
+ const n = e ? `import adminIndexHtml from "./admin-index-html";
496
+ ` : "", r = e ? ` adminIndexHtml,
496
497
  ` : "";
497
- return n ? `import { Context } from "hono";
498
+ return a ? `import { Context } from "hono";
498
499
  import { swaggerUI } from "@hono/swagger-ui";
499
500
  import { AuthHeroConfig, DataAdapters } from "authhero";
500
501
  import { initMultiTenant } from "@authhero/multi-tenancy";
501
- ${r}
502
+ ${n}
502
503
  // Control plane configuration
503
504
  const CONTROL_PLANE_TENANT_ID = "control_plane";
504
- const CONTROL_PLANE_CLIENT_ID = "default_client";
505
+ const CONTROL_PLANE_CLIENT_ID = "default";
505
506
 
506
507
  export default function createApp(config: AuthHeroConfig & { dataAdapter: DataAdapters }) {
507
508
  // Initialize multi-tenant AuthHero - syncs resource servers, roles, and connections by default
508
509
  const { app } = initMultiTenant({
509
510
  ...config,
510
- ${a} controlPlane: {
511
+ ${r} controlPlane: {
511
512
  tenantId: CONTROL_PLANE_TENANT_ID,
512
513
  clientId: CONTROL_PLANE_CLIENT_ID,
513
514
  },
@@ -539,11 +540,11 @@ ${a} controlPlane: {
539
540
  import { cors } from "hono/cors";
540
541
  import { AuthHeroConfig, init } from "authhero";
541
542
  import { swaggerUI } from "@hono/swagger-ui";
542
- ${r}
543
+ ${n}
543
544
  export default function createApp(config: AuthHeroConfig) {
544
545
  const { app } = init({
545
546
  ...config,
546
- ${a} });
547
+ ${r} });
547
548
 
548
549
  // Enable CORS for all origins in development
549
550
  app.use("*", cors({
@@ -575,15 +576,15 @@ ${a} });
575
576
  }
576
577
  `;
577
578
  }
578
- function j(n) {
579
- return n ? `import { Context } from "hono";
579
+ function j(a) {
580
+ return a ? `import { Context } from "hono";
580
581
  import { swaggerUI } from "@hono/swagger-ui";
581
582
  import { AuthHeroConfig, DataAdapters } from "authhero";
582
583
  import { initMultiTenant } from "@authhero/multi-tenancy";
583
584
 
584
585
  // Control plane configuration
585
586
  const CONTROL_PLANE_TENANT_ID = "control_plane";
586
- const CONTROL_PLANE_CLIENT_ID = "default_client";
587
+ const CONTROL_PLANE_CLIENT_ID = "default";
587
588
 
588
589
  interface AppConfig extends AuthHeroConfig {
589
590
  dataAdapter: DataAdapters;
@@ -681,7 +682,7 @@ export default function createApp(config: AppConfig) {
681
682
  }
682
683
  `;
683
684
  }
684
- function $(n) {
685
+ function $(a) {
685
686
  return `import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
686
687
  import { DynamoDBDocumentClient } from "@aws-sdk/lib-dynamodb";
687
688
  import createAdapters from "@authhero/aws";
@@ -710,9 +711,9 @@ async function main() {
710
711
  await seed(adapters, {
711
712
  adminUsername,
712
713
  adminPassword,
713
- tenantId: "${n ? "control_plane" : "main"}",
714
- tenantName: "${n ? "Control Plane" : "Main"}",
715
- isControlPlane: ${!!n},
714
+ tenantId: "${a ? "control_plane" : "main"}",
715
+ tenantName: "${a ? "Control Plane" : "Main"}",
716
+ isControlPlane: ${!!a},
716
717
  });
717
718
 
718
719
  console.log("✅ Database seeded successfully!");
@@ -721,25 +722,23 @@ async function main() {
721
722
  main().catch(console.error);
722
723
  `;
723
724
  }
724
- function H(n, e) {
725
- const r = i.join(n, "src");
725
+ function H(a, e) {
726
+ const n = i.join(a, "src");
726
727
  s.writeFileSync(
727
- i.join(r, "app.ts"),
728
+ i.join(n, "app.ts"),
728
729
  j(e)
729
730
  ), s.writeFileSync(
730
- i.join(r, "seed.ts"),
731
+ i.join(n, "seed.ts"),
731
732
  $(e)
732
733
  );
733
734
  }
734
- function I() {
735
- console.log("\\n" + "─".repeat(50)), console.log("🔐 AuthHero deployed to AWS!"), console.log("📚 Check SST output for your API URL"), console.log(
736
- "🚀 Open your server URL /setup to complete initial setup"
737
- ), console.log("🌐 Portal available at https://local.authhero.net"), console.log("─".repeat(50) + "\\n");
735
+ function x() {
736
+ console.log("\\n" + "─".repeat(50)), console.log("🔐 AuthHero deployed to AWS!"), console.log("📚 Check SST output for your API URL"), console.log("🚀 Open your server URL /setup to complete initial setup"), console.log("🌐 Portal available at https://local.authhero.net"), console.log("─".repeat(50) + "\\n");
738
737
  }
739
- function M(n) {
740
- const e = i.join(n, ".github", "workflows");
738
+ function M(a) {
739
+ const e = i.join(a, ".github", "workflows");
741
740
  s.mkdirSync(e, { recursive: !0 });
742
- const r = `name: Unit tests
741
+ const n = `name: Unit tests
743
742
 
744
743
  on: push
745
744
 
@@ -760,7 +759,7 @@ jobs:
760
759
 
761
760
  - run: npm run type-check
762
761
  - run: npm test
763
- `, a = `name: Deploy to Dev
762
+ `, r = `name: Deploy to Dev
764
763
 
765
764
  on:
766
765
  push:
@@ -825,9 +824,9 @@ jobs:
825
824
  apiToken: \${{ secrets.PROD_CLOUDFLARE_API_TOKEN }}
826
825
  command: deploy --env production
827
826
  `;
828
- s.writeFileSync(i.join(e, "unit-tests.yml"), r), s.writeFileSync(i.join(e, "deploy-dev.yml"), a), s.writeFileSync(i.join(e, "release.yml"), o), console.log("\\n📦 GitHub CI workflows created!");
827
+ s.writeFileSync(i.join(e, "unit-tests.yml"), n), s.writeFileSync(i.join(e, "deploy-dev.yml"), r), s.writeFileSync(i.join(e, "release.yml"), o), console.log("\\n📦 GitHub CI workflows created!");
829
828
  }
830
- function F(n) {
829
+ function F(a) {
831
830
  const e = {
832
831
  branches: ["main"],
833
832
  plugins: [
@@ -837,53 +836,49 @@ function F(n) {
837
836
  ]
838
837
  };
839
838
  s.writeFileSync(
840
- i.join(n, ".releaserc.json"),
839
+ i.join(a, ".releaserc.json"),
841
840
  JSON.stringify(e, null, 2)
842
841
  );
843
- const r = i.join(n, "package.json"), a = JSON.parse(s.readFileSync(r, "utf-8"));
844
- a.devDependencies = {
845
- ...a.devDependencies,
842
+ const n = i.join(a, "package.json"), r = JSON.parse(s.readFileSync(n, "utf-8"));
843
+ r.devDependencies = {
844
+ ...r.devDependencies,
846
845
  "semantic-release": "^24.0.0"
847
- }, a.scripts = {
848
- ...a.scripts,
846
+ }, r.scripts = {
847
+ ...r.scripts,
849
848
  test: 'echo "No tests yet"',
850
849
  "type-check": "tsc --noEmit"
851
- }, s.writeFileSync(r, JSON.stringify(a, null, 2));
850
+ }, s.writeFileSync(n, JSON.stringify(r, null, 2));
852
851
  }
853
- function b(n, e) {
854
- return new Promise((r, a) => {
855
- const o = E(n, [], {
852
+ function b(a, e) {
853
+ return new Promise((n, r) => {
854
+ const o = E(a, [], {
856
855
  cwd: e,
857
856
  shell: !0,
858
857
  stdio: "inherit"
859
858
  });
860
859
  o.on("close", (t) => {
861
- t === 0 ? r() : a(new Error(`Command failed with exit code ${t}`));
862
- }), o.on("error", a);
860
+ t === 0 ? n() : r(new Error(`Command failed with exit code ${t}`));
861
+ }), o.on("error", r);
863
862
  });
864
863
  }
865
- function W(n, e, r) {
866
- const a = i.join(n, "src");
864
+ function W(a, e, n) {
865
+ const r = i.join(a, "src");
867
866
  s.writeFileSync(
868
- i.join(a, "app.ts"),
869
- L(e, r)
867
+ i.join(r, "app.ts"),
868
+ L(e, n)
870
869
  ), s.writeFileSync(
871
- i.join(a, "seed.ts"),
870
+ i.join(r, "seed.ts"),
872
871
  O(e)
873
872
  );
874
873
  }
875
- function x() {
874
+ function _() {
876
875
  console.log(`
877
- ` + "─".repeat(50)), console.log("🔐 AuthHero server running at https://localhost:3000"), console.log("📚 API documentation available at https://localhost:3000/docs"), console.log(
878
- "🚀 Open https://localhost:3000/setup to complete initial setup"
879
- ), console.log("🌐 Portal available at https://local.authhero.net"), console.log("─".repeat(50) + `
876
+ ` + "─".repeat(50)), console.log("🔐 AuthHero server running at https://localhost:3000"), console.log("📚 API documentation available at https://localhost:3000/docs"), console.log("🚀 Open https://localhost:3000/setup to complete initial setup"), console.log("🌐 Portal available at https://local.authhero.net"), console.log("─".repeat(50) + `
880
877
  `);
881
878
  }
882
879
  function k() {
883
880
  console.log(`
884
- ` + "─".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(
885
- "🚀 Open https://localhost:3000/setup to complete initial setup"
886
- ), console.log("🌐 Portal available at https://local.authhero.net"), console.log("─".repeat(50) + `
881
+ ` + "─".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("🚀 Open https://localhost:3000/setup to complete initial setup"), console.log("🌐 Portal available at https://local.authhero.net"), console.log("─".repeat(50) + `
887
882
  `);
888
883
  }
889
884
  D.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(
@@ -895,13 +890,13 @@ D.version("1.0.0").description("Create a new AuthHero project").argument("[proje
895
890
  ).option(
896
891
  "--workspace",
897
892
  "use workspace:* dependencies for local monorepo development"
898
- ).option("-y, --yes", "skip all prompts and use defaults/provided options").action(async (n, e) => {
899
- const r = e.yes === !0;
893
+ ).option("-y, --yes", "skip all prompts and use defaults/provided options").action(async (a, e) => {
894
+ const n = e.yes === !0;
900
895
  console.log(`
901
896
  🔐 Welcome to AuthHero!
902
897
  `);
903
- let a = n;
904
- a || (r ? (a = "auth-server", console.log(`Using default project name: ${a}`)) : a = (await m.prompt([
898
+ let r = a;
899
+ r || (n ? (r = "auth-server", console.log(`Using default project name: ${r}`)) : r = (await m.prompt([
905
900
  {
906
901
  type: "input",
907
902
  name: "projectName",
@@ -910,8 +905,8 @@ D.version("1.0.0").description("Create a new AuthHero project").argument("[proje
910
905
  validate: (u) => u !== "" || "Project name cannot be empty"
911
906
  }
912
907
  ])).projectName);
913
- const o = i.join(process.cwd(), a);
914
- s.existsSync(o) && (console.error(`❌ Project "${a}" already exists.`), process.exit(1));
908
+ const o = i.join(process.cwd(), r);
909
+ s.existsSync(o) && (console.error(`❌ Project "${r}" already exists.`), process.exit(1));
915
910
  let t;
916
911
  e.template ? (["local", "cloudflare", "aws-sst"].includes(e.template) || (console.error(`❌ Invalid template: ${e.template}`), console.error("Valid options: local, cloudflare, aws-sst"), process.exit(1)), t = e.template, console.log(`Using template: ${p[t].name}`)) : t = (await m.prompt([
917
912
  {
@@ -941,7 +936,7 @@ D.version("1.0.0").description("Create a new AuthHero project").argument("[proje
941
936
  }
942
937
  ])).setupType;
943
938
  let c;
944
- e.multiTenant !== void 0 ? c = e.multiTenant : r ? c = !1 : c = (await m.prompt([
939
+ e.multiTenant !== void 0 ? c = e.multiTenant : n ? c = !1 : c = (await m.prompt([
945
940
  {
946
941
  type: "confirm",
947
942
  name: "multiTenant",
@@ -950,7 +945,7 @@ D.version("1.0.0").description("Create a new AuthHero project").argument("[proje
950
945
  }
951
946
  ])).multiTenant, c && console.log("Multi-tenant mode: enabled");
952
947
  let d = !1;
953
- (t === "local" || t === "cloudflare") && (e.adminUi !== void 0 ? d = e.adminUi : r ? d = !0 : d = (await m.prompt([
948
+ (t === "local" || t === "cloudflare") && (e.adminUi !== void 0 ? d = e.adminUi : n ? d = !0 : d = (await m.prompt([
954
949
  {
955
950
  type: "confirm",
956
951
  name: "adminUi",
@@ -968,16 +963,22 @@ D.version("1.0.0").description("Create a new AuthHero project").argument("[proje
968
963
  s.mkdirSync(o, { recursive: !0 }), s.writeFileSync(
969
964
  i.join(o, "package.json"),
970
965
  JSON.stringify(
971
- y.packageJson(a, c, f, C, d),
966
+ y.packageJson(
967
+ r,
968
+ c,
969
+ f,
970
+ C,
971
+ d
972
+ ),
972
973
  null,
973
974
  2
974
975
  )
975
976
  );
976
- const S = y.templateDir, _ = i.join(
977
+ const S = y.templateDir, I = i.join(
977
978
  import.meta.url.replace("file://", "").replace("/create-authhero.js", ""),
978
979
  S
979
980
  );
980
- if (s.existsSync(_) ? N(_, o) : (console.error(`❌ Template directory not found: ${_}`), process.exit(1)), t === "cloudflare" && W(o, c, d), t === "cloudflare") {
981
+ if (s.existsSync(I) ? N(I, o) : (console.error(`❌ Template directory not found: ${I}`), process.exit(1)), t === "cloudflare" && W(o, c, d), t === "cloudflare") {
981
982
  const l = i.join(o, "wrangler.toml"), u = i.join(o, "wrangler.local.toml");
982
983
  s.existsSync(l) && s.copyFileSync(l, u);
983
984
  const g = i.join(o, ".dev.vars.example"), w = i.join(o, ".dev.vars");
@@ -986,7 +987,7 @@ D.version("1.0.0").description("Create a new AuthHero project").argument("[proje
986
987
  );
987
988
  }
988
989
  let A = !1;
989
- if (t === "cloudflare" && (e.githubCi !== void 0 ? (A = e.githubCi, A && console.log("Including GitHub CI workflows with semantic versioning")) : r || (A = (await m.prompt([
990
+ if (t === "cloudflare" && (e.githubCi !== void 0 ? (A = e.githubCi, A && console.log("Including GitHub CI workflows with semantic versioning")) : n || (A = (await m.prompt([
990
991
  {
991
992
  type: "confirm",
992
993
  name: "includeGithubCi",
@@ -1033,11 +1034,11 @@ D.version("1.0.0").description("Create a new AuthHero project").argument("[proje
1033
1034
  const T = c ? "multi-tenant" : "single-tenant";
1034
1035
  console.log(
1035
1036
  `
1036
- ✅ Project "${a}" has been created with ${y.name} (${T}) setup!
1037
+ ✅ Project "${r}" has been created with ${y.name} (${T}) setup!
1037
1038
  `
1038
1039
  );
1039
1040
  let v;
1040
- if (e.skipInstall ? v = !1 : r ? v = !0 : v = (await m.prompt([
1041
+ if (e.skipInstall ? v = !1 : n ? v = !0 : v = (await m.prompt([
1041
1042
  {
1042
1043
  type: "confirm",
1043
1044
  name: "shouldInstall",
@@ -1048,7 +1049,7 @@ D.version("1.0.0").description("Create a new AuthHero project").argument("[proje
1048
1049
  let l;
1049
1050
  e.packageManager ? (["npm", "yarn", "pnpm", "bun"].includes(e.packageManager) || (console.error(
1050
1051
  `❌ Invalid package manager: ${e.packageManager}`
1051
- ), console.error("Valid options: npm, yarn, pnpm, bun"), process.exit(1)), l = e.packageManager) : r ? l = "pnpm" : l = (await m.prompt([
1052
+ ), console.error("Valid options: npm, yarn, pnpm, bun"), process.exit(1)), l = e.packageManager) : n ? l = "pnpm" : l = (await m.prompt([
1052
1053
  {
1053
1054
  type: "list",
1054
1055
  name: "packageManager",
@@ -1072,7 +1073,7 @@ D.version("1.0.0").description("Create a new AuthHero project").argument("[proje
1072
1073
  ✅ Dependencies installed successfully!
1073
1074
  `), (t === "local" || t === "cloudflare") && !e.skipMigrate) {
1074
1075
  let w;
1075
- r ? w = !0 : w = (await m.prompt([
1076
+ n ? w = !0 : w = (await m.prompt([
1076
1077
  {
1077
1078
  type: "confirm",
1078
1079
  name: "shouldMigrate",
@@ -1084,23 +1085,23 @@ D.version("1.0.0").description("Create a new AuthHero project").argument("[proje
1084
1085
  `), await b(`${l} run migrate`, o));
1085
1086
  }
1086
1087
  let g;
1087
- e.skipStart || r ? g = !1 : g = (await m.prompt([
1088
+ e.skipStart || n ? g = !1 : g = (await m.prompt([
1088
1089
  {
1089
1090
  type: "confirm",
1090
1091
  name: "shouldStart",
1091
1092
  message: "Would you like to start the development server?",
1092
1093
  default: !0
1093
1094
  }
1094
- ])).shouldStart, g && (t === "cloudflare" ? x() : t === "aws-sst" ? I() : k(), console.log(`🚀 Starting development server...
1095
- `), await b(`${l} run dev`, o)), r && !g && (console.log(`
1095
+ ])).shouldStart, g && (t === "cloudflare" ? _() : t === "aws-sst" ? x() : k(), console.log(`🚀 Starting development server...
1096
+ `), await b(`${l} run dev`, o)), n && !g && (console.log(`
1096
1097
  ✅ Setup complete!`), console.log(`
1097
- To start the development server:`), console.log(` cd ${a}`), console.log(" npm run dev"), t === "cloudflare" ? x() : t === "aws-sst" ? I() : k());
1098
+ To start the development server:`), console.log(` cd ${r}`), console.log(" npm run dev"), t === "cloudflare" ? _() : t === "aws-sst" ? x() : k());
1098
1099
  } catch (u) {
1099
1100
  console.error(`
1100
1101
  ❌ An error occurred:`, u), process.exit(1);
1101
1102
  }
1102
1103
  }
1103
- v || (console.log("Next steps:"), console.log(` cd ${a}`), t === "local" ? (console.log(" npm install"), console.log(" npm run migrate"), console.log(" npm run dev"), console.log(
1104
+ v || (console.log("Next steps:"), console.log(` cd ${r}`), t === "local" ? (console.log(" npm install"), console.log(" npm run migrate"), console.log(" npm run dev"), console.log(
1104
1105
  `
1105
1106
  Open https://localhost:3000/setup to complete initial setup`
1106
1107
  )) : t === "cloudflare" ? (console.log(" npm install"), console.log(
@@ -1108,10 +1109,8 @@ Open https://localhost:3000/setup to complete initial setup`
1108
1109
  ), console.log(" npm run dev # or npm run dev:remote for production"), console.log(
1109
1110
  `
1110
1111
  Open https://localhost:3000/setup to complete initial setup`
1111
- )) : t === "aws-sst" && (console.log(" npm install"), console.log(" npm run dev # Deploys to AWS in development mode"), console.log(
1112
- `
1113
- Open your server URL /setup to complete initial setup`
1114
- )), console.log(`
1112
+ )) : t === "aws-sst" && (console.log(" npm install"), console.log(" npm run dev # Deploys to AWS in development mode"), console.log(`
1113
+ Open your server URL /setup to complete initial setup`)), console.log(`
1115
1114
  Server will be available at: https://localhost:3000`), console.log("Portal available at: https://local.authhero.net"), f && (console.log(`
1116
1115
  🧪 OpenID Conformance Suite Testing:`), console.log(
1117
1116
  " 1. Clone and start the conformance suite (if not already running):"
@@ -34,11 +34,13 @@ export default function createApp(config: AuthHeroConfig) {
34
34
  if (fs.existsSync(adminIndexPath)) {
35
35
  const issuer =
36
36
  process.env.ISSUER || `https://localhost:${process.env.PORT || 3000}/`;
37
- const rawHtml = fs.readFileSync(adminIndexPath, "utf-8")
37
+ const rawHtml = fs
38
+ .readFileSync(adminIndexPath, "utf-8")
38
39
  .replace(/src="\.\/assets\//g, 'src="/admin/assets/')
39
40
  .replace(/href="\.\/assets\//g, 'href="/admin/assets/');
40
41
  const configJson = JSON.stringify({
41
42
  domain: issuer.replace(/\/$/, ""),
43
+ clientId: "default",
42
44
  basePath: "/admin",
43
45
  }).replace(/</g, "\\u003c");
44
46
  configWithHandlers.adminIndexHtml = rawHtml.replace(
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.35.0",
8
+ "version": "0.37.0",
9
9
  "type": "module",
10
10
  "main": "dist/create-authhero.js",
11
11
  "bin": {