spfn 0.2.0-beta.23 → 0.2.0-beta.25
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/bin/spfn.js +46 -4
- package/dist/index.js +3 -10
- package/package.json +2 -2
package/bin/spfn.js
CHANGED
|
@@ -1,10 +1,52 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* SPFN CLI Entry Point
|
|
5
|
+
*
|
|
6
|
+
* Re-spawns with --import tsx when .ts schema loading is needed.
|
|
7
|
+
* This avoids ERR_REQUIRE_CYCLE_MODULE on Node.js 22+ where
|
|
8
|
+
* tsx.register() causes CJS/ESM interop cycles.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const TSX_FLAG = '--import';
|
|
12
|
+
const TSX_MODULE = 'tsx';
|
|
13
|
+
|
|
14
|
+
// Already running with tsx loader — just run
|
|
15
|
+
if (process.execArgv.some(arg => arg.includes(TSX_MODULE)))
|
|
16
|
+
{
|
|
17
|
+
import('../dist/index.js').then(({ run }) => run()).catch(abort);
|
|
18
|
+
}
|
|
19
|
+
else
|
|
20
|
+
{
|
|
21
|
+
// Try to re-spawn with --import tsx for .ts schema support
|
|
22
|
+
tryRelaunchWithTsx().catch(() =>
|
|
23
|
+
{
|
|
24
|
+
// tsx not available — run without it
|
|
25
|
+
import('../dist/index.js').then(({ run }) => run()).catch(abort);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async function tryRelaunchWithTsx()
|
|
4
30
|
{
|
|
5
|
-
|
|
6
|
-
|
|
31
|
+
// Verify tsx is resolvable
|
|
32
|
+
await import('tsx/esm/api');
|
|
33
|
+
|
|
34
|
+
const { spawn } = await import('child_process');
|
|
35
|
+
const child = spawn(
|
|
36
|
+
process.execPath,
|
|
37
|
+
[TSX_FLAG, TSX_MODULE, ...process.execArgv, process.argv[1], ...process.argv.slice(2)],
|
|
38
|
+
{ stdio: 'inherit' },
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
child.on('close', (code) => process.exit(code ?? 0));
|
|
42
|
+
child.on('error', () =>
|
|
43
|
+
{
|
|
44
|
+
import('../dist/index.js').then(({ run }) => run()).catch(abort);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function abort(error)
|
|
7
49
|
{
|
|
8
50
|
console.error('Error:', error);
|
|
9
51
|
process.exit(1);
|
|
10
|
-
}
|
|
52
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -755,7 +755,7 @@ var init_deployment_config = __esm({
|
|
|
755
755
|
|
|
756
756
|
// src/utils/version.ts
|
|
757
757
|
function getCliVersion() {
|
|
758
|
-
return "0.2.0-beta.
|
|
758
|
+
return "0.2.0-beta.25";
|
|
759
759
|
}
|
|
760
760
|
function getTagFromVersion(version) {
|
|
761
761
|
const match = version.match(/-([a-z]+)\./i);
|
|
@@ -2189,15 +2189,7 @@ async function runWithSpinner(spinnerText, command, successMessage, failMessage)
|
|
|
2189
2189
|
process.exit(1);
|
|
2190
2190
|
}
|
|
2191
2191
|
}
|
|
2192
|
-
var tsxRegistered = false;
|
|
2193
2192
|
async function ensureTsxLoader() {
|
|
2194
|
-
if (tsxRegistered) return;
|
|
2195
|
-
try {
|
|
2196
|
-
const tsx = await import("tsx/esm/api");
|
|
2197
|
-
tsx.register();
|
|
2198
|
-
tsxRegistered = true;
|
|
2199
|
-
} catch {
|
|
2200
|
-
}
|
|
2201
2193
|
}
|
|
2202
2194
|
async function loadSchemaImports(schemaFiles) {
|
|
2203
2195
|
const hasTsFiles = schemaFiles.some((f) => f.endsWith(".ts"));
|
|
@@ -2225,7 +2217,8 @@ async function createPushConnection() {
|
|
|
2225
2217
|
const { drizzle } = await import("drizzle-orm/node-postgres");
|
|
2226
2218
|
const pool = new pg.default.Pool({
|
|
2227
2219
|
connectionString: env.DATABASE_URL,
|
|
2228
|
-
max: 1
|
|
2220
|
+
max: 1,
|
|
2221
|
+
ssl: env.DATABASE_URL.includes("sslmode=") ? { rejectUnauthorized: false } : void 0
|
|
2229
2222
|
});
|
|
2230
2223
|
const db = drizzle(pool);
|
|
2231
2224
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spfn",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.25",
|
|
4
4
|
"description": "Superfunction CLI - Add SPFN to your Next.js project",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"postgres": "^3.4.0",
|
|
69
69
|
"prompts": "^2.4.2",
|
|
70
70
|
"tsup": "^8.5.0",
|
|
71
|
-
"@spfn/core": "0.2.0-beta.
|
|
71
|
+
"@spfn/core": "0.2.0-beta.26"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@types/fs-extra": "^11.0.4",
|