History

fix migration

Rhys Sullivan committed 8 months ago

Commit 329cc411 parent 8f435d93 files · +36 −72Browse files

Unified · Split

3 files
  1. .changeset/brave-baths-itch.md +5 −0
  2. .executor/executor.jsonc +0 −72
  3. apps/executor/src/distribution/artifact.ts +31 −0
.changeset/brave-baths-itch.md+5−0
@@ -0,0 +1,5 @@
1+---
2+"executor": minor
3+---
4+
5+fix migration
.executor/executor.jsonc+0−72
@@ -1,72 +0,0 @@
1−{
2− "sources": {
3− "google-calendar": {
4− "name": "Google Calendar",
5− "namespace": "google.calendar",
6− "connection": {
7− "endpoint": "https://calendar-json.googleapis.com/$discovery/rest?version=v3"
8− },
9− "kind": "google_discovery",
10− "binding": {
11− "service": "calendar",
12− "version": "v3",
13− "discoveryUrl": "https://calendar-json.googleapis.com/$discovery/rest?version=v3",
14− "defaultHeaders": null,
15− "scopes": []
16− }
17− },
18− "google-drive": {
19− "name": "Google Drive",
20− "namespace": "google.drive",
21− "connection": {
22− "endpoint": "https://www.googleapis.com/discovery/v1/apis/drive/v3/rest"
23− },
24− "kind": "google_discovery",
25− "binding": {
26− "service": "drive",
27− "version": "v3",
28− "discoveryUrl": "https://www.googleapis.com/discovery/v1/apis/drive/v3/rest",
29− "defaultHeaders": null,
30− "scopes": []
31− }
32− },
33− "google-tasks": {
34− "name": "Google Tasks",
35− "namespace": "google.tasks",
36− "connection": {
37− "endpoint": "https://tasks.googleapis.com/$discovery/rest?version=v1"
38− },
39− "kind": "google_discovery",
40− "binding": {
41− "service": "tasks",
42− "version": "v1",
43− "discoveryUrl": "https://tasks.googleapis.com/$discovery/rest?version=v1",
44− "defaultHeaders": null,
45− "scopes": []
46− }
47− },
48− "axiom": {
49− "name": "Axiom MCP",
50− "connection": {
51− "endpoint": "https://mcp.axiom.co/mcp"
52− },
53− "kind": "mcp",
54− "binding": {
55− "transport": "auto",
56− "queryParams": null,
57− "headers": null
58− }
59− },
60− "vercel": {
61− "kind": "openapi",
62− "name": "Vercel API",
63− "connection": {
64− "endpoint": "https://api.vercel.com/"
65− },
66− "binding": {
67− "specUrl": "https://openapi.vercel.sh/",
68− "defaultHeaders": null
69− }
70− }
71− }
72−}
apps/executor/src/distribution/artifact.ts+31−0
@@ -90,6 +90,34 @@ const resolveQuickJsWasmPath = (): string => { · 89 unmodified lines
9090 return wasmPath;
9191 };
9292
93+const resolvePGliteAssetPaths = (): {
94+ dataPath: string;
95+ wasmPath: string;
96+} => {
97+ const requireFromControlPlane = createRequire(
98+ join(repoRoot, "packages/control-plane/package.json"),
99+ );
100+ const pglitePackagePath = requireFromControlPlane.resolve(
101+ "@electric-sql/pglite/package.json",
102+ );
103+ const pgliteDistDir = join(dirname(pglitePackagePath), "dist");
104+ const dataPath = join(pgliteDistDir, "pglite.data");
105+ const wasmPath = join(pgliteDistDir, "pglite.wasm");
106+
107+ if (!existsSync(dataPath)) {
108+ throw new Error(`Unable to locate PGlite data asset at ${dataPath}`);
109+ }
110+
111+ if (!existsSync(wasmPath)) {
112+ throw new Error(`Unable to locate PGlite wasm asset at ${wasmPath}`);
113+ }
114+
115+ return {
116+ dataPath,
117+ wasmPath,
118+ };
119+};
120+
93121 const createPackageJson = (input: {
94122 packageName: string;
95123 packageVersion: string;
@@ -150,6 +178,7 @@ export const buildDistributionPackage = async ( · 54 unmodified lines
150178 const bundlePath = join(binDir, "executor.mjs");
151179 const launcherPath = join(binDir, "executor.js");
152180 const quickJsWasmPath = resolveQuickJsWasmPath();
181+ const pgliteAssets = resolvePGliteAssetPaths();
153182 const webDistDir = join(repoRoot, "apps/web/dist");
154183 const readmePath = join(repoRoot, "README.md");
155184 const packageName = options.packageName ?? defaults.name;
@@ -185,6 +214,8 @@ export const buildDistributionPackage = async ( · 29 unmodified lines
185214
186215 await cp(webDistDir, webDir, { recursive: true });
187216 await cp(quickJsWasmPath, join(binDir, "emscripten-module.wasm"));
217+ await cp(pgliteAssets.dataPath, join(binDir, "pglite.data"));
218+ await cp(pgliteAssets.wasmPath, join(binDir, "pglite.wasm"));
188219 await mkdir(join(binDir, "openapi-extractor-wasm"), { recursive: true });
189220 await cp(
190221 join(repoRoot, "packages/codemode-openapi/src/openapi-extractor-wasm/openapi_extractor_bg.wasm"),