create-authhero 0.37.0 โ†’ 0.39.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.
@@ -44,7 +44,7 @@ export async function handler(event: APIGatewayProxyEventV2, context: Context) {
44
44
  // WARNING: These localhost origins are for development only
45
45
  // Remove or override via ALLOWED_ORIGINS env var in production
46
46
  "http://localhost:5173",
47
- "https://localhost:3000",
47
+ "http://localhost:3000",
48
48
  origin,
49
49
  ].filter(Boolean);
50
50
 
@@ -58,7 +58,7 @@ This project is designed to be **open-source friendly**. Sensitive Cloudflare ID
58
58
  npm run dev
59
59
  ```
60
60
 
61
- The server will be available at `https://localhost:3000`.
61
+ The server will be available at `http://localhost:3000`.
62
62
 
63
63
  ### Remote Development (Your Cloudflare Account)
64
64
 
@@ -58,7 +58,7 @@ export default {
58
58
  // Allow CORS for the Management API from admin UIs
59
59
  allowedOrigins: [
60
60
  "http://localhost:5173",
61
- "https://localhost:3000",
61
+ "http://localhost:3000",
62
62
  "https://manage.authhero.net",
63
63
  "https://local.authhero.net",
64
64
  origin,
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { Command as P } from "commander";
2
+ import { Command as E } from "commander";
3
3
  import m from "inquirer";
4
4
  import s from "fs";
5
5
  import i from "path";
6
- import { spawn as E } from "child_process";
7
- const D = new P(), p = {
6
+ import { spawn as P } from "child_process";
7
+ const D = new E(), p = {
8
8
  local: {
9
9
  name: "Local (SQLite)",
10
10
  description: "Local development setup with SQLite database - great for getting started",
@@ -147,8 +147,8 @@ function R(a, e = !1, n = "authhero-local", r) {
147
147
  "https://manage.authhero.net/auth-callback",
148
148
  "https://local.authhero.net/auth-callback",
149
149
  "http://localhost:5173/auth-callback",
150
- "https://localhost:3000/auth-callback",
151
- ...r ? ["https://localhost:3000/admin/auth-callback"] : []
150
+ "http://localhost:3000/auth-callback",
151
+ ...r ? ["http://localhost:3000/admin/auth-callback"] : []
152
152
  ], d = e ? [
153
153
  `https://localhost.emobix.co.uk:8443/test/a/${n}/callback`,
154
154
  `https://localhost:8443/test/a/${n}/callback`
@@ -156,7 +156,7 @@ function R(a, e = !1, n = "authhero-local", r) {
156
156
  "https://manage.authhero.net",
157
157
  "https://local.authhero.net",
158
158
  "http://localhost:5173",
159
- "https://localhost:3000"
159
+ "http://localhost:3000"
160
160
  ], C = e ? ["https://localhost:8443/", "https://localhost.emobix.co.uk:8443/"] : [], y = [...h, ...C], S = e ? `
161
161
  // Create OpenID Conformance Suite test clients and user
162
162
  console.log("Creating conformance test clients and user...");
@@ -283,7 +283,7 @@ async function main() {
283
283
  tenantId: "${o}",
284
284
  tenantName: "${t}",
285
285
  isControlPlane: ${!!a},
286
- clientId: "default"
286
+ clientId: "default",
287
287
  callbacks: ${JSON.stringify(f)},
288
288
  allowedLogoutUrls: ${JSON.stringify(y)},
289
289
  });
@@ -306,7 +306,7 @@ const adminIndexPath = path.join(adminDistPath, "index.html");
306
306
  // Add admin UI handler if the package is installed
307
307
  if (fs.existsSync(adminIndexPath)) {
308
308
  const issuer =
309
- process.env.ISSUER || \`https://localhost:\${process.env.PORT || 3000}/\`;
309
+ process.env.ISSUER || \`http://localhost:\${process.env.PORT || 3000}/\`;
310
310
  const rawHtml = fs.readFileSync(adminIndexPath, "utf-8")
311
311
  .replace(/src="\\.\\//g, 'src="/admin/')
312
312
  .replace(/href="\\.\\//g, 'href="/admin/');
@@ -851,7 +851,7 @@ function F(a) {
851
851
  }
852
852
  function b(a, e) {
853
853
  return new Promise((n, r) => {
854
- const o = E(a, [], {
854
+ const o = P(a, [], {
855
855
  cwd: e,
856
856
  shell: !0,
857
857
  stdio: "inherit"
@@ -873,12 +873,12 @@ function W(a, e, n) {
873
873
  }
874
874
  function _() {
875
875
  console.log(`
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) + `
876
+ ` + "โ”€".repeat(50)), console.log("๐Ÿ” AuthHero server running at https://localhost:3000"), console.log("๐Ÿš€ Open https://localhost:3000/setup to complete initial setup"), console.log("โ”€".repeat(50) + `
877
877
  `);
878
878
  }
879
879
  function k() {
880
880
  console.log(`
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) + `
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 http://localhost:3000"), console.log("๐Ÿ“š API documentation available at http://localhost:3000/docs"), console.log("๐Ÿš€ Open http://localhost:3000/setup to complete initial setup"), console.log("โ”€".repeat(50) + `
882
882
  `);
883
883
  }
884
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(
@@ -1103,7 +1103,7 @@ To start the development server:`), console.log(` cd ${r}`), console.log(" npm
1103
1103
  }
1104
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(
1105
1105
  `
1106
- Open https://localhost:3000/setup to complete initial setup`
1106
+ Open http://localhost:3000/setup to complete initial setup`
1107
1107
  )) : t === "cloudflare" ? (console.log(" npm install"), console.log(
1108
1108
  " npm run migrate # or npm run db:migrate:remote for production"
1109
1109
  ), console.log(" npm run dev # or npm run dev:remote for production"), console.log(
@@ -1111,7 +1111,7 @@ Open https://localhost:3000/setup to complete initial setup`
1111
1111
  Open https://localhost:3000/setup to complete initial setup`
1112
1112
  )) : t === "aws-sst" && (console.log(" npm install"), console.log(" npm run dev # Deploys to AWS in development mode"), console.log(`
1113
1113
  Open your server URL /setup to complete initial setup`)), console.log(`
1114
- Server will be available at: https://localhost:3000`), console.log("Portal available at: https://local.authhero.net"), f && (console.log(`
1114
+ Server will be available at: http://localhost:3000`), f && (console.log(`
1115
1115
  ๐Ÿงช OpenID Conformance Suite Testing:`), console.log(
1116
1116
  " 1. Clone and start the conformance suite (if not already running):"
1117
1117
  ), console.log(
@@ -33,7 +33,7 @@ export default function createApp(config: AuthHeroConfig) {
33
33
  // Add admin UI handler if the package is installed
34
34
  if (fs.existsSync(adminIndexPath)) {
35
35
  const issuer =
36
- process.env.ISSUER || `https://localhost:${process.env.PORT || 3000}/`;
36
+ process.env.ISSUER || `http://localhost:${process.env.PORT || 3000}/`;
37
37
  const rawHtml = fs
38
38
  .readFileSync(adminIndexPath, "utf-8")
39
39
  .replace(/src="\.\/assets\//g, 'src="/admin/assets/')
@@ -4,62 +4,6 @@ import { Kysely } from "kysely";
4
4
  import Database from "better-sqlite3";
5
5
  import createAdapters from "@authhero/kysely-adapter";
6
6
  import createApp from "./app";
7
- import fs from "fs";
8
- import path from "path";
9
- import { execSync } from "child_process";
10
- import https from "https";
11
-
12
- // Generate self-signed certificates for local HTTPS if they don't exist
13
- const certDir = path.join(process.cwd(), ".certs");
14
- const keyPath = path.join(certDir, "localhost-key.pem");
15
- const certPath = path.join(certDir, "localhost.pem");
16
-
17
- function ensureCertificates() {
18
- if (!fs.existsSync(certDir)) {
19
- fs.mkdirSync(certDir, { recursive: true });
20
- }
21
-
22
- if (!fs.existsSync(keyPath) || !fs.existsSync(certPath)) {
23
- console.log("๐Ÿ”‘ Generating self-signed certificates for local HTTPS...");
24
-
25
- // Try mkcert first (if installed), otherwise fall back to openssl
26
- try {
27
- execSync(`which mkcert`, { stdio: "ignore" });
28
- execSync(
29
- `mkcert -key-file ${keyPath} -cert-file ${certPath} localhost 127.0.0.1`,
30
- {
31
- stdio: "inherit",
32
- },
33
- );
34
- console.log("โœ… Certificates generated with mkcert");
35
- } catch {
36
- // Fall back to openssl
37
- try {
38
- execSync(
39
- `openssl req -x509 -newkey rsa:2048 -keyout "${keyPath}" -out "${certPath}" -days 365 -nodes -subj "/CN=localhost"`,
40
- { stdio: "inherit" },
41
- );
42
- console.log("โœ… Self-signed certificates generated with openssl");
43
- console.log(
44
- "โš ๏ธ You may need to trust the certificate in your browser",
45
- );
46
- } catch (err) {
47
- console.error(
48
- "โŒ Failed to generate certificates. Please install mkcert or openssl",
49
- );
50
- console.error(
51
- " Install mkcert: brew install mkcert && mkcert -install",
52
- );
53
- process.exit(1);
54
- }
55
- }
56
- }
57
-
58
- return {
59
- key: fs.readFileSync(keyPath),
60
- cert: fs.readFileSync(certPath),
61
- };
62
- }
63
7
 
64
8
  // Initialize SQLite database
65
9
  let db: Kysely<any>;
@@ -90,19 +34,15 @@ const app = createApp({
90
34
  "https://manage.authhero.net",
91
35
  "https://local.authhero.net",
92
36
  "http://localhost:5173",
93
- "https://localhost:5173",
94
37
  ],
95
38
  });
96
39
 
97
40
  // Start the server
98
41
  const port = Number(process.env.PORT) || 3000;
99
- const issuer = process.env.ISSUER || `https://localhost:${port}/`;
100
-
101
- // Get or generate certificates
102
- const { key, cert } = ensureCertificates();
42
+ const issuer = process.env.ISSUER || `http://localhost:${port}/`;
103
43
 
104
- console.log(`๐Ÿ” AuthHero server running at https://localhost:${port}`);
105
- console.log(`๐Ÿ“š API documentation available at https://localhost:${port}/docs`);
44
+ console.log(`๐Ÿ” AuthHero server running at http://localhost:${port}`);
45
+ console.log(`๐Ÿ“š API documentation available at http://localhost:${port}/docs`);
106
46
  console.log(`๐ŸŒ Portal available at https://local.authhero.net`);
107
47
 
108
48
  serve({
@@ -113,6 +53,4 @@ serve({
113
53
  });
114
54
  },
115
55
  port,
116
- createServer: https.createServer,
117
- serverOptions: { key, cert },
118
56
  });
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.37.0",
8
+ "version": "0.39.0",
9
9
  "type": "module",
10
10
  "main": "dist/create-authhero.js",
11
11
  "bin": {