@farm.js/convex 0.1.0-beta.14 → 0.1.0-beta.15
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/dev.d.ts +6 -0
- package/dist/dev.d.ts.map +1 -1
- package/dist/dev.js +39 -10
- package/dist/index.js +1 -1
- package/package.json +3 -3
package/dist/dev.d.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import { type ChildProcess } from "node:child_process";
|
|
1
2
|
import type { ConvexDevOptions, ConvexDevState } from "./types.js";
|
|
2
3
|
import type { ConvexPluginInput } from "./types.js";
|
|
3
4
|
export declare function resolveDevOptions(dev: boolean | ConvexDevOptions | undefined): ConvexDevOptions | undefined;
|
|
4
5
|
export declare function isDeploymentChosen(root: string): boolean;
|
|
5
6
|
export declare function startConvexDev(root: string, options: ConvexDevOptions, state: ConvexDevState): void;
|
|
6
7
|
export declare function stopConvexDev(state: ConvexDevState | undefined): void;
|
|
8
|
+
/**
|
|
9
|
+
* Stop convex dev and what it started. Windows has no SIGINT for another process, and kill() ends
|
|
10
|
+
* only that one process, so taskkill ends the whole tree there.
|
|
11
|
+
*/
|
|
12
|
+
export declare function stopConvexProcess(child: ChildProcess, platform?: NodeJS.Platform): void;
|
|
7
13
|
/** Tell the developer to restart once convex dev has written the new deployment's URL. */
|
|
8
14
|
export declare function announceNewDeployment(root: string, interval?: number): () => void;
|
|
9
15
|
export declare function createConvexPlugin(input: ConvexPluginInput): import("@farm.js/core").FarmPlugin<ConvexDevState, Record<string, never>, unknown, undefined, unknown, false, import("@farm.js/core").PluginRoutes>;
|
package/dist/dev.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../src/dev.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../src/dev.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AASzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAwB,MAAM,YAAY,CAAC;AACzF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAIpD,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,OAAO,GAAG,gBAAgB,GAAG,SAAS,GAC1C,gBAAgB,GAAG,SAAS,CAG9B;AA+BD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGxD;AASD,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,gBAAgB,EACzB,KAAK,EAAE,cAAc,GACpB,IAAI,CA0BN;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS,GAAG,IAAI,CAIrE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,YAAY,EACnB,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAC3C,IAAI,CASN;AAID,0FAA0F;AAC1F,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,SAAM,GAAG,MAAM,IAAI,CAsB9E;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,uJAkC1D"}
|
package/dist/dev.js
CHANGED
|
@@ -1,20 +1,35 @@
|
|
|
1
|
-
import { spawn } from "node:child_process";
|
|
1
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
2
2
|
import { existsSync, readFileSync } from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { createInterface } from "node:readline";
|
|
5
5
|
import { styleText } from "node:util";
|
|
6
6
|
import { definePlugin } from "@farm.js/core/plugin";
|
|
7
7
|
import { checkServiceHomes } from "./homes.js";
|
|
8
|
-
const CONVEX_BINARY = process.platform === "win32" ? "convex.cmd" : "convex";
|
|
9
8
|
const OUTPUT_LABEL = "convex │ ";
|
|
10
9
|
export function resolveDevOptions(dev) {
|
|
11
10
|
if (dev === false)
|
|
12
11
|
return undefined;
|
|
13
12
|
return dev === true || dev === undefined ? {} : dev;
|
|
14
13
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
/**
|
|
15
|
+
* The convex CLI script installed in the app. Farm runs it with its own Node rather than through
|
|
16
|
+
* the node_modules/.bin shim, which on Windows is a .cmd file that only cmd.exe can run, and
|
|
17
|
+
* cmd.exe splits a project path that contains a space.
|
|
18
|
+
*/
|
|
19
|
+
function findConvexCli(root) {
|
|
20
|
+
const packageDirectory = path.join(root, "node_modules", "convex");
|
|
21
|
+
let bin;
|
|
22
|
+
try {
|
|
23
|
+
bin = JSON.parse(readFileSync(path.join(packageDirectory, "package.json"), "utf8")).bin;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
const script = typeof bin === "string" ? bin : bin?.convex;
|
|
29
|
+
if (typeof script !== "string")
|
|
30
|
+
return undefined;
|
|
31
|
+
const cliPath = path.join(packageDirectory, script);
|
|
32
|
+
return existsSync(cliPath) ? cliPath : undefined;
|
|
18
33
|
}
|
|
19
34
|
function readEnvironmentFile(root) {
|
|
20
35
|
try {
|
|
@@ -39,16 +54,15 @@ function writeLabelledLines(source, target) {
|
|
|
39
54
|
});
|
|
40
55
|
}
|
|
41
56
|
export function startConvexDev(root, options, state) {
|
|
42
|
-
const
|
|
43
|
-
if (!
|
|
57
|
+
const cliPath = findConvexCli(root);
|
|
58
|
+
if (!cliPath) {
|
|
44
59
|
console.warn("[farm:convex] convex is not installed in this app, so `convex dev` was not started.");
|
|
45
60
|
return;
|
|
46
61
|
}
|
|
47
62
|
const labelOutput = isDeploymentChosen(root);
|
|
48
|
-
const child = spawn(
|
|
63
|
+
const child = spawn(process.execPath, [cliPath, "dev", ...(options.args ?? [])], {
|
|
49
64
|
cwd: root,
|
|
50
65
|
stdio: labelOutput ? ["inherit", "pipe", "pipe"] : "inherit",
|
|
51
|
-
shell: process.platform === "win32",
|
|
52
66
|
env: labelOutput && process.stdout.isTTY ? { ...process.env, FORCE_COLOR: "1" } : process.env,
|
|
53
67
|
});
|
|
54
68
|
state.child = child;
|
|
@@ -68,9 +82,24 @@ export function startConvexDev(root, options, state) {
|
|
|
68
82
|
export function stopConvexDev(state) {
|
|
69
83
|
if (!state?.child || state.child.exitCode !== null)
|
|
70
84
|
return;
|
|
71
|
-
state.child
|
|
85
|
+
stopConvexProcess(state.child);
|
|
72
86
|
state.child = undefined;
|
|
73
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Stop convex dev and what it started. Windows has no SIGINT for another process, and kill() ends
|
|
90
|
+
* only that one process, so taskkill ends the whole tree there.
|
|
91
|
+
*/
|
|
92
|
+
export function stopConvexProcess(child, platform = process.platform) {
|
|
93
|
+
if (platform === "win32" && child.pid !== undefined) {
|
|
94
|
+
const result = spawnSync("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
|
|
95
|
+
stdio: "ignore",
|
|
96
|
+
windowsHide: true,
|
|
97
|
+
});
|
|
98
|
+
if (!result.error && result.status === 0)
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
child.kill("SIGINT");
|
|
102
|
+
}
|
|
74
103
|
const DEPLOYMENT_URL_PATTERN = /^(?:VITE_)?CONVEX_URL=\S/m;
|
|
75
104
|
/** Tell the developer to restart once convex dev has written the new deployment's URL. */
|
|
76
105
|
export function announceNewDeployment(root, interval = 500) {
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineIntegration } from "@farm.js/core";
|
|
1
|
+
import { defineIntegration } from "@farm.js/core/integrations";
|
|
2
2
|
import { createConvexPlugin, resolveDevOptions } from "./dev.js";
|
|
3
3
|
import { detectExtensions, mergeExtensions } from "./detect.js";
|
|
4
4
|
import { hasDeploymentURL, resolveDeploymentURLs } from "./environment.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farm.js/convex",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.15",
|
|
4
4
|
"description": "Convex integration for Farm.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"convex",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"unstorage": "2.0.0-alpha.10",
|
|
54
|
-
"@farm.js/
|
|
55
|
-
"@farm.js/
|
|
54
|
+
"@farm.js/integration-utils": "0.1.67",
|
|
55
|
+
"@farm.js/core": "0.1.67"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/node": "^22.20.5",
|