@bb-labs/bldr 0.0.13 → 0.0.14
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/utils/process.d.ts +1 -2
- package/dist/utils/process.js +3 -27
- package/package.json +1 -1
package/dist/utils/process.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { type ChildProcess } from "node:child_process";
|
|
2
2
|
/**
|
|
3
3
|
* Checks if required dependencies (tsc, tsc-alias) are available.
|
|
4
|
-
* If not,
|
|
5
|
-
* Returns true if dependencies are available, false if user declined to install.
|
|
4
|
+
* If not, automatically installs them.
|
|
6
5
|
*/
|
|
7
6
|
export declare function checkDependencies(): Promise<boolean>;
|
|
8
7
|
/**
|
package/dist/utils/process.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { spawn, spawnSync } from "node:child_process";
|
|
2
|
-
import * as readline from "node:readline";
|
|
3
2
|
/**
|
|
4
3
|
* Checks if a command is available in the PATH.
|
|
5
4
|
*/
|
|
@@ -7,23 +6,6 @@ function commandExists(cmd) {
|
|
|
7
6
|
const result = spawnSync("which", [cmd], { stdio: "pipe" });
|
|
8
7
|
return result.status === 0;
|
|
9
8
|
}
|
|
10
|
-
/**
|
|
11
|
-
* Prompts the user for yes/no input. Defaults to yes on empty input.
|
|
12
|
-
*/
|
|
13
|
-
async function promptYesNo(question) {
|
|
14
|
-
const rl = readline.createInterface({
|
|
15
|
-
input: process.stdin,
|
|
16
|
-
output: process.stdout,
|
|
17
|
-
});
|
|
18
|
-
return new Promise((resolve) => {
|
|
19
|
-
rl.question(`${question} [Y/n]: `, (answer) => {
|
|
20
|
-
rl.close();
|
|
21
|
-
const normalized = answer.trim().toLowerCase();
|
|
22
|
-
// Empty or 'y' or 'yes' = true, anything else = false
|
|
23
|
-
resolve(normalized === "" || normalized === "y" || normalized === "yes");
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
9
|
/**
|
|
28
10
|
* Installs missing dependencies using bun.
|
|
29
11
|
*/
|
|
@@ -50,8 +32,7 @@ async function installDeps(deps) {
|
|
|
50
32
|
}
|
|
51
33
|
/**
|
|
52
34
|
* Checks if required dependencies (tsc, tsc-alias) are available.
|
|
53
|
-
* If not,
|
|
54
|
-
* Returns true if dependencies are available, false if user declined to install.
|
|
35
|
+
* If not, automatically installs them.
|
|
55
36
|
*/
|
|
56
37
|
export async function checkDependencies() {
|
|
57
38
|
const missing = [];
|
|
@@ -65,13 +46,8 @@ export async function checkDependencies() {
|
|
|
65
46
|
return true;
|
|
66
47
|
}
|
|
67
48
|
console.log(`\n⚠️ Missing required dependencies: ${missing.join(", ")}`);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
await installDeps(missing);
|
|
71
|
-
return true;
|
|
72
|
-
}
|
|
73
|
-
console.log(`\n❌ Please install missing dependencies manually:\n bun add -d ${missing.join(" ")}\n`);
|
|
74
|
-
return false;
|
|
49
|
+
await installDeps(missing);
|
|
50
|
+
return true;
|
|
75
51
|
}
|
|
76
52
|
/**
|
|
77
53
|
* Runs a command and returns a promise that resolves when the command finishes.
|