@hed-hog/cli 0.0.100 → 0.0.101

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.100",
3
+ "version": "0.0.101",
4
4
  "description": "HedHog CLI tool",
5
5
  "author": "HedHog",
6
6
  "private": false,
@@ -16,14 +16,15 @@
16
16
  "command-line"
17
17
  ],
18
18
  "files": [
19
- "dist"
19
+ "dist",
20
+ "scripts/postinstall.js"
20
21
  ],
21
22
  "bin": {
22
23
  "hedhog": "./dist/src/main.js",
23
24
  "hh": "./dist/src/main.js"
24
25
  },
25
26
  "scripts": {
26
- "postinstall": "node -e \"var p=require('path');var f=p.join(process.cwd(),'dist','src','postinstall.js');require('fs').existsSync(f)&&require(f)\"",
27
+ "postinstall": "node scripts/postinstall.js",
27
28
  "prebuild": "rimraf dist && npm run format && npm run validate:templates",
28
29
  "build": "nest build",
29
30
  "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
@@ -0,0 +1,58 @@
1
+ 'use strict';
2
+
3
+ const chalk = require('chalk');
4
+ const boxen = require('boxen');
5
+ const { readFileSync } = require('fs');
6
+ const { join } = require('path');
7
+
8
+ try {
9
+ const pkg = JSON.parse(
10
+ readFileSync(join(__dirname, '..', 'package.json'), 'utf-8'),
11
+ );
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 = [
24
+ ['hedhog new <name>', 'Create a new project'],
25
+ ['hedhog add <library>', 'Add a library to your project'],
26
+ ['hedhog dev apply', 'Apply local library changes'],
27
+ ['hedhog dev initdb', 'Initialize the database'],
28
+ ];
29
+
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
+ );
47
+
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
+ }),
55
+ );
56
+ } catch (_) {
57
+ // Silently ignore — postinstall message is non-critical
58
+ }