@dboio/cli 0.6.0 → 0.6.2

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.
Files changed (2) hide show
  1. package/bin/postinstall.js +39 -24
  2. package/package.json +1 -1
@@ -3,12 +3,27 @@
3
3
  // Post-install hook for `npm i @dboio/cli`
4
4
  // Interactive plugin picker when TTY is available, static message otherwise.
5
5
 
6
+ import { openSync, writeSync, closeSync } from 'fs';
7
+
6
8
  const RESET = '\x1b[0m';
7
9
  const BOLD = '\x1b[1m';
8
10
  const DIM = '\x1b[2m';
9
11
  const CYAN = '\x1b[36m';
10
12
  const YELLOW = '\x1b[33m';
11
13
 
14
+ // Write to TTY directly to bypass npm's output suppression
15
+ function write(message) {
16
+ try {
17
+ // Try to write directly to /dev/tty (works on Unix-like systems)
18
+ const fd = openSync('/dev/tty', 'w');
19
+ writeSync(fd, message);
20
+ closeSync(fd);
21
+ } catch {
22
+ // Fallback to console.error if /dev/tty is not available
23
+ console.error(message);
24
+ }
25
+ }
26
+
12
27
  // Available plugins — add new entries here as plugins are created
13
28
  const PLUGINS = [
14
29
  {
@@ -19,24 +34,24 @@ const PLUGINS = [
19
34
  ];
20
35
 
21
36
  function printStaticMessage() {
22
- console.log('');
23
- console.log(`${BOLD}${CYAN} DBO.io CLI installed successfully.${RESET}`);
24
- console.log('');
25
- console.log(` ${DIM}Plugins available:${RESET}`);
37
+ write('\n');
38
+ write(`${BOLD}${CYAN} DBO.io CLI installed successfully.${RESET}\n`);
39
+ write('\n');
40
+ write(` ${DIM}Plugins available:${RESET}\n`);
26
41
  for (const plugin of PLUGINS) {
27
- console.log(` ${YELLOW}${plugin.label}${RESET}`);
28
- console.log(` ${DIM}${plugin.command}${RESET}`);
42
+ write(` ${YELLOW}${plugin.label}${RESET}\n`);
43
+ write(` ${DIM}${plugin.command}${RESET}\n`);
29
44
  }
30
- console.log('');
31
- console.log(` To install all plugins at once, run:`);
32
- console.log(` ${BOLD}dbo install plugins${RESET}`);
33
- console.log('');
45
+ write('\n');
46
+ write(` To install all plugins at once, run:\n`);
47
+ write(` ${BOLD}dbo install plugins${RESET}\n`);
48
+ write('\n');
34
49
  }
35
50
 
36
51
  async function promptInteractive() {
37
- console.log('');
38
- console.log(`${BOLD}${CYAN} DBO.io CLI installed successfully.${RESET}`);
39
- console.log('');
52
+ write('\n');
53
+ write(`${BOLD}${CYAN} DBO.io CLI installed successfully.${RESET}\n`);
54
+ write('\n');
40
55
 
41
56
  const { default: inquirer } = await import('inquirer');
42
57
 
@@ -54,29 +69,29 @@ async function promptInteractive() {
54
69
  ]);
55
70
 
56
71
  if (selected.length === 0) {
57
- console.log('');
58
- console.log(` ${DIM}No plugins selected. You can install them later with:${RESET}`);
59
- console.log(` ${BOLD}dbo install plugins${RESET}`);
60
- console.log('');
72
+ write('\n');
73
+ write(` ${DIM}No plugins selected. You can install them later with:${RESET}\n`);
74
+ write(` ${BOLD}dbo install plugins${RESET}\n`);
75
+ write('\n');
61
76
  return;
62
77
  }
63
78
 
64
79
  const { execSync } = await import('child_process');
65
80
  const combined = selected.join(' && ');
66
81
 
67
- console.log('');
68
- console.log(` ${DIM}Running: ${combined}${RESET}`);
69
- console.log('');
82
+ write('\n');
83
+ write(` ${DIM}Running: ${combined}${RESET}\n`);
84
+ write('\n');
70
85
 
71
86
  try {
72
87
  execSync(combined, { stdio: 'inherit' });
73
88
  } catch {
74
- console.log('');
75
- console.log(` ${YELLOW}Plugin installation had an issue. You can retry with:${RESET}`);
89
+ write('\n');
90
+ write(` ${YELLOW}Plugin installation had an issue. You can retry with:${RESET}\n`);
76
91
  for (const cmd of selected) {
77
- console.log(` ${BOLD}${cmd}${RESET}`);
92
+ write(` ${BOLD}${cmd}${RESET}\n`);
78
93
  }
79
- console.log('');
94
+ write('\n');
80
95
  }
81
96
  }
82
97
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dboio/cli",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "CLI for the DBO.io framework",
5
5
  "type": "module",
6
6
  "bin": {