picosh 0.1.5 → 0.1.7

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "picosh",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Hyper plugin: paste clipboard images as file paths",
5
5
  "main": "index.js",
6
6
  "license": "MIT",
@@ -11,25 +11,30 @@ const HYPER_CLI_PATHS = [
11
11
  '/usr/local/bin/hyper',
12
12
  ];
13
13
 
14
+ const HYPER_CONFIG_PATHS = [
15
+ path.join(os.homedir(), 'AppData', 'Roaming', 'Hyper', 'config.json'),
16
+ path.join(os.homedir(), '.hyper.js'),
17
+ ];
18
+
14
19
  function findHyperCli() {
15
20
  return HYPER_CLI_PATHS.find((p) => fs.existsSync(p));
16
21
  }
17
22
 
18
23
  function installHyper() {
19
24
  const platform = os.platform();
20
- console.log('[picosh] Installing Hyper...');
25
+ console.error('[picosh] Installing Hyper...');
21
26
  try {
22
27
  if (platform === 'win32') {
23
28
  execSync('winget install vercel.Hyper --silent', {stdio: 'inherit'});
24
29
  } else if (platform === 'darwin') {
25
30
  execSync('brew install --cask hyper', {stdio: 'inherit'});
26
31
  } else {
27
- console.log('[picosh] Please install Hyper manually: https://hyper.is');
32
+ console.error('[picosh] Please install Hyper manually: https://hyper.is');
28
33
  return false;
29
34
  }
30
35
  return true;
31
36
  } catch (e) {
32
- console.log('[picosh] Auto-install failed. Please install Hyper manually: https://hyper.is');
37
+ console.error('[picosh] Auto-install failed. Please install Hyper manually: https://hyper.is');
33
38
  return false;
34
39
  }
35
40
  }
@@ -42,15 +47,18 @@ if (!cli) {
42
47
  cli = findHyperCli();
43
48
  }
44
49
 
45
- if (!cli) {
46
- console.log('[picosh] Hyper installed. Run `hyper i picosh` to activate the plugin.');
50
+ const configExists = HYPER_CONFIG_PATHS.some((p) => fs.existsSync(p));
51
+
52
+ if (!cli || !configExists) {
53
+ console.error('[picosh] Hyper installed!');
54
+ console.error('[picosh] Launch Hyper once to initialize, then run: hyper i picosh');
47
55
  process.exit(0);
48
56
  }
49
57
 
50
58
  try {
51
- console.log('[picosh] Registering plugin with Hyper...');
59
+ console.error('[picosh] Registering plugin with Hyper...');
52
60
  execSync(`"${cli}" i picosh`, {stdio: 'inherit'});
53
- console.log('[picosh] Done! Launch Hyper to start using picosh.');
61
+ console.error('[picosh] Done! Launch Hyper to start using picosh.');
54
62
  } catch (e) {
55
- console.log('[picosh] Could not auto-register. Run manually: hyper i picosh');
63
+ console.error('[picosh] Could not auto-register. Run manually: hyper i picosh');
56
64
  }