@protobase/cli 0.3.0 → 0.3.2
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/build/bun-build.js +25 -0
- package/dist/build/vite-bundle.js +22 -3
- package/dist/package.js +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { promisify } from "node:util";
|
|
3
|
+
//#region src/build/bun-build.ts
|
|
4
|
+
const run = promisify(execFile);
|
|
5
|
+
const bunBuild = async (input, outFile) => {
|
|
6
|
+
try {
|
|
7
|
+
await run("bun", [
|
|
8
|
+
"build",
|
|
9
|
+
input,
|
|
10
|
+
"--target",
|
|
11
|
+
"bun",
|
|
12
|
+
"--format",
|
|
13
|
+
"esm",
|
|
14
|
+
"--packages",
|
|
15
|
+
"external",
|
|
16
|
+
"--outfile",
|
|
17
|
+
outFile
|
|
18
|
+
]);
|
|
19
|
+
} catch (error) {
|
|
20
|
+
if (error.code === "ENOENT") throw new Error("protobase build needs Bun to write the bundle, as the serve runtime runs it: install it from https://bun.sh and put `bun` on PATH");
|
|
21
|
+
throw error;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
//#endregion
|
|
25
|
+
export { bunBuild };
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { bunBuild } from "./bun-build.js";
|
|
1
2
|
import path from "node:path";
|
|
3
|
+
import { mkdtemp, rm } from "node:fs/promises";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
2
5
|
import { build } from "vite";
|
|
3
6
|
//#region src/build/vite-bundle.ts
|
|
4
|
-
const
|
|
7
|
+
const viteBuild = async ({ root, entry, outFile, plugins }) => {
|
|
5
8
|
await build({
|
|
6
9
|
configFile: false,
|
|
7
10
|
root,
|
|
@@ -25,12 +28,28 @@ const viteBundle = async ({ root, entry, outFile, plugins }) => {
|
|
|
25
28
|
output: {
|
|
26
29
|
entryFileNames: path.basename(outFile),
|
|
27
30
|
format: "es",
|
|
28
|
-
codeSplitting: false
|
|
29
|
-
banner: "// @bun"
|
|
31
|
+
codeSplitting: false
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
});
|
|
34
36
|
};
|
|
37
|
+
const viteBundle = async ({ root, entry, outFile, plugins }) => {
|
|
38
|
+
const scratch = await mkdtemp(path.join(tmpdir(), "protobase-bundle-"));
|
|
39
|
+
try {
|
|
40
|
+
await viteBuild({
|
|
41
|
+
root,
|
|
42
|
+
entry,
|
|
43
|
+
outFile: path.join(scratch, "bundle.js"),
|
|
44
|
+
plugins
|
|
45
|
+
});
|
|
46
|
+
await bunBuild(path.join(scratch, "bundle.js"), outFile);
|
|
47
|
+
} finally {
|
|
48
|
+
await rm(scratch, {
|
|
49
|
+
recursive: true,
|
|
50
|
+
force: true
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
};
|
|
35
54
|
//#endregion
|
|
36
55
|
export { viteBundle };
|
package/dist/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"tsx": "^4.23.15",
|
|
47
47
|
"vite": "^8.3.3",
|
|
48
48
|
"zod": "^4.6.5",
|
|
49
|
-
"@protobase/layout": "0.3.
|
|
50
|
-
"@protobase/
|
|
51
|
-
"@protobase/
|
|
52
|
-
"@protobase/ui": "0.3.
|
|
53
|
-
"@protobase/
|
|
49
|
+
"@protobase/layout": "0.3.2",
|
|
50
|
+
"@protobase/query": "0.3.2",
|
|
51
|
+
"@protobase/schema": "0.3.2",
|
|
52
|
+
"@protobase/ui": "0.3.2",
|
|
53
|
+
"@protobase/server": "0.3.2"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"build": "tsdown"
|