@flowmetelev/wfkit 1.2.1 → 1.2.3
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/README.md +6 -0
- package/bin/wfkit.js +28 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,6 +22,12 @@ npm install -g @flowmetelev/wfkit
|
|
|
22
22
|
|
|
23
23
|
If your package manager blocks `postinstall` scripts, the `wfkit` launcher will download the native binary automatically on first run.
|
|
24
24
|
|
|
25
|
+
If you are developing `wfkit` itself and need a generated project to use your local unreleased binary instead of the latest published release, set `WFKIT_BINARY_PATH` before running package scripts:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
WFKIT_BINARY_PATH=/absolute/path/to/bin/wfkit bun run dev
|
|
29
|
+
```
|
|
30
|
+
|
|
25
31
|
## Quick start
|
|
26
32
|
|
|
27
33
|
Create a project:
|
package/bin/wfkit.js
CHANGED
|
@@ -9,8 +9,26 @@ const platform = process.platform;
|
|
|
9
9
|
const binaryName = platform === "win32" ? "wfkit.exe" : "wfkit";
|
|
10
10
|
const binaryPath = join(__dirname, binaryName);
|
|
11
11
|
|
|
12
|
+
function resolveBinaryPath() {
|
|
13
|
+
const overridePath = process.env.WFKIT_BINARY_PATH;
|
|
14
|
+
if (!overridePath) {
|
|
15
|
+
return binaryPath;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return overridePath;
|
|
19
|
+
}
|
|
20
|
+
|
|
12
21
|
async function main() {
|
|
13
|
-
|
|
22
|
+
const resolvedBinaryPath = resolveBinaryPath();
|
|
23
|
+
|
|
24
|
+
if (process.env.WFKIT_BINARY_PATH && !existsSync(resolvedBinaryPath)) {
|
|
25
|
+
console.error(
|
|
26
|
+
`WFKIT_BINARY_PATH points to a missing binary: ${resolvedBinaryPath}`,
|
|
27
|
+
);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (!process.env.WFKIT_BINARY_PATH && !existsSync(resolvedBinaryPath)) {
|
|
14
32
|
console.warn("wfkit binary is missing. Attempting to download it now.");
|
|
15
33
|
|
|
16
34
|
try {
|
|
@@ -23,7 +41,7 @@ async function main() {
|
|
|
23
41
|
}
|
|
24
42
|
}
|
|
25
43
|
|
|
26
|
-
const result = spawnSync(
|
|
44
|
+
const result = spawnSync(resolvedBinaryPath, process.argv.slice(2), {
|
|
27
45
|
stdio: "inherit",
|
|
28
46
|
});
|
|
29
47
|
|
|
@@ -35,4 +53,11 @@ async function main() {
|
|
|
35
53
|
process.exit(result.status === null ? 1 : result.status);
|
|
36
54
|
}
|
|
37
55
|
|
|
38
|
-
|
|
56
|
+
module.exports = {
|
|
57
|
+
binaryPath,
|
|
58
|
+
resolveBinaryPath,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
if (require.main === module) {
|
|
62
|
+
main();
|
|
63
|
+
}
|