create-authhero 0.20.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.
- package/dist/{cloudflare-multitenant → cloudflare}/seed-helper.js +46 -2
- package/dist/create-authhero.js +407 -180
- package/dist/local/src/app.ts +21 -18
- package/package.json +1 -1
- package/dist/cloudflare-multitenant/.dev.vars.example +0 -25
- package/dist/cloudflare-multitenant/README.md +0 -463
- package/dist/cloudflare-multitenant/src/app.ts +0 -83
- package/dist/cloudflare-multitenant/src/index.ts +0 -77
- package/dist/cloudflare-multitenant/src/seed.ts +0 -67
- package/dist/cloudflare-multitenant/src/types.ts +0 -24
- package/dist/cloudflare-multitenant/wrangler.toml +0 -84
- package/dist/cloudflare-simple/copy-assets.js +0 -85
- package/dist/cloudflare-simple/drizzle.config.ts +0 -17
- package/dist/cloudflare-simple/seed-helper.js +0 -75
- package/dist/cloudflare-simple/src/app.ts +0 -36
- package/dist/cloudflare-simple/src/seed.ts +0 -67
- package/dist/cloudflare-simple/tsconfig.json +0 -14
- /package/dist/{cloudflare-simple → cloudflare}/.dev.vars.example +0 -0
- /package/dist/{cloudflare-simple → cloudflare}/README.md +0 -0
- /package/dist/{cloudflare-multitenant → cloudflare}/copy-assets.js +0 -0
- /package/dist/{cloudflare-multitenant → cloudflare}/drizzle.config.ts +0 -0
- /package/dist/{cloudflare-simple → cloudflare}/src/index.ts +0 -0
- /package/dist/{cloudflare-simple → cloudflare}/src/types.ts +0 -0
- /package/dist/{cloudflare-multitenant → cloudflare}/tsconfig.json +0 -0
- /package/dist/{cloudflare-simple → cloudflare}/wrangler.toml +0 -0
|
@@ -32,6 +32,7 @@ const worker = spawn("wrangler", wranglerArgs, {
|
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
let workerUrl = "http://localhost:8787";
|
|
35
|
+
let workerReady = false;
|
|
35
36
|
|
|
36
37
|
// Listen for the worker output to get the URL
|
|
37
38
|
worker.stdout?.on("data", (data) => {
|
|
@@ -43,10 +44,53 @@ worker.stdout?.on("data", (data) => {
|
|
|
43
44
|
if (urlMatch) {
|
|
44
45
|
workerUrl = urlMatch[0].replace(/\/$/, ""); // Remove trailing slash
|
|
45
46
|
}
|
|
47
|
+
|
|
48
|
+
// Detect when the worker is ready
|
|
49
|
+
if (output.includes("Ready on") || output.includes("Listening on")) {
|
|
50
|
+
workerReady = true;
|
|
51
|
+
}
|
|
46
52
|
});
|
|
47
53
|
|
|
48
|
-
//
|
|
49
|
-
|
|
54
|
+
// Function to wait for worker to be ready with retries
|
|
55
|
+
async function waitForWorker(maxAttempts = 30, delayMs = 1000) {
|
|
56
|
+
for (let i = 0; i < maxAttempts; i++) {
|
|
57
|
+
try {
|
|
58
|
+
// Just check if the server responds (even with an error is fine)
|
|
59
|
+
const response = await fetch(workerUrl, {
|
|
60
|
+
signal: AbortSignal.timeout(2000)
|
|
61
|
+
});
|
|
62
|
+
// Any response means the server is up
|
|
63
|
+
return true;
|
|
64
|
+
} catch (e) {
|
|
65
|
+
// ECONNREFUSED means server not ready yet
|
|
66
|
+
if (e.cause?.code !== 'ECONNREFUSED') {
|
|
67
|
+
// Other errors might mean the server is actually responding
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (workerReady) {
|
|
73
|
+
// Give it a bit more time after wrangler reports ready
|
|
74
|
+
await setTimeout(500);
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
await setTimeout(delayMs);
|
|
79
|
+
if (i > 0 && i % 5 === 0) {
|
|
80
|
+
console.log(`Still waiting for worker... (attempt ${i + 1}/${maxAttempts})`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
console.log("Waiting for seed worker to start...");
|
|
87
|
+
const isReady = await waitForWorker();
|
|
88
|
+
|
|
89
|
+
if (!isReady) {
|
|
90
|
+
console.error("\n❌ Seed worker failed to start within timeout");
|
|
91
|
+
worker.kill();
|
|
92
|
+
process.exit(1);
|
|
93
|
+
}
|
|
50
94
|
|
|
51
95
|
console.log(`\nMaking seed request to ${workerUrl}...`);
|
|
52
96
|
|