@vantail/cli 0.1.0
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/args.d.ts +16 -0
- package/dist/args.d.ts.map +1 -0
- package/dist/args.js +86 -0
- package/dist/args.js.map +1 -0
- package/dist/bin.d.ts +9 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +170 -0
- package/dist/bin.js.map +1 -0
- package/dist/bundle/archive.d.ts +25 -0
- package/dist/bundle/archive.d.ts.map +1 -0
- package/dist/bundle/archive.js +187 -0
- package/dist/bundle/archive.js.map +1 -0
- package/dist/bundle/common.d.ts +33 -0
- package/dist/bundle/common.d.ts.map +1 -0
- package/dist/bundle/common.js +22 -0
- package/dist/bundle/common.js.map +1 -0
- package/dist/bundle/index.d.ts +12 -0
- package/dist/bundle/index.d.ts.map +1 -0
- package/dist/bundle/index.js +47 -0
- package/dist/bundle/index.js.map +1 -0
- package/dist/bundle/macos.d.ts +19 -0
- package/dist/bundle/macos.d.ts.map +1 -0
- package/dist/bundle/macos.js +138 -0
- package/dist/bundle/macos.js.map +1 -0
- package/dist/commands/build.d.ts +21 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +57 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/dev.d.ts +17 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/dev.js +170 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/doctor.d.ts +12 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +164 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/package.d.ts +25 -0
- package/dist/commands/package.d.ts.map +1 -0
- package/dist/commands/package.js +144 -0
- package/dist/commands/package.js.map +1 -0
- package/dist/commands/updater.d.ts +46 -0
- package/dist/commands/updater.d.ts.map +1 -0
- package/dist/commands/updater.js +116 -0
- package/dist/commands/updater.js.map +1 -0
- package/dist/icons/index.d.ts +23 -0
- package/dist/icons/index.d.ts.map +1 -0
- package/dist/icons/index.js +124 -0
- package/dist/icons/index.js.map +1 -0
- package/dist/icons/png.d.ts +18 -0
- package/dist/icons/png.d.ts.map +1 -0
- package/dist/icons/png.js +220 -0
- package/dist/icons/png.js.map +1 -0
- package/dist/icons/resize.d.ts +14 -0
- package/dist/icons/resize.d.ts.map +1 -0
- package/dist/icons/resize.js +58 -0
- package/dist/icons/resize.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/installers/common.d.ts +20 -0
- package/dist/installers/common.d.ts.map +1 -0
- package/dist/installers/common.js +2 -0
- package/dist/installers/common.js.map +1 -0
- package/dist/installers/deb.d.ts +15 -0
- package/dist/installers/deb.d.ts.map +1 -0
- package/dist/installers/deb.js +146 -0
- package/dist/installers/deb.js.map +1 -0
- package/dist/installers/dmg.d.ts +11 -0
- package/dist/installers/dmg.d.ts.map +1 -0
- package/dist/installers/dmg.js +51 -0
- package/dist/installers/dmg.js.map +1 -0
- package/dist/installers/index.d.ts +14 -0
- package/dist/installers/index.d.ts.map +1 -0
- package/dist/installers/index.js +26 -0
- package/dist/installers/index.js.map +1 -0
- package/dist/installers/msi.d.ts +23 -0
- package/dist/installers/msi.d.ts.map +1 -0
- package/dist/installers/msi.js +199 -0
- package/dist/installers/msi.js.map +1 -0
- package/dist/log.d.ts +22 -0
- package/dist/log.d.ts.map +1 -0
- package/dist/log.js +44 -0
- package/dist/log.js.map +1 -0
- package/dist/runtime-config.d.ts +27 -0
- package/dist/runtime-config.d.ts.map +1 -0
- package/dist/runtime-config.js +79 -0
- package/dist/runtime-config.js.map +1 -0
- package/dist/updater-keys.d.ts +31 -0
- package/dist/updater-keys.d.ts.map +1 -0
- package/dist/updater-keys.js +56 -0
- package/dist/updater-keys.js.map +1 -0
- package/dist/vite.d.ts +24 -0
- package/dist/vite.d.ts.map +1 -0
- package/dist/vite.js +31 -0
- package/dist/vite.js.map +1 -0
- package/package.json +40 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Assembling a distributable application.
|
|
3
|
+
*
|
|
4
|
+
* Three ingredients, always the same three: the precompiled runtime, the
|
|
5
|
+
* generated `vantail.json`, and the built web assets. Where they go is the
|
|
6
|
+
* only thing that differs per platform, and the runtime already knows how to
|
|
7
|
+
* find its config in either layout.
|
|
8
|
+
*/
|
|
9
|
+
import { chmod, cp, mkdir, rm, writeFile } from "node:fs/promises";
|
|
10
|
+
import { join } from "node:path";
|
|
11
|
+
import { writeRuntimeConfig } from "../runtime-config.js";
|
|
12
|
+
import { safeName } from "./common.js";
|
|
13
|
+
import { writeMacBundle } from "./macos.js";
|
|
14
|
+
export * from "./common.js";
|
|
15
|
+
export async function bundle(input) {
|
|
16
|
+
await mkdir(input.outDir, { recursive: true });
|
|
17
|
+
return input.platform === "darwin" ? writeMacBundle(input) : writePortable(input);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Windows and Linux: a folder with the executable at the top and everything
|
|
21
|
+
* else in `resources/`, which is the second place the runtime looks.
|
|
22
|
+
*/
|
|
23
|
+
async function writePortable(input) {
|
|
24
|
+
const name = safeName(input.config.app.name);
|
|
25
|
+
const root = join(input.outDir, name);
|
|
26
|
+
const executable = join(root, input.platform === "win32" ? `${name}.exe` : name);
|
|
27
|
+
const resources = join(root, "resources");
|
|
28
|
+
await rm(root, { recursive: true, force: true });
|
|
29
|
+
await mkdir(resources, { recursive: true });
|
|
30
|
+
await cp(input.runtimePath, executable);
|
|
31
|
+
await chmod(executable, 0o755);
|
|
32
|
+
await cp(input.distDir, join(resources, "dist"), { recursive: true });
|
|
33
|
+
// Windows and Linux take the window icon from a file at runtime; macOS
|
|
34
|
+
// reads it from the bundle instead.
|
|
35
|
+
if (input.icons) {
|
|
36
|
+
await writeFile(join(resources, "icon.png"), input.icons.png.get(256));
|
|
37
|
+
await writeFile(join(resources, "icon.ico"), input.icons.ico);
|
|
38
|
+
}
|
|
39
|
+
await writeRuntimeConfig(join(resources, "vantail.json"), {
|
|
40
|
+
config: input.config,
|
|
41
|
+
root: input.root,
|
|
42
|
+
distDir: "dist",
|
|
43
|
+
...(input.icons ? { icon: "../icon.png" } : {}),
|
|
44
|
+
});
|
|
45
|
+
return { path: root, kind: "portable" };
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bundle/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAuC,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,cAAc,aAAa,CAAC;AAE5B,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,KAAkB;IAC7C,MAAM,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAE/C,OAAO,KAAK,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AACpF,CAAC;AAED;;;GAGG;AACH,KAAK,UAAU,aAAa,CAAC,KAAkB;IAC7C,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACtC,MA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AC,CAAC,EAAE,CAAC;KAChD,CAAC,CAAC;IAEH,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The macOS `.app` bundle.
|
|
3
|
+
*
|
|
4
|
+
* ```text
|
|
5
|
+
* My App.app/
|
|
6
|
+
* Contents/
|
|
7
|
+
* Info.plist
|
|
8
|
+
* MacOS/My-App <- the runtime binary
|
|
9
|
+
* Resources/
|
|
10
|
+
* vantail.json
|
|
11
|
+
* dist/...
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* The runtime finds its config at `../Resources/vantail.json` relative to its
|
|
15
|
+
* own executable, so nothing here needs to be passed on a command line.
|
|
16
|
+
*/
|
|
17
|
+
import { type BundleInput, type BundleResult } from "./common.js";
|
|
18
|
+
export declare function writeMacBundle(input: BundleInput): Promise<BundleResult>;
|
|
19
|
+
//# sourceMappingURL=macos.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"macos.d.ts","sourceRoot":"","sources":["../../src/bundle/macos.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAOH,OAAO,EAAY,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAE5E,wBAAsB,cAAc,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,CAkC9E"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The macOS `.app` bundle.
|
|
3
|
+
*
|
|
4
|
+
* ```text
|
|
5
|
+
* My App.app/
|
|
6
|
+
* Contents/
|
|
7
|
+
* Info.plist
|
|
8
|
+
* MacOS/My-App <- the runtime binary
|
|
9
|
+
* Resources/
|
|
10
|
+
* vantail.json
|
|
11
|
+
* dist/...
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* The runtime finds its config at `../Resources/vantail.json` relative to its
|
|
15
|
+
* own executable, so nothing here needs to be passed on a command line.
|
|
16
|
+
*/
|
|
17
|
+
import { chmod, cp, mkdir, rm, writeFile } from "node:fs/promises";
|
|
18
|
+
import { join } from "node:path";
|
|
19
|
+
import { log } from "../log.js";
|
|
20
|
+
import { writeRuntimeConfig } from "../runtime-config.js";
|
|
21
|
+
import { safeName } from "./common.js";
|
|
22
|
+
export async function writeMacBundle(input) {
|
|
23
|
+
const displayName = input.config.app.name;
|
|
24
|
+
const executableName = safeName(displayName);
|
|
25
|
+
const app = join(input.outDir, `${displayName}.app`);
|
|
26
|
+
const contents = join(app, "Contents");
|
|
27
|
+
const macos = join(contents, "MacOS");
|
|
28
|
+
const resources = join(contents, "Resources");
|
|
29
|
+
await rm(app, { recursive: true, force: true });
|
|
30
|
+
await mkdir(macos, { recursive: true });
|
|
31
|
+
await mkdir(resources, { recursive: true });
|
|
32
|
+
const executable = join(macos, executableName);
|
|
33
|
+
await cp(input.runtimePath, executable);
|
|
34
|
+
await chmod(executable, 0o755);
|
|
35
|
+
await cp(input.distDir, join(resources, "dist"), { recursive: true });
|
|
36
|
+
if (input.icons) {
|
|
37
|
+
await writeFile(join(resources, "icon.icns"), input.icons.icns);
|
|
38
|
+
}
|
|
39
|
+
await writeRuntimeConfig(join(resources, "vantail.json"), {
|
|
40
|
+
config: input.config,
|
|
41
|
+
root: input.root,
|
|
42
|
+
distDir: "dist",
|
|
43
|
+
});
|
|
44
|
+
await writeFile(join(contents, "Info.plist"), infoPlist(input, executableName), "utf8");
|
|
45
|
+
await sign(app, input.sign);
|
|
46
|
+
return { path: app, kind: "app" };
|
|
47
|
+
}
|
|
48
|
+
function infoPlist(input, executableName) {
|
|
49
|
+
const { app } = input.config;
|
|
50
|
+
const version = app.version ?? "0.0.0";
|
|
51
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
52
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
53
|
+
<plist version="1.0">
|
|
54
|
+
<dict>
|
|
55
|
+
<key>CFBundleName</key>
|
|
56
|
+
<string>${escapeXml(app.name)}</string>
|
|
57
|
+
<key>CFBundleDisplayName</key>
|
|
58
|
+
<string>${escapeXml(app.name)}</string>
|
|
59
|
+
<key>CFBundleIdentifier</key>
|
|
60
|
+
<string>${escapeXml(app.identifier)}</string>
|
|
61
|
+
<key>CFBundleExecutable</key>
|
|
62
|
+
<string>${escapeXml(executableName)}</string>
|
|
63
|
+
<key>CFBundleVersion</key>
|
|
64
|
+
<string>${escapeXml(version)}</string>
|
|
65
|
+
<key>CFBundleShortVersionString</key>
|
|
66
|
+
<string>${escapeXml(version)}</string>
|
|
67
|
+
<key>CFBundlePackageType</key>
|
|
68
|
+
<string>APPL</string>${input.icons
|
|
69
|
+
? `
|
|
70
|
+
<key>CFBundleIconFile</key>
|
|
71
|
+
<string>icon</string>`
|
|
72
|
+
: ""}
|
|
73
|
+
<key>CFBundleInfoDictionaryVersion</key>
|
|
74
|
+
<string>6.0</string>
|
|
75
|
+
<key>LSMinimumSystemVersion</key>
|
|
76
|
+
<string>10.15</string>
|
|
77
|
+
<key>NSHighResolutionCapable</key>
|
|
78
|
+
<true/>${urlTypes(input)}
|
|
79
|
+
</dict>
|
|
80
|
+
</plist>
|
|
81
|
+
`;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Sign the bundle. An ad-hoc signature (`-`) is enough for the app to launch
|
|
85
|
+
* on the machine that built it, which is what `vantail package` is for.
|
|
86
|
+
* Shipping to other people needs a Developer ID identity and notarisation.
|
|
87
|
+
*/
|
|
88
|
+
async function sign(app, identity) {
|
|
89
|
+
const chosen = identity ?? "-";
|
|
90
|
+
const { spawn } = await import("node:child_process");
|
|
91
|
+
const code = await new Promise((resolve) => {
|
|
92
|
+
const child = spawn("codesign", ["--force", "--sign", chosen, app], { stdio: "pipe" });
|
|
93
|
+
child.once("error", () => resolve(-1));
|
|
94
|
+
child.once("exit", (status) => resolve(status ?? -1));
|
|
95
|
+
});
|
|
96
|
+
if (code === 0)
|
|
97
|
+
return;
|
|
98
|
+
if (identity) {
|
|
99
|
+
throw new Error(`codesign failed for identity "${identity}".`);
|
|
100
|
+
}
|
|
101
|
+
log.warn("could not apply an ad-hoc signature; the bundle may not launch on this Mac");
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Register the application's URL schemes.
|
|
105
|
+
*
|
|
106
|
+
* macOS reads these from the bundle, so `myapp://` only works once the app is
|
|
107
|
+
* packaged - during `vantail dev` there is no bundle to register.
|
|
108
|
+
*/
|
|
109
|
+
function urlTypes(input) {
|
|
110
|
+
const protocols = input.config.protocols ?? [];
|
|
111
|
+
if (protocols.length === 0)
|
|
112
|
+
return "";
|
|
113
|
+
const schemes = protocols
|
|
114
|
+
.map((protocol) => ` <string>${escapeXml(protocol)}</string>`)
|
|
115
|
+
.join("\n");
|
|
116
|
+
return `
|
|
117
|
+
<key>CFBundleURLTypes</key>
|
|
118
|
+
<array>
|
|
119
|
+
<dict>
|
|
120
|
+
<key>CFBundleURLName</key>
|
|
121
|
+
<string>${escapeXml(input.config.app.identifier)}</string>
|
|
122
|
+
<key>CFBundleTypeRole</key>
|
|
123
|
+
<string>Viewer</string>
|
|
124
|
+
<key>CFBundleURLSchemes</key>
|
|
125
|
+
<array>
|
|
126
|
+
${schemes}
|
|
127
|
+
</array>
|
|
128
|
+
</dict>
|
|
129
|
+
</array>`;
|
|
130
|
+
}
|
|
131
|
+
function escapeXml(value) {
|
|
132
|
+
return value
|
|
133
|
+
.replace(/&/g, "&")
|
|
134
|
+
.replace(/</g, "<")
|
|
135
|
+
.replace(/>/g, ">")
|
|
136
|
+
.replace(/"/g, """);
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=macos.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"macos.js","sourceRoot":"","sources":["../../src/bundle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CAAC,QAAQ,EAAE,EAAE,CAAC,mBAAmB,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC;SACpE,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,OAAO;;;;;gBAKO,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC;;;;;EAKpD,OAAO;;;WAGE,CAAC;AACZ,CAAC;AAED,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,KAAK;SACT,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `vantail build`
|
|
3
|
+
*
|
|
4
|
+
* Build the web assets. That is all this does - turning them into something
|
|
5
|
+
* double-clickable is `vantail package`, so a CI job can do one without the
|
|
6
|
+
* other.
|
|
7
|
+
*/
|
|
8
|
+
import { type ProjectContext } from "../vite.js";
|
|
9
|
+
export interface BuildOptions {
|
|
10
|
+
cwd: string;
|
|
11
|
+
config?: string;
|
|
12
|
+
mode?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface BuildResult {
|
|
15
|
+
project: ProjectContext;
|
|
16
|
+
/** Absolute path to the built assets. */
|
|
17
|
+
distDir: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function build(options: BuildOptions): Promise<BuildResult>;
|
|
20
|
+
export declare function resolveDist(project: ProjectContext): string;
|
|
21
|
+
//# sourceMappingURL=build.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,OAAO,EAA4B,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAE3E,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,cAAc,CAAC;IACxB,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAsB,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAuBvE;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,CAG3D"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `vantail build`
|
|
3
|
+
*
|
|
4
|
+
* Build the web assets. That is all this does - turning them into something
|
|
5
|
+
* double-clickable is `vantail package`, so a CI job can do one without the
|
|
6
|
+
* other.
|
|
7
|
+
*/
|
|
8
|
+
import { readdir, stat } from "node:fs/promises";
|
|
9
|
+
import { isAbsolute, relative, resolve } from "node:path";
|
|
10
|
+
import { loadConfig } from "@vantail/shared/load";
|
|
11
|
+
import { formatBytes, log, style } from "../log.js";
|
|
12
|
+
import { importVite, inlineConfig } from "../vite.js";
|
|
13
|
+
export async function build(options) {
|
|
14
|
+
const loaded = await loadConfig({
|
|
15
|
+
cwd: options.cwd,
|
|
16
|
+
...(options.config ? { path: options.config } : {}),
|
|
17
|
+
});
|
|
18
|
+
const project = {
|
|
19
|
+
config: loaded.config,
|
|
20
|
+
root: loaded.root,
|
|
21
|
+
configPath: loaded.path,
|
|
22
|
+
};
|
|
23
|
+
const vite = await importVite(project.root);
|
|
24
|
+
log.info(`building ${style.bold(project.config.app.name)}`);
|
|
25
|
+
await vite.build(await inlineConfig(project, options.mode ? { mode: options.mode } : {}));
|
|
26
|
+
const distDir = resolveDist(project);
|
|
27
|
+
const size = await directorySize(distDir);
|
|
28
|
+
log.ok(`${relative(project.root, distDir) || "."} ${style.dim(formatBytes(size))}`);
|
|
29
|
+
return { project, distDir };
|
|
30
|
+
}
|
|
31
|
+
export function resolveDist(project) {
|
|
32
|
+
const distDir = project.config.distDir ?? "dist";
|
|
33
|
+
return isAbsolute(distDir) ? distDir : resolve(project.root, distDir);
|
|
34
|
+
}
|
|
35
|
+
async function directorySize(path) {
|
|
36
|
+
let total = 0;
|
|
37
|
+
const walk = async (directory) => {
|
|
38
|
+
const entries = await readdir(directory, { withFileTypes: true });
|
|
39
|
+
for (const entry of entries) {
|
|
40
|
+
const child = resolve(directory, entry.name);
|
|
41
|
+
if (entry.isDirectory()) {
|
|
42
|
+
await walk(child);
|
|
43
|
+
}
|
|
44
|
+
else if (entry.isFile()) {
|
|
45
|
+
total += (await stat(child)).size;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
try {
|
|
50
|
+
await walk(path);
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return 0;
|
|
54
|
+
}
|
|
55
|
+
return total;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAuB,MAAM,YAAY,CAAC;AAc3E,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,OAAqB;IAC/C,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC;QAC9B,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,GAAG,CAAC,OAAO,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O,CAAC,CAAC;AACxE,CAAC;AAED,KAAK,UAAU,aAAa,CAAC,IAAY;IACvC,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,MAAM,IAAI,GAAG,KAAK,EAAE,SAAiB,EAAiB,EAAE;QACtD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,SAAS,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;QAClE,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC5B,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;YAC7C,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;gBACxB,MAAM,IAAI,CAAC,KAAK,CAAC,CAAC;YACpB,CAAC;iBAAM,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;gBAC1B,KAAK,IAAI,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;YACpC,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IAEF,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,CAAC;IACX,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `vantail dev`
|
|
3
|
+
*
|
|
4
|
+
* Start Vite, point a native window at it, and keep the two alive together.
|
|
5
|
+
* Closing the window stops the server; stopping the CLI closes the window.
|
|
6
|
+
*
|
|
7
|
+
* The window is a real webview against a real dev server, so HMR, React
|
|
8
|
+
* Refresh, source maps and devtools all work exactly as they do in a browser.
|
|
9
|
+
*/
|
|
10
|
+
export interface DevOptions {
|
|
11
|
+
cwd: string;
|
|
12
|
+
config?: string;
|
|
13
|
+
port?: number;
|
|
14
|
+
host?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function dev(options: DevOptions): Promise<number>;
|
|
17
|
+
//# sourceMappingURL=dev.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAcH,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAsB,GAAG,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CA4I9D"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `vantail dev`
|
|
3
|
+
*
|
|
4
|
+
* Start Vite, point a native window at it, and keep the two alive together.
|
|
5
|
+
* Closing the window stops the server; stopping the CLI closes the window.
|
|
6
|
+
*
|
|
7
|
+
* The window is a real webview against a real dev server, so HMR, React
|
|
8
|
+
* Refresh, source maps and devtools all work exactly as they do in a browser.
|
|
9
|
+
*/
|
|
10
|
+
import { spawn } from "node:child_process";
|
|
11
|
+
import { watch } from "node:fs";
|
|
12
|
+
import { rm } from "node:fs/promises";
|
|
13
|
+
import { basename, dirname } from "node:path";
|
|
14
|
+
import { resolveRuntimeBinary } from "@vantail/runtime";
|
|
15
|
+
import { loadConfig } from "@vantail/shared/load";
|
|
16
|
+
import { log, style } from "../log.js";
|
|
17
|
+
import { devConfigPath, writeRuntimeConfig } from "../runtime-config.js";
|
|
18
|
+
import { importVite, inlineConfig } from "../vite.js";
|
|
19
|
+
export async function dev(options) {
|
|
20
|
+
const loaded = await loadConfig({
|
|
21
|
+
cwd: options.cwd,
|
|
22
|
+
...(options.config ? { path: options.config } : {}),
|
|
23
|
+
});
|
|
24
|
+
let project = {
|
|
25
|
+
config: loaded.config,
|
|
26
|
+
root: loaded.root,
|
|
27
|
+
configPath: loaded.path,
|
|
28
|
+
};
|
|
29
|
+
// Fail before starting Vite if there is no runtime to start.
|
|
30
|
+
const runtime = resolveRuntimeBinary({ cwd: project.root });
|
|
31
|
+
const vite = await importVite(project.root);
|
|
32
|
+
const server = await vite.createServer(await inlineConfig(project, {
|
|
33
|
+
server: {
|
|
34
|
+
...(options.port !== undefined ? { port: options.port } : {}),
|
|
35
|
+
...(options.host !== undefined ? { host: options.host } : {}),
|
|
36
|
+
},
|
|
37
|
+
}));
|
|
38
|
+
await server.listen();
|
|
39
|
+
const url = server.resolvedUrls?.local?.[0];
|
|
40
|
+
if (!url) {
|
|
41
|
+
await server.close();
|
|
42
|
+
throw new Error("Vite started but reported no local URL to open.");
|
|
43
|
+
}
|
|
44
|
+
const version = project.config.app.version;
|
|
45
|
+
log.info(`${style.bold(project.config.app.name)}${version ? style.dim(` ${version}`) : ""}`);
|
|
46
|
+
log.step(`vite ${url}`);
|
|
47
|
+
log.step(`runtime ${runtime.path}${runtime.source === "workspace" ? " (local build)" : ""}`);
|
|
48
|
+
log.blank();
|
|
49
|
+
const configPath = devConfigPath(project.root);
|
|
50
|
+
let child;
|
|
51
|
+
let watcher;
|
|
52
|
+
let restarting = false;
|
|
53
|
+
let stopping = false;
|
|
54
|
+
let settle = () => { };
|
|
55
|
+
const finish = (code) => {
|
|
56
|
+
if (stopping)
|
|
57
|
+
return;
|
|
58
|
+
stopping = true;
|
|
59
|
+
watcher?.close();
|
|
60
|
+
void (async () => {
|
|
61
|
+
await stopRuntime();
|
|
62
|
+
await server.close();
|
|
63
|
+
await rm(configPath, { force: true });
|
|
64
|
+
settle(code);
|
|
65
|
+
})();
|
|
66
|
+
};
|
|
67
|
+
const stopRuntime = () => new Promise((resolve) => {
|
|
68
|
+
const running = child;
|
|
69
|
+
if (!running || running.exitCode !== null || running.signalCode !== null)
|
|
70
|
+
return resolve();
|
|
71
|
+
let done = false;
|
|
72
|
+
const settled = () => {
|
|
73
|
+
if (done)
|
|
74
|
+
return;
|
|
75
|
+
done = true;
|
|
76
|
+
clearTimeout(timer);
|
|
77
|
+
resolve();
|
|
78
|
+
};
|
|
79
|
+
running.once("exit", settled);
|
|
80
|
+
running.kill("SIGTERM");
|
|
81
|
+
// If the window has not gone in a second, insist.
|
|
82
|
+
const timer = setTimeout(() => {
|
|
83
|
+
running.kill("SIGKILL");
|
|
84
|
+
settled();
|
|
85
|
+
}, 1000);
|
|
86
|
+
timer.unref();
|
|
87
|
+
});
|
|
88
|
+
const startRuntime = async () => {
|
|
89
|
+
await writeRuntimeConfig(configPath, {
|
|
90
|
+
config: project.config,
|
|
91
|
+
root: project.root,
|
|
92
|
+
devUrl: url,
|
|
93
|
+
});
|
|
94
|
+
const started = spawn(runtime.path, ["--config", configPath], {
|
|
95
|
+
cwd: project.root,
|
|
96
|
+
stdio: "inherit",
|
|
97
|
+
env: { ...process.env, VANTAIL_DEV: "1" },
|
|
98
|
+
});
|
|
99
|
+
child = started;
|
|
100
|
+
started.once("exit", (code, signal) => {
|
|
101
|
+
if (restarting || stopping)
|
|
102
|
+
return;
|
|
103
|
+
// A window the user closed is a clean exit, not a failure.
|
|
104
|
+
finish(signal ? 0 : (code ?? 0));
|
|
105
|
+
});
|
|
106
|
+
started.once("error", (error) => {
|
|
107
|
+
log.error(`Could not start the runtime: ${error.message}`);
|
|
108
|
+
finish(1);
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
// Window size, permissions and app identity are all read once at startup,
|
|
112
|
+
// so a config change means a new window rather than a hot update.
|
|
113
|
+
watcher = watchFile(project.configPath, async () => {
|
|
114
|
+
if (stopping || restarting)
|
|
115
|
+
return;
|
|
116
|
+
restarting = true;
|
|
117
|
+
try {
|
|
118
|
+
const reloaded = await loadConfig({ cwd: project.root, path: project.configPath });
|
|
119
|
+
project = { config: reloaded.config, root: reloaded.root, configPath: reloaded.path };
|
|
120
|
+
log.info("config changed, reopening the window");
|
|
121
|
+
await stopRuntime();
|
|
122
|
+
await startRuntime();
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
log.error(error instanceof Error ? error.message : String(error));
|
|
126
|
+
log.warn("keeping the current window - fix the config and save again");
|
|
127
|
+
}
|
|
128
|
+
finally {
|
|
129
|
+
restarting = false;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
const onSignal = () => finish(0);
|
|
133
|
+
try {
|
|
134
|
+
const code = await new Promise((resolve) => {
|
|
135
|
+
// Registered inside the executor so `settle` is already in place: a
|
|
136
|
+
// Ctrl-C landing between the two would otherwise resolve nothing.
|
|
137
|
+
settle = resolve;
|
|
138
|
+
process.once("SIGINT", onSignal);
|
|
139
|
+
process.once("SIGTERM", onSignal);
|
|
140
|
+
void startRuntime();
|
|
141
|
+
});
|
|
142
|
+
return code;
|
|
143
|
+
}
|
|
144
|
+
finally {
|
|
145
|
+
process.off("SIGINT", onSignal);
|
|
146
|
+
process.off("SIGTERM", onSignal);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Watch a single file across editors. Many save by replacing the file, which
|
|
151
|
+
* breaks a watch on the file itself, so watch its directory instead.
|
|
152
|
+
*/
|
|
153
|
+
function watchFile(path, onChange) {
|
|
154
|
+
const name = basename(path);
|
|
155
|
+
try {
|
|
156
|
+
let timer;
|
|
157
|
+
return watch(dirname(path), (_event, changed) => {
|
|
158
|
+
if (changed !== name)
|
|
159
|
+
return;
|
|
160
|
+
// One save often produces several events.
|
|
161
|
+
clearTimeout(timer);
|
|
162
|
+
timer = setTimeout(onChange, 50);
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
// Watching is a convenience; a platform without it still runs fine.
|
|
167
|
+
return undefined;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=dev.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAA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QAAQ,CAAC,CAAC;QAChC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACnC,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAS,SAAS,CAAC,IAAY,EAAE,QAAoB;IACnD,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,CAAC;QACH,IAAI,KAAiC,CAAC;QACtC,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE;YAC9C,IAAI,OAAO,KAAK,IAAI;gBAAE,OAAO;YAC7B,0CAA0C;YAC1C,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,KAAK,GAAG,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACP,oEAAoE;QACpE,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `vantail doctor`
|
|
3
|
+
*
|
|
4
|
+
* Answers the only question that matters when something will not start:
|
|
5
|
+
* which of the four moving parts is missing.
|
|
6
|
+
*/
|
|
7
|
+
export interface DoctorOptions {
|
|
8
|
+
cwd: string;
|
|
9
|
+
config?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function doctor(options: DoctorOptions): Promise<number>;
|
|
12
|
+
//# sourceMappingURL=doctor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAgBH,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAsB,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAwBpE"}
|