@phren/cli 0.2.14 → 0.2.15
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/bridge-hook.mjs
CHANGED
|
@@ -22684,7 +22684,7 @@ async function runBridge(args, version2) {
|
|
|
22684
22684
|
}
|
|
22685
22685
|
|
|
22686
22686
|
// src/bridge/hook-main.ts
|
|
22687
|
-
runBridge(process.argv.slice(2), "0.2.
|
|
22687
|
+
runBridge(process.argv.slice(2), "0.2.15").then((code) => {
|
|
22688
22688
|
process.exitCode = code;
|
|
22689
22689
|
}).catch((error51) => {
|
|
22690
22690
|
console.error(error51 instanceof Error ? error51.message : "Phren Hook failed.");
|
|
@@ -27,6 +27,8 @@ export declare function withFallbackColors(style?: {
|
|
|
27
27
|
}): WalkthroughStyle;
|
|
28
28
|
export declare function createWalkthroughStyle(): Promise<WalkthroughStyle>;
|
|
29
29
|
export declare function createWalkthroughPrompts(): Promise<WalkthroughPromptUi>;
|
|
30
|
+
/** Adapts an Inquirer module, or returns null when it offers neither API. */
|
|
31
|
+
export declare function walkthroughPromptsFrom(inquirerModule: unknown): WalkthroughPromptUi | null;
|
|
30
32
|
export interface WalkthroughResult {
|
|
31
33
|
storageChoice: StorageLocationChoice;
|
|
32
34
|
storagePath: string;
|
|
@@ -37,7 +37,18 @@ export async function createWalkthroughStyle() {
|
|
|
37
37
|
}
|
|
38
38
|
export async function createWalkthroughPrompts() {
|
|
39
39
|
try {
|
|
40
|
-
const
|
|
40
|
+
const ui = walkthroughPromptsFrom(await import(String("inquirer")));
|
|
41
|
+
if (ui)
|
|
42
|
+
return ui;
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
// fallback below
|
|
46
|
+
}
|
|
47
|
+
return readlineWalkthroughPrompts();
|
|
48
|
+
}
|
|
49
|
+
/** Adapts an Inquirer module, or returns null when it offers neither API. */
|
|
50
|
+
export function walkthroughPromptsFrom(inquirerModule) {
|
|
51
|
+
{
|
|
41
52
|
const maybeFns = inquirerModule;
|
|
42
53
|
if (typeof maybeFns.input === "function"
|
|
43
54
|
&& typeof maybeFns.confirm === "function"
|
|
@@ -65,7 +76,7 @@ export async function createWalkthroughPrompts() {
|
|
|
65
76
|
},
|
|
66
77
|
select: async (message, choices, defaultValue) => {
|
|
67
78
|
const answer = await prompt([{
|
|
68
|
-
type: "
|
|
79
|
+
type: "select",
|
|
69
80
|
name: "value",
|
|
70
81
|
message,
|
|
71
82
|
choices: choices.map((choice) => ({ value: choice.value, name: choice.name })),
|
|
@@ -76,9 +87,9 @@ export async function createWalkthroughPrompts() {
|
|
|
76
87
|
};
|
|
77
88
|
}
|
|
78
89
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
async function readlineWalkthroughPrompts() {
|
|
82
93
|
const readline = await import("readline");
|
|
83
94
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
84
95
|
const ask = (message) => new Promise((resolve) => rl.question(message, resolve));
|