picosh 0.1.4 → 0.1.6
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/package.json +1 -1
- package/scripts/postinstall.js +30 -6
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -15,18 +15,42 @@ function findHyperCli() {
|
|
|
15
15
|
return HYPER_CLI_PATHS.find((p) => fs.existsSync(p));
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
function installHyper() {
|
|
19
|
+
const platform = os.platform();
|
|
20
|
+
console.error('[picosh] Installing Hyper...');
|
|
21
|
+
try {
|
|
22
|
+
if (platform === 'win32') {
|
|
23
|
+
execSync('winget install vercel.Hyper --silent', {stdio: 'inherit'});
|
|
24
|
+
} else if (platform === 'darwin') {
|
|
25
|
+
execSync('brew install --cask hyper', {stdio: 'inherit'});
|
|
26
|
+
} else {
|
|
27
|
+
console.error('[picosh] Please install Hyper manually: https://hyper.is');
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
return true;
|
|
31
|
+
} catch (e) {
|
|
32
|
+
console.error('[picosh] Auto-install failed. Please install Hyper manually: https://hyper.is');
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
let cli = findHyperCli();
|
|
38
|
+
|
|
39
|
+
if (!cli) {
|
|
40
|
+
const installed = installHyper();
|
|
41
|
+
if (!installed) process.exit(0);
|
|
42
|
+
cli = findHyperCli();
|
|
43
|
+
}
|
|
19
44
|
|
|
20
45
|
if (!cli) {
|
|
21
|
-
console.
|
|
22
|
-
console.log('[picosh] Then run: hyper i picosh');
|
|
46
|
+
console.error('[picosh] Hyper installed. Run `hyper i picosh` to activate the plugin.');
|
|
23
47
|
process.exit(0);
|
|
24
48
|
}
|
|
25
49
|
|
|
26
50
|
try {
|
|
27
|
-
console.
|
|
51
|
+
console.error('[picosh] Registering plugin with Hyper...');
|
|
28
52
|
execSync(`"${cli}" i picosh`, {stdio: 'inherit'});
|
|
29
|
-
console.
|
|
53
|
+
console.error('[picosh] Done! Launch Hyper to start using picosh.');
|
|
30
54
|
} catch (e) {
|
|
31
|
-
console.
|
|
55
|
+
console.error('[picosh] Could not auto-register. Run manually: hyper i picosh');
|
|
32
56
|
}
|