create-authhero 0.31.0 → 0.33.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.
@@ -81,7 +81,9 @@ try {
81
81
  copyDirectory(widgetSourceDir, widgetTargetDir);
82
82
  } else {
83
83
  console.warn(`⚠️ Widget directory not found: ${widgetSourceDir}`);
84
- console.warn("Widget features may not work. Install @authhero/widget to enable.");
84
+ console.warn(
85
+ "Widget features may not work. Install @authhero/widget to enable.",
86
+ );
85
87
  }
86
88
 
87
89
  console.log(`✅ Assets copied to ${targetDir}`);
@@ -81,7 +81,9 @@ try {
81
81
  copyDirectory(widgetSourceDir, widgetTargetDir);
82
82
  } else {
83
83
  console.warn(`⚠️ Widget directory not found: ${widgetSourceDir}`);
84
- console.warn("Widget features may not work. Install @authhero/widget to enable.");
84
+ console.warn(
85
+ "Widget features may not work. Install @authhero/widget to enable.",
86
+ );
85
87
  }
86
88
 
87
89
  console.log(`✅ Assets copied to ${targetDir}`);
@@ -49,13 +49,13 @@ async function waitForWorker(maxAttempts = 30, delayMs = 1000) {
49
49
  try {
50
50
  // Just check if the server responds (even with an error is fine)
51
51
  const response = await fetch(workerUrl, {
52
- signal: AbortSignal.timeout(2000)
52
+ signal: AbortSignal.timeout(2000),
53
53
  });
54
54
  // Any response means the server is up
55
55
  return true;
56
56
  } catch (e) {
57
57
  // ECONNREFUSED means server not ready yet
58
- if (e.cause?.code !== 'ECONNREFUSED') {
58
+ if (e.cause?.code !== "ECONNREFUSED") {
59
59
  // Other errors might mean the server is actually responding
60
60
  return true;
61
61
  }
@@ -69,7 +69,9 @@ async function waitForWorker(maxAttempts = 30, delayMs = 1000) {
69
69
 
70
70
  await setTimeout(delayMs);
71
71
  if (i > 0 && i % 5 === 0) {
72
- console.log(`Still waiting for worker... (attempt ${i + 1}/${maxAttempts})`);
72
+ console.log(
73
+ `Still waiting for worker... (attempt ${i + 1}/${maxAttempts})`,
74
+ );
73
75
  }
74
76
  }
75
77
  return false;
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { Command as R } from "commander";
3
- import u from "inquirer";
2
+ import { Command as I } from "commander";
3
+ import m from "inquirer";
4
4
  import a from "fs";
5
5
  import l from "path";
6
- import { spawn as I } from "child_process";
7
- const T = new R(), p = {
6
+ import { spawn as E } from "child_process";
7
+ const T = new I(), p = {
8
8
  local: {
9
9
  name: "Local (SQLite)",
10
10
  description: "Local development setup with SQLite database - great for getting started",
@@ -133,27 +133,27 @@ const T = new R(), p = {
133
133
  seedFile: "seed.ts"
134
134
  }
135
135
  };
136
- function E(o, e) {
136
+ function N(o, e) {
137
137
  a.readdirSync(o).forEach((n) => {
138
138
  const t = l.join(o, n), s = l.join(e, n);
139
- a.lstatSync(t).isDirectory() ? (a.mkdirSync(s, { recursive: !0 }), E(t, s)) : a.copyFileSync(t, s);
139
+ a.lstatSync(t).isDirectory() ? (a.mkdirSync(s, { recursive: !0 }), N(t, s)) : a.copyFileSync(t, s);
140
140
  });
141
141
  }
142
- function U(o, e = !1, r = "authhero-local") {
142
+ function P(o, e = !1, r = "authhero-local") {
143
143
  const n = o ? "control_plane" : "main", t = o ? "Control Plane" : "Main", s = [
144
144
  "https://manage.authhero.net/auth-callback",
145
145
  "https://local.authhero.net/auth-callback",
146
146
  "http://localhost:5173/auth-callback",
147
147
  "https://localhost:3000/auth-callback"
148
- ], c = e ? [
148
+ ], i = e ? [
149
149
  `https://localhost.emobix.co.uk:8443/test/a/${r}/callback`,
150
150
  `https://localhost:8443/test/a/${r}/callback`
151
- ] : [], g = [...s, ...c], w = [
151
+ ] : [], g = [...s, ...i], f = [
152
152
  "https://manage.authhero.net",
153
153
  "https://local.authhero.net",
154
154
  "http://localhost:5173",
155
155
  "https://localhost:3000"
156
- ], C = e ? ["https://localhost:8443/", "https://localhost.emobix.co.uk:8443/"] : [], y = [...w, ...C], b = e ? `
156
+ ], v = e ? ["https://localhost:8443/", "https://localhost.emobix.co.uk:8443/"] : [], w = [...f, ...v], A = e ? `
157
157
  // Create OpenID Conformance Suite test clients and user
158
158
  console.log("Creating conformance test clients and user...");
159
159
 
@@ -280,16 +280,16 @@ async function main() {
280
280
  tenantName: "${t}",
281
281
  isControlPlane: ${o},
282
282
  callbacks: ${JSON.stringify(g)},
283
- allowedLogoutUrls: ${JSON.stringify(y)},
283
+ allowedLogoutUrls: ${JSON.stringify(w)},
284
284
  });
285
- ${b}
285
+ ${A}
286
286
  await db.destroy();
287
287
  }
288
288
 
289
289
  main().catch(console.error);
290
290
  `;
291
291
  }
292
- function O(o) {
292
+ function R(o) {
293
293
  return o ? `import { Context } from "hono";
294
294
  import { swaggerUI } from "@hono/swagger-ui";
295
295
  import { AuthHeroConfig, DataAdapters } from "authhero";
@@ -393,7 +393,7 @@ export default function createApp(config: AuthHeroConfig) {
393
393
  }
394
394
  `;
395
395
  }
396
- function j(o) {
396
+ function O(o) {
397
397
  return `import { D1Dialect } from "kysely-d1";
398
398
  import { Kysely } from "kysely";
399
399
  import createAdapters from "@authhero/kysely-adapter";
@@ -453,7 +453,7 @@ export default {
453
453
  };
454
454
  `;
455
455
  }
456
- function L(o) {
456
+ function U(o) {
457
457
  return o ? `import { Context } from "hono";
458
458
  import { swaggerUI } from "@hono/swagger-ui";
459
459
  import { AuthHeroConfig, DataAdapters } from "authhero";
@@ -533,7 +533,7 @@ export default function createApp(config: AuthHeroConfig) {
533
533
  }
534
534
  `;
535
535
  }
536
- function $(o) {
536
+ function j(o) {
537
537
  return o ? `import { Context } from "hono";
538
538
  import { swaggerUI } from "@hono/swagger-ui";
539
539
  import { AuthHeroConfig, DataAdapters } from "authhero";
@@ -639,7 +639,7 @@ export default function createApp(config: AppConfig) {
639
639
  }
640
640
  `;
641
641
  }
642
- function M(o) {
642
+ function L(o) {
643
643
  return `import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
644
644
  import { DynamoDBDocumentClient } from "@aws-sdk/lib-dynamodb";
645
645
  import createAdapters from "@authhero/aws";
@@ -679,20 +679,22 @@ async function main() {
679
679
  main().catch(console.error);
680
680
  `;
681
681
  }
682
- function H(o, e) {
682
+ function $(o, e) {
683
683
  const r = l.join(o, "src");
684
684
  a.writeFileSync(
685
685
  l.join(r, "app.ts"),
686
- $(e)
686
+ j(e)
687
687
  ), a.writeFileSync(
688
688
  l.join(r, "seed.ts"),
689
- M(e)
689
+ L(e)
690
690
  );
691
691
  }
692
- function D(o) {
693
- console.log("\\n" + "─".repeat(50)), console.log("🔐 AuthHero deployed to AWS!"), console.log("📚 Check SST output for your API URL"), console.log("🌐 Portal available at https://local.authhero.net"), console.log(o ? "🏢 Multi-tenant mode enabled with control_plane tenant" : "🏠 Single-tenant mode with 'main' tenant"), console.log("─".repeat(50) + "\\n");
692
+ function k() {
693
+ console.log("\\n" + "─".repeat(50)), console.log("🔐 AuthHero deployed to AWS!"), console.log("📚 Check SST output for your API URL"), console.log(
694
+ "🚀 Open your server URL /setup to complete initial setup"
695
+ ), console.log("🌐 Portal available at https://local.authhero.net"), console.log("─".repeat(50) + "\\n");
694
696
  }
695
- function F(o) {
697
+ function H(o) {
696
698
  const e = l.join(o, ".github", "workflows");
697
699
  a.mkdirSync(e, { recursive: !0 });
698
700
  const r = `name: Unit tests
@@ -783,7 +785,7 @@ jobs:
783
785
  `;
784
786
  a.writeFileSync(l.join(e, "unit-tests.yml"), r), a.writeFileSync(l.join(e, "deploy-dev.yml"), n), a.writeFileSync(l.join(e, "release.yml"), t), console.log("\\n📦 GitHub CI workflows created!");
785
787
  }
786
- function W(o) {
788
+ function M(o) {
787
789
  const e = {
788
790
  branches: ["main"],
789
791
  plugins: [
@@ -806,9 +808,9 @@ function W(o) {
806
808
  "type-check": "tsc --noEmit"
807
809
  }, a.writeFileSync(r, JSON.stringify(n, null, 2));
808
810
  }
809
- function A(o, e) {
811
+ function S(o, e) {
810
812
  return new Promise((r, n) => {
811
- const t = I(o, [], {
813
+ const t = E(o, [], {
812
814
  cwd: e,
813
815
  shell: !0,
814
816
  stdio: "inherit"
@@ -818,64 +820,58 @@ function A(o, e) {
818
820
  }), t.on("error", n);
819
821
  });
820
822
  }
821
- function _(o, e, r) {
822
- return new Promise((n, t) => {
823
- const s = I(o, [], {
824
- cwd: e,
825
- shell: !0,
826
- stdio: "inherit",
827
- env: { ...process.env, ...r }
828
- });
829
- s.on("close", (c) => {
830
- c === 0 ? n() : t(new Error(`Command failed with exit code ${c}`));
831
- }), s.on("error", t);
832
- });
833
- }
834
- function q(o, e) {
823
+ function F(o, e) {
835
824
  const r = l.join(o, "src");
836
825
  a.writeFileSync(
837
826
  l.join(r, "app.ts"),
838
- L(e)
827
+ U(e)
839
828
  ), a.writeFileSync(
840
829
  l.join(r, "seed.ts"),
841
- j(e)
830
+ O(e)
842
831
  );
843
832
  }
844
- function x(o) {
833
+ function x() {
845
834
  console.log(`
846
- ` + "─".repeat(50)), 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(o ? "🏢 Multi-tenant mode enabled with control_plane tenant" : "🏠 Single-tenant mode with 'main' tenant"), console.log("─".repeat(50) + `
835
+ ` + "─".repeat(50)), console.log("🔐 AuthHero server running at https://localhost:3000"), console.log("📚 API documentation available at https://localhost:3000/docs"), console.log(
836
+ "🚀 Open https://localhost:3000/setup to complete initial setup"
837
+ ), console.log("🌐 Portal available at https://local.authhero.net"), console.log("─".repeat(50) + `
847
838
  `);
848
839
  }
849
- function N(o) {
840
+ function D() {
850
841
  console.log(`
851
- ` + "─".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(o ? "🏢 Multi-tenant mode enabled with control_plane tenant" : "🏠 Single-tenant mode with 'main' tenant"), console.log("─".repeat(50) + `
842
+ ` + "─".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(
843
+ "🚀 Open https://localhost:3000/setup to complete initial setup"
844
+ ), console.log("🌐 Portal available at https://local.authhero.net"), console.log("─".repeat(50) + `
852
845
  `);
853
846
  }
854
- T.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(
847
+ T.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(
855
848
  "--package-manager <pm>",
856
849
  "package manager to use: npm, yarn, pnpm, or bun"
857
- ).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("--conformance", "add OpenID conformance suite test clients").option(
850
+ ).option("--multi-tenant", "enable multi-tenant mode").option("--skip-install", "skip installing dependencies").option("--skip-migrate", "skip running database migrations").option("--skip-start", "skip starting the development server").option("--github-ci", "include GitHub CI workflows with semantic versioning").option("--conformance", "add OpenID conformance suite test clients").option(
858
851
  "--conformance-alias <alias>",
859
852
  "alias for conformance suite (default: authhero-local)"
860
- ).option("--workspace", "use workspace:* dependencies for local monorepo development").option("-y, --yes", "skip all prompts and use defaults/provided options").action(async (o, e) => {
853
+ ).option(
854
+ "--workspace",
855
+ "use workspace:* dependencies for local monorepo development"
856
+ ).option("-y, --yes", "skip all prompts and use defaults/provided options").action(async (o, e) => {
861
857
  const r = e.yes === !0;
862
858
  console.log(`
863
859
  🔐 Welcome to AuthHero!
864
860
  `);
865
861
  let n = o;
866
- n || (r ? (n = "auth-server", console.log(`Using default project name: ${n}`)) : n = (await u.prompt([
862
+ n || (r ? (n = "auth-server", console.log(`Using default project name: ${n}`)) : n = (await m.prompt([
867
863
  {
868
864
  type: "input",
869
865
  name: "projectName",
870
866
  message: "Project name:",
871
867
  default: "auth-server",
872
- validate: (d) => d !== "" || "Project name cannot be empty"
868
+ validate: (u) => u !== "" || "Project name cannot be empty"
873
869
  }
874
870
  ])).projectName);
875
871
  const t = l.join(process.cwd(), n);
876
872
  a.existsSync(t) && (console.error(`❌ Project "${n}" already exists.`), process.exit(1));
877
873
  let s;
878
- 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)), s = e.template, console.log(`Using template: ${p[s].name}`)) : s = (await u.prompt([
874
+ 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)), s = e.template, console.log(`Using template: ${p[s].name}`)) : s = (await m.prompt([
879
875
  {
880
876
  type: "list",
881
877
  name: "setupType",
@@ -902,8 +898,8 @@ T.version("1.0.0").description("Create a new AuthHero project").argument("[proje
902
898
  ]
903
899
  }
904
900
  ])).setupType;
905
- let c;
906
- e.multiTenant !== void 0 ? (c = e.multiTenant, console.log(`Multi-tenant mode: ${c ? "enabled" : "disabled"}`)) : r ? c = !1 : c = (await u.prompt([
901
+ let i;
902
+ e.multiTenant !== void 0 ? (i = e.multiTenant, console.log(`Multi-tenant mode: ${i ? "enabled" : "disabled"}`)) : r ? i = !1 : i = (await m.prompt([
907
903
  {
908
904
  type: "confirm",
909
905
  name: "multiTenant",
@@ -912,50 +908,54 @@ T.version("1.0.0").description("Create a new AuthHero project").argument("[proje
912
908
  default: !1
913
909
  }
914
910
  ])).multiTenant;
915
- const g = e.conformance || !1, w = e.conformanceAlias || "authhero-local";
911
+ const g = e.conformance || !1, f = e.conformanceAlias || "authhero-local";
916
912
  g && console.log(
917
- `OpenID Conformance Suite: enabled (alias: ${w})`
913
+ `OpenID Conformance Suite: enabled (alias: ${f})`
918
914
  );
919
- const C = e.workspace || !1;
920
- C && console.log("Workspace mode: enabled (using workspace:* dependencies)");
921
- const y = p[s];
915
+ const v = e.workspace || !1;
916
+ v && console.log("Workspace mode: enabled (using workspace:* dependencies)");
917
+ const w = p[s];
922
918
  a.mkdirSync(t, { recursive: !0 }), a.writeFileSync(
923
919
  l.join(t, "package.json"),
924
- JSON.stringify(y.packageJson(n, c, g, C), null, 2)
920
+ JSON.stringify(
921
+ w.packageJson(n, i, g, v),
922
+ null,
923
+ 2
924
+ )
925
925
  );
926
- const b = y.templateDir, k = l.join(
926
+ const A = w.templateDir, b = l.join(
927
927
  import.meta.url.replace("file://", "").replace("/create-authhero.js", ""),
928
- b
928
+ A
929
929
  );
930
- if (a.existsSync(k) ? E(k, t) : (console.error(`❌ Template directory not found: ${k}`), process.exit(1)), s === "cloudflare" && q(t, c), s === "cloudflare") {
931
- const i = l.join(t, "wrangler.toml"), d = l.join(t, "wrangler.local.toml");
932
- a.existsSync(i) && a.copyFileSync(i, d);
933
- const m = l.join(t, ".dev.vars.example"), f = l.join(t, ".dev.vars");
934
- a.existsSync(m) && a.copyFileSync(m, f), console.log(
930
+ if (a.existsSync(b) ? N(b, t) : (console.error(`❌ Template directory not found: ${b}`), process.exit(1)), s === "cloudflare" && F(t, i), s === "cloudflare") {
931
+ const c = l.join(t, "wrangler.toml"), u = l.join(t, "wrangler.local.toml");
932
+ a.existsSync(c) && a.copyFileSync(c, u);
933
+ const d = l.join(t, ".dev.vars.example"), h = l.join(t, ".dev.vars");
934
+ a.existsSync(d) && a.copyFileSync(d, h), console.log(
935
935
  "📁 Created wrangler.local.toml and .dev.vars for local development"
936
936
  );
937
937
  }
938
- let S = !1;
939
- if (s === "cloudflare" && (e.githubCi !== void 0 ? (S = e.githubCi, S && console.log("Including GitHub CI workflows with semantic versioning")) : r || (S = (await u.prompt([
938
+ let C = !1;
939
+ if (s === "cloudflare" && (e.githubCi !== void 0 ? (C = e.githubCi, C && console.log("Including GitHub CI workflows with semantic versioning")) : r || (C = (await m.prompt([
940
940
  {
941
941
  type: "confirm",
942
942
  name: "includeGithubCi",
943
943
  message: "Would you like to include GitHub CI with semantic versioning?",
944
944
  default: !1
945
945
  }
946
- ])).includeGithubCi), S && (F(t), W(t))), s === "local") {
947
- const i = U(
948
- c,
946
+ ])).includeGithubCi), C && (H(t), M(t))), s === "local") {
947
+ const c = P(
948
+ i,
949
949
  g,
950
- w
950
+ f
951
951
  );
952
- a.writeFileSync(l.join(t, "src/seed.ts"), i);
953
- const d = O(c);
954
- a.writeFileSync(l.join(t, "src/app.ts"), d);
952
+ a.writeFileSync(l.join(t, "src/seed.ts"), c);
953
+ const u = R(i);
954
+ a.writeFileSync(l.join(t, "src/app.ts"), u);
955
955
  }
956
- if (s === "aws-sst" && H(t, c), g) {
957
- const i = {
958
- alias: w,
956
+ if (s === "aws-sst" && $(t, i), g) {
957
+ const c = {
958
+ alias: f,
959
959
  description: "AuthHero Conformance Test",
960
960
  server: {
961
961
  discoveryUrl: "http://host.docker.internal:3000/.well-known/openid-configuration"
@@ -974,30 +974,30 @@ T.version("1.0.0").description("Create a new AuthHero project").argument("[proje
974
974
  };
975
975
  a.writeFileSync(
976
976
  l.join(t, "conformance-config.json"),
977
- JSON.stringify(i, null, 2)
977
+ JSON.stringify(c, null, 2)
978
978
  ), console.log(
979
979
  "📝 Created conformance-config.json for OpenID Conformance Suite"
980
980
  );
981
981
  }
982
- const P = c ? "multi-tenant" : "single-tenant";
982
+ const _ = i ? "multi-tenant" : "single-tenant";
983
983
  console.log(
984
984
  `
985
- ✅ Project "${n}" has been created with ${y.name} (${P}) setup!
985
+ ✅ Project "${n}" has been created with ${w.name} (${_}) setup!
986
986
  `
987
987
  );
988
- let v;
989
- if (e.skipInstall ? v = !1 : r ? v = !0 : v = (await u.prompt([
988
+ let y;
989
+ if (e.skipInstall ? y = !1 : r ? y = !0 : y = (await m.prompt([
990
990
  {
991
991
  type: "confirm",
992
992
  name: "shouldInstall",
993
993
  message: "Would you like to install dependencies now?",
994
994
  default: !0
995
995
  }
996
- ])).shouldInstall, v) {
997
- let i;
996
+ ])).shouldInstall, y) {
997
+ let c;
998
998
  e.packageManager ? (["npm", "yarn", "pnpm", "bun"].includes(e.packageManager) || (console.error(
999
999
  `❌ Invalid package manager: ${e.packageManager}`
1000
- ), console.error("Valid options: npm, yarn, pnpm, bun"), process.exit(1)), i = e.packageManager) : r ? i = "pnpm" : i = (await u.prompt([
1000
+ ), console.error("Valid options: npm, yarn, pnpm, bun"), process.exit(1)), c = e.packageManager) : r ? c = "pnpm" : c = (await m.prompt([
1001
1001
  {
1002
1002
  type: "list",
1003
1003
  name: "packageManager",
@@ -1011,88 +1011,55 @@ T.version("1.0.0").description("Create a new AuthHero project").argument("[proje
1011
1011
  default: "pnpm"
1012
1012
  }
1013
1013
  ])).packageManager, console.log(`
1014
- 📦 Installing dependencies with ${i}...
1014
+ 📦 Installing dependencies with ${c}...
1015
1015
  `);
1016
1016
  try {
1017
- const d = i === "pnpm" ? "pnpm install --ignore-workspace" : `${i} install`;
1018
- if (await A(d, t), s === "local" && (console.log(`
1017
+ const u = c === "pnpm" ? "pnpm install --ignore-workspace" : `${c} install`;
1018
+ if (await S(u, t), s === "local" && (console.log(`
1019
1019
  🔧 Building native modules...
1020
- `), await A("npm rebuild better-sqlite3", t)), console.log(`
1020
+ `), await S("npm rebuild better-sqlite3", t)), console.log(`
1021
1021
  ✅ Dependencies installed successfully!
1022
- `), s === "local" || s === "cloudflare") {
1023
- let f;
1024
- if (e.skipMigrate && e.skipSeed ? f = !1 : r ? f = !e.skipMigrate || !e.skipSeed : f = (await u.prompt([
1022
+ `), (s === "local" || s === "cloudflare") && !e.skipMigrate) {
1023
+ let h;
1024
+ r ? h = !0 : h = (await m.prompt([
1025
1025
  {
1026
1026
  type: "confirm",
1027
- name: "shouldSetup",
1028
- message: "Would you like to run migrations and seed the database?",
1027
+ name: "shouldMigrate",
1028
+ message: "Would you like to run database migrations?",
1029
1029
  default: !0
1030
1030
  }
1031
- ])).shouldSetup, f) {
1032
- let h;
1033
- e.email && e.password ? (h = {
1034
- username: e.email,
1035
- password: e.password
1036
- }, console.log(`Using admin username: ${e.email}`)) : h = await u.prompt([
1037
- {
1038
- type: "input",
1039
- name: "username",
1040
- message: "Admin username:",
1041
- default: "admin"
1042
- },
1043
- {
1044
- type: "password",
1045
- name: "password",
1046
- message: "Admin password:",
1047
- mask: "*",
1048
- default: "admin"
1049
- }
1050
- ]), e.skipMigrate || (console.log(`
1031
+ ])).shouldMigrate, h && (console.log(`
1051
1032
  🔄 Running migrations...
1052
- `), await A(`${i} run migrate`, t)), e.skipSeed || (console.log(`
1053
- 🌱 Seeding database...
1054
- `), s === "local" ? await _(
1055
- `${i} run seed`,
1056
- t,
1057
- {
1058
- ADMIN_USERNAME: h.username,
1059
- ADMIN_PASSWORD: h.password
1060
- }
1061
- ) : await _(
1062
- `${i} run seed:local`,
1063
- t,
1064
- {
1065
- ADMIN_USERNAME: h.username,
1066
- ADMIN_PASSWORD: h.password
1067
- }
1068
- ));
1069
- }
1033
+ `), await S(`${c} run migrate`, t));
1070
1034
  }
1071
- let m;
1072
- e.skipStart || r ? m = !1 : m = (await u.prompt([
1035
+ let d;
1036
+ e.skipStart || r ? d = !1 : d = (await m.prompt([
1073
1037
  {
1074
1038
  type: "confirm",
1075
1039
  name: "shouldStart",
1076
1040
  message: "Would you like to start the development server?",
1077
1041
  default: !0
1078
1042
  }
1079
- ])).shouldStart, m && (s === "cloudflare" ? x(c) : s === "aws-sst" ? D(c) : N(c), console.log(`🚀 Starting development server...
1080
- `), await A(`${i} run dev`, t)), r && !m && (console.log(`
1043
+ ])).shouldStart, d && (s === "cloudflare" ? x() : s === "aws-sst" ? k() : D(), console.log(`🚀 Starting development server...
1044
+ `), await S(`${c} run dev`, t)), r && !d && (console.log(`
1081
1045
  ✅ Setup complete!`), console.log(`
1082
- To start the development server:`), console.log(` cd ${n}`), console.log(" npm run dev"), s === "cloudflare" ? x(c) : s === "aws-sst" ? D(c) : N(c));
1083
- } catch (d) {
1046
+ To start the development server:`), console.log(` cd ${n}`), console.log(" npm run dev"), s === "cloudflare" ? x() : s === "aws-sst" ? k() : D());
1047
+ } catch (u) {
1084
1048
  console.error(`
1085
- ❌ An error occurred:`, d), process.exit(1);
1049
+ ❌ An error occurred:`, u), process.exit(1);
1086
1050
  }
1087
1051
  }
1088
- v || (console.log("Next steps:"), console.log(` cd ${n}`), s === "local" ? (console.log(" npm install"), console.log(" npm run migrate"), console.log(
1089
- " npm run seed # defaults to admin/admin"
1090
- ), console.log(" npm run dev")) : s === "cloudflare" ? (console.log(" npm install"), console.log(
1052
+ y || (console.log("Next steps:"), console.log(` cd ${n}`), s === "local" ? (console.log(" npm install"), console.log(" npm run migrate"), console.log(" npm run dev"), console.log(
1053
+ `
1054
+ Open https://localhost:3000/setup to complete initial setup`
1055
+ )) : s === "cloudflare" ? (console.log(" npm install"), console.log(
1091
1056
  " npm run migrate # or npm run db:migrate:remote for production"
1092
- ), console.log(
1093
- " npm run seed # defaults to admin/admin"
1094
- ), console.log(" npm run dev # or npm run dev:remote for production")) : s === "aws-sst" && (console.log(" npm install"), console.log(" npm run dev # Deploys to AWS in development mode"), console.log(" # After deploy, get TABLE_NAME from output, then:"), console.log(
1095
- " TABLE_NAME=<your-table> npm run seed # defaults to admin/admin"
1057
+ ), console.log(" npm run dev # or npm run dev:remote for production"), console.log(
1058
+ `
1059
+ Open https://localhost:3000/setup to complete initial setup`
1060
+ )) : s === "aws-sst" && (console.log(" npm install"), console.log(" npm run dev # Deploys to AWS in development mode"), console.log(
1061
+ `
1062
+ Open your server URL /setup to complete initial setup`
1096
1063
  )), console.log(`
1097
1064
  Server will be available at: https://localhost:3000`), console.log("Portal available at: https://local.authhero.net"), g && (console.log(`
1098
1065
  🧪 OpenID Conformance Suite Testing:`), console.log(
@@ -1101,7 +1068,7 @@ Server will be available at: https://localhost:3000`), console.log("Portal avail
1101
1068
  " git clone https://gitlab.com/openid/conformance-suite.git"
1102
1069
  ), console.log(" cd conformance-suite && mvn clean package"), console.log(" docker-compose up -d"), console.log(" 2. Open https://localhost.emobix.co.uk:8443"), console.log(
1103
1070
  " 3. Create a test plan and use conformance-config.json for settings"
1104
- ), console.log(` 4. Use alias: ${w}`)), console.log(`
1071
+ ), console.log(` 4. Use alias: ${f}`)), console.log(`
1105
1072
  For more information, visit: https://authhero.net/docs
1106
1073
  `));
1107
1074
  });
package/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import './dist/create-authhero.js'
3
+ import "./dist/create-authhero.js";
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.31.0",
8
+ "version": "0.33.0",
9
9
  "type": "module",
10
10
  "main": "dist/create-authhero.js",
11
11
  "bin": {