ai-wrapped 1.3.0 → 1.3.1
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/cli.ts +23 -0
- package/package.json +1 -1
package/bin/cli.ts
CHANGED
|
@@ -29,12 +29,35 @@ async function getPackageVersion(): Promise<string> {
|
|
|
29
29
|
return pkg.version;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
async function ensureRuntimeBuildDependencies(): Promise<void> {
|
|
33
|
+
const electrobunPkg = Bun.file(
|
|
34
|
+
join(PKG_ROOT, "node_modules", "electrobun", "package.json"),
|
|
35
|
+
);
|
|
36
|
+
if (await electrobunPkg.exists()) return;
|
|
37
|
+
|
|
38
|
+
// bunx extracts ai-wrapped without node_modules, but electrobun expects
|
|
39
|
+
// ./node_modules/electrobun relative to the app root when building.
|
|
40
|
+
console.log(" Installing build dependencies...\n");
|
|
41
|
+
const proc = Bun.spawn([process.execPath, "install", "--production"], {
|
|
42
|
+
cwd: PKG_ROOT,
|
|
43
|
+
stdout: "inherit",
|
|
44
|
+
stderr: "inherit",
|
|
45
|
+
env: { ...process.env },
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const exitCode = await proc.exited;
|
|
49
|
+
if (exitCode !== 0) {
|
|
50
|
+
throw new Error(`Dependency install failed with exit code ${exitCode}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
32
54
|
async function buildApp(): Promise<string> {
|
|
33
55
|
const platform = process.platform;
|
|
34
56
|
const arch = process.arch;
|
|
35
57
|
|
|
36
58
|
// Electrobun build needs to run from the package root
|
|
37
59
|
console.log(" Building app (first run only)...\n");
|
|
60
|
+
await ensureRuntimeBuildDependencies();
|
|
38
61
|
|
|
39
62
|
// Run electrobun build from the package directory
|
|
40
63
|
const proc = Bun.spawn(["bunx", "electrobun", "build"], {
|