create-authhero 0.41.1 → 0.41.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/create-authhero.js +28 -19
- package/package.json +1 -1
package/dist/create-authhero.js
CHANGED
|
@@ -5,7 +5,7 @@ import i from "fs";
|
|
|
5
5
|
import s from "path";
|
|
6
6
|
import { fileURLToPath as O } from "url";
|
|
7
7
|
import { spawn as U } from "child_process";
|
|
8
|
-
const
|
|
8
|
+
const N = new R(), p = {
|
|
9
9
|
local: {
|
|
10
10
|
name: "Local (SQLite)",
|
|
11
11
|
description: "Local development setup with SQLite database - great for getting started",
|
|
@@ -143,7 +143,7 @@ function P(a, e) {
|
|
|
143
143
|
i.lstatSync(n).isDirectory() ? (i.mkdirSync(t, { recursive: !0 }), P(n, t)) : i.copyFileSync(n, t);
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function $(a, e = !1, o = "authhero-local", r) {
|
|
147
147
|
const n = a ? "control_plane" : "main", t = a ? "Control Plane" : "Main", c = [
|
|
148
148
|
"https://manage.authhero.net/auth-callback",
|
|
149
149
|
"https://local.authhero.net/auth-callback",
|
|
@@ -165,10 +165,19 @@ function L(a, e = !1, o = "authhero-local", r) {
|
|
|
165
165
|
// The OIDCC basic test plan calls /token without an audience param. AuthHero
|
|
166
166
|
// requires either an explicit audience or a tenant default_audience to mint
|
|
167
167
|
// an access token, so set one here for the conformance setup.
|
|
168
|
+
// enable_dynamic_client_registration is required by the OIDCC dynamic plan,
|
|
169
|
+
// which has the suite register its own client via /oidc/register. Existing
|
|
170
|
+
// flags (e.g. inherit_global_permissions_in_organizations set by seed for
|
|
171
|
+
// the control-plane tenant) are merged in so the update doesn't clobber.
|
|
172
|
+
const existingTenant = await adapters.tenants.get("${n}");
|
|
168
173
|
await adapters.tenants.update("${n}", {
|
|
169
174
|
default_audience: "urn:authhero:management",
|
|
175
|
+
flags: {
|
|
176
|
+
...(existingTenant?.flags ?? {}),
|
|
177
|
+
enable_dynamic_client_registration: true,
|
|
178
|
+
},
|
|
170
179
|
});
|
|
171
|
-
console.log("✅ Set tenant default_audience for conformance");
|
|
180
|
+
console.log("✅ Set tenant default_audience and enabled DCR for conformance");
|
|
172
181
|
|
|
173
182
|
const conformanceCallbacks = [
|
|
174
183
|
"https://localhost.emobix.co.uk:8443/test/a/${o}/callback",
|
|
@@ -376,7 +385,7 @@ main().catch((err) => {
|
|
|
376
385
|
});
|
|
377
386
|
`;
|
|
378
387
|
}
|
|
379
|
-
function
|
|
388
|
+
function L(a, e) {
|
|
380
389
|
const o = e ? `import fs from "fs";
|
|
381
390
|
` : "", r = e ? `
|
|
382
391
|
const adminDistPath = path.resolve(
|
|
@@ -931,7 +940,7 @@ function J(a) {
|
|
|
931
940
|
"type-check": "tsc --noEmit"
|
|
932
941
|
}, i.writeFileSync(o, JSON.stringify(r, null, 2));
|
|
933
942
|
}
|
|
934
|
-
function
|
|
943
|
+
function A(a, e) {
|
|
935
944
|
return new Promise((o, r) => {
|
|
936
945
|
const n = U(a, [], {
|
|
937
946
|
cwd: e,
|
|
@@ -958,12 +967,12 @@ function D() {
|
|
|
958
967
|
` + "─".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) + `
|
|
959
968
|
`);
|
|
960
969
|
}
|
|
961
|
-
function
|
|
970
|
+
function T() {
|
|
962
971
|
console.log(`
|
|
963
972
|
` + "─".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) + `
|
|
964
973
|
`);
|
|
965
974
|
}
|
|
966
|
-
|
|
975
|
+
N.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(
|
|
967
976
|
"--package-manager <pm>",
|
|
968
977
|
"package manager to use: npm, yarn, pnpm, or bun"
|
|
969
978
|
).option("--multi-tenant", "enable multi-tenant mode").option("--admin-ui", "include admin UI at /admin").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(
|
|
@@ -1072,23 +1081,23 @@ T.version("1.0.0").description("Create a new AuthHero project").argument("[proje
|
|
|
1072
1081
|
"📁 Created wrangler.local.toml and .dev.vars for local development"
|
|
1073
1082
|
);
|
|
1074
1083
|
}
|
|
1075
|
-
let
|
|
1076
|
-
if (t === "cloudflare" && (e.githubCi !== void 0 ? (
|
|
1084
|
+
let b = !1;
|
|
1085
|
+
if (t === "cloudflare" && (e.githubCi !== void 0 ? (b = e.githubCi, b && console.log("Including GitHub CI workflows with semantic versioning")) : o || (b = (await m.prompt([
|
|
1077
1086
|
{
|
|
1078
1087
|
type: "confirm",
|
|
1079
1088
|
name: "includeGithubCi",
|
|
1080
1089
|
message: "Would you like to include GitHub CI with semantic versioning?",
|
|
1081
1090
|
default: !1
|
|
1082
1091
|
}
|
|
1083
|
-
])).includeGithubCi),
|
|
1084
|
-
const l =
|
|
1092
|
+
])).includeGithubCi), b && (q(n), J(n))), t === "local") {
|
|
1093
|
+
const l = $(
|
|
1085
1094
|
c,
|
|
1086
1095
|
f,
|
|
1087
1096
|
h,
|
|
1088
1097
|
d
|
|
1089
1098
|
);
|
|
1090
1099
|
i.writeFileSync(s.join(n, "src/seed.ts"), l);
|
|
1091
|
-
const u =
|
|
1100
|
+
const u = L(c, d);
|
|
1092
1101
|
i.writeFileSync(s.join(n, "src/app.ts"), u);
|
|
1093
1102
|
}
|
|
1094
1103
|
if (t === "aws-sst" && W(n, c), f) {
|
|
@@ -1153,9 +1162,9 @@ T.version("1.0.0").description("Create a new AuthHero project").argument("[proje
|
|
|
1153
1162
|
`);
|
|
1154
1163
|
try {
|
|
1155
1164
|
const u = l === "pnpm" ? "pnpm install --ignore-workspace" : `${l} install`;
|
|
1156
|
-
if (await
|
|
1165
|
+
if (await A(u, n), t === "local" && (console.log(`
|
|
1157
1166
|
🔧 Building native modules...
|
|
1158
|
-
`), await
|
|
1167
|
+
`), await A("npm rebuild better-sqlite3", n)), console.log(`
|
|
1159
1168
|
✅ Dependencies installed successfully!
|
|
1160
1169
|
`), (t === "local" || t === "cloudflare") && !e.skipMigrate) {
|
|
1161
1170
|
let w;
|
|
@@ -1168,7 +1177,7 @@ T.version("1.0.0").description("Create a new AuthHero project").argument("[proje
|
|
|
1168
1177
|
}
|
|
1169
1178
|
])).shouldMigrate, w && (console.log(`
|
|
1170
1179
|
🔄 Running migrations...
|
|
1171
|
-
`), await
|
|
1180
|
+
`), await A(`${l} run migrate`, n));
|
|
1172
1181
|
}
|
|
1173
1182
|
let g;
|
|
1174
1183
|
e.skipStart || o ? g = !1 : g = (await m.prompt([
|
|
@@ -1178,10 +1187,10 @@ T.version("1.0.0").description("Create a new AuthHero project").argument("[proje
|
|
|
1178
1187
|
message: "Would you like to start the development server?",
|
|
1179
1188
|
default: !0
|
|
1180
1189
|
}
|
|
1181
|
-
])).shouldStart, g && (t === "cloudflare" ? D() : t === "aws-sst" ? k() :
|
|
1182
|
-
`), await
|
|
1190
|
+
])).shouldStart, g && (t === "cloudflare" ? D() : t === "aws-sst" ? k() : T(), console.log(`🚀 Starting development server...
|
|
1191
|
+
`), await A(`${l} run dev`, n)), o && !g && (console.log(`
|
|
1183
1192
|
✅ Setup complete!`), console.log(`
|
|
1184
|
-
To start the development server:`), console.log(` cd ${r}`), console.log(" npm run dev"), t === "cloudflare" ? D() : t === "aws-sst" ? k() :
|
|
1193
|
+
To start the development server:`), console.log(` cd ${r}`), console.log(" npm run dev"), t === "cloudflare" ? D() : t === "aws-sst" ? k() : T());
|
|
1185
1194
|
} catch (u) {
|
|
1186
1195
|
console.error(`
|
|
1187
1196
|
❌ An error occurred:`, u), process.exit(1);
|
|
@@ -1208,4 +1217,4 @@ Server will be available at: http://localhost:3000`), f && (console.log(`
|
|
|
1208
1217
|
For more information, visit: https://authhero.net/docs
|
|
1209
1218
|
`));
|
|
1210
1219
|
});
|
|
1211
|
-
|
|
1220
|
+
N.parse(process.argv);
|