@hed-hog/cli 0.0.101 → 0.0.102

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": "@hed-hog/cli",
3
- "version": "0.0.101",
3
+ "version": "0.0.102",
4
4
  "description": "HedHog CLI tool",
5
5
  "author": "HedHog",
6
6
  "private": false,
@@ -1,58 +1,90 @@
1
1
  'use strict';
2
2
 
3
- const chalk = require('chalk');
4
- const boxen = require('boxen');
5
- const { readFileSync } = require('fs');
6
- const { join } = require('path');
3
+ var fs = require('fs');
4
+ var path = require('path');
5
+
6
+ // ANSI helpers no external dependencies
7
+ var R = '\x1b[0m';
8
+ var BOLD = '\x1b[1m';
9
+ var PURPLE = '\x1b[38;2;124;58;237m';
10
+ var CYAN = '\x1b[36m';
11
+ var GREEN = '\x1b[32m';
12
+ var GRAY = '\x1b[90m';
13
+ var WHITE = '\x1b[97m';
14
+ var UNDERLINE = '\x1b[4m';
15
+ var BLUE = '\x1b[34m';
16
+
17
+ function c(ansi, text) {
18
+ return ansi + text + R;
19
+ }
20
+
21
+ function drawBox(lines) {
22
+ var width = 0;
23
+ for (var i = 0; i < lines.length; i++) {
24
+ var len = stripAnsi(lines[i]).length;
25
+ if (len > width) width = len;
26
+ }
27
+ var inner = width + 4; // 2 spaces padding each side
28
+ var top = '\u256d' + '\u2500'.repeat(inner) + '\u256e';
29
+ var bottom = '\u2570' + '\u2500'.repeat(inner) + '\u256f';
30
+ var mid = '\u2502';
31
+
32
+ var out = ['\n', top];
33
+ out.push(mid + ' '.repeat(inner) + mid); // empty padding line
34
+ for (var j = 0; j < lines.length; j++) {
35
+ var raw = stripAnsi(lines[j]);
36
+ var pad = width - raw.length;
37
+ out.push(mid + ' ' + lines[j] + ' '.repeat(pad) + ' ' + mid);
38
+ }
39
+ out.push(mid + ' '.repeat(inner) + mid); // empty padding line
40
+ out.push(bottom, '');
41
+ return out.join('\n');
42
+ }
43
+
44
+ function stripAnsi(str) {
45
+ return str.replace(/\x1b\[[0-9;]*m/g, '');
46
+ }
7
47
 
8
48
  try {
9
- const pkg = JSON.parse(
10
- readFileSync(join(__dirname, '..', 'package.json'), 'utf-8'),
49
+ var pkg = JSON.parse(
50
+ fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf-8'),
11
51
  );
12
- const version = pkg.version || '';
13
-
14
- const title = chalk.bold.hex('#7C3AED')(' HedHog CLI');
15
- const versionLine =
16
- ' ' +
17
- chalk.gray('Version') +
18
- ' ' +
19
- chalk.bold.cyan('v' + version) +
20
- ' ' +
21
- chalk.green('installed successfully!');
22
-
23
- const cmds = [
52
+ var version = pkg.version || '';
53
+
54
+ var cmds = [
24
55
  ['hedhog new <name>', 'Create a new project'],
25
56
  ['hedhog add <library>', 'Add a library to your project'],
26
57
  ['hedhog dev apply', 'Apply local library changes'],
27
58
  ['hedhog dev initdb', 'Initialize the database'],
28
59
  ];
29
60
 
30
- const commands = cmds
31
- .map(function (pair) {
32
- return (
33
- ' ' +
34
- chalk.bold.white(pair[0].padEnd(26)) +
35
- ' ' +
36
- chalk.gray(pair[1])
37
- );
38
- })
39
- .join('\n');
40
-
41
- const docs =
42
- chalk.gray(' Docs: ') + chalk.underline.blue('https://github.com/hed-hog/cli');
43
-
44
- const message = [title, '', versionLine, '', chalk.gray(' Commands:'), commands, '', docs].join(
45
- '\n',
46
- );
61
+ var lines = [
62
+ c(BOLD + PURPLE, ' HedHog CLI'),
63
+ '',
64
+ ' ' +
65
+ c(GRAY, 'Version') +
66
+ ' ' +
67
+ c(BOLD + CYAN, 'v' + version) +
68
+ ' ' +
69
+ c(GREEN, 'installed successfully!'),
70
+ '',
71
+ c(GRAY, ' Commands:'),
72
+ ];
73
+
74
+ for (var k = 0; k < cmds.length; k++) {
75
+ var cmd = cmds[k][0];
76
+ var desc = cmds[k][1];
77
+ lines.push(' ' + c(BOLD + WHITE, cmd.padEnd(26)) + ' ' + c(GRAY, desc));
78
+ }
47
79
 
48
- console.log(
49
- boxen(message, {
50
- padding: 1,
51
- margin: { top: 1, bottom: 1, left: 0, right: 0 },
52
- borderStyle: 'round',
53
- borderColor: '#7C3AED',
54
- }),
80
+ lines.push('');
81
+ lines.push(
82
+ ' ' +
83
+ c(GRAY, 'Docs: ') +
84
+ c(UNDERLINE + BLUE, 'https://github.com/hed-hog/cli'),
55
85
  );
86
+
87
+ process.stdout.write(drawBox(lines));
56
88
  } catch (_) {
57
89
  // Silently ignore — postinstall message is non-critical
58
90
  }