Skip to content

Commit 329cc41

Browse files
committed
fix migration
1 parent 8f435d9 commit 329cc41

3 files changed

Lines changed: 36 additions & 72 deletions

File tree

‎.changeset/brave-baths-itch.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"executor": minor
3+
---
4+
5+
fix migration

‎.executor/executor.jsonc‎

Lines changed: 0 additions & 72 deletions
This file was deleted.

‎apps/executor/src/distribution/artifact.ts‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,34 @@ const resolveQuickJsWasmPath = (): string => {
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 (
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 (
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"),

0 commit comments

Comments
 (0)