@joddabod5scripts/pokemon-fastfetch 1.0.0

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/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # pokemon-fastfetch
2
+
3
+ A zero-dependency npm package that creates a fastfetch display with pokemon-colorscripts styling.
4
+
5
+ ## Prerequisites
6
+
7
+ 1. **fastfetch** - Install from your package manager:
8
+ - Debian/Ubuntu: `sudo apt install fastfetch`
9
+ - macOS: `brew install fastfetch`
10
+ - Arch: `sudo pacman -S fastfetch`
11
+
12
+ 2. **pokemon-colorscripts** - Install from gitlab:
13
+
14
+ ```bash
15
+ git clone https://gitlab.com/phoneybadger/pokemon-colorscripts.git
16
+ cd pokemon-colorscripts
17
+ sudo ./install.sh
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ ```bash
23
+ npx pokemon-fastfetch
24
+ ```
25
+
26
+ This runs the equivalent of:
27
+
28
+ ```sh
29
+ pokemon-colorscripts --no-title -s -r | fastfetch -c $HOME/.config/fastfetch/config-pokemon.jsonc --logo-type file-raw --logo-height 10 --logo-width 5 --logo -
30
+ ```
31
+
32
+ The package will automatically create the config file at `$HOME/.config/fastfetch/config-pokemon.jsonc` if it doesn't already exist.
package/bin/index.js ADDED
@@ -0,0 +1,172 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawnSync, spawn } = require('child_process');
4
+ const { existsSync, writeFileSync, mkdirSync } = require('fs');
5
+ const { join, resolve } = require('path');
6
+ const { homedir } = require('os');
7
+
8
+ const configPath = join(homedir(), '.config', 'fastfetch', 'config-pokemon.jsonc');
9
+ const bundledConfig = `{
10
+ "$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
11
+ "logo": {
12
+ "height": 5,
13
+ "width": 10,
14
+ "padding": {
15
+ "top": 1
16
+ }
17
+ },
18
+ "display": {
19
+ "separator": " -> "
20
+ },
21
+ "modules": [
22
+ "break",
23
+ {
24
+ "type": "title",
25
+ "keyWidth": 10,
26
+ "format": " {6}{7}{8}"
27
+ },
28
+ {
29
+ "type": "custom",
30
+ "format": " ─────────────────────────── "
31
+ },
32
+ {
33
+ "type": "kernel",
34
+ "key": " ",
35
+ "keyColor": "yellow"
36
+ },
37
+ {
38
+ "type": "wm",
39
+ "key": " ",
40
+ "keyColor": "blue"
41
+ },
42
+ {
43
+ "type": "shell",
44
+ "key": " ",
45
+ "keyColor": "yellow"
46
+ },
47
+ {
48
+ "type": "terminal",
49
+ "key": " ",
50
+ "keyColor": "blue"
51
+ },
52
+ {
53
+ "type": "memory",
54
+ "key": "󰍛 ",
55
+ "keyColor": "magenta",
56
+ "format": "{1} / {2}"
57
+ },
58
+ {
59
+ "type": "cpu",
60
+ "key": "󰘚",
61
+ "keyColor": "Green",
62
+ "format": "{1}"
63
+ },
64
+ {
65
+ "type": "gpu",
66
+ "key": "󰢮",
67
+ "keyColor": "Green",
68
+ "hideType": "integrated",
69
+ "format": "{2}"
70
+ },
71
+ {
72
+ "type": "uptime",
73
+ "key": "󰔛 ",
74
+ "keyColor": "green"
75
+ },
76
+ {
77
+ "type": "custom",
78
+ "format": " ─────────────────────────── "
79
+ },
80
+ {
81
+ "type": "custom",
82
+ "format": "         "
83
+ },
84
+ "break"
85
+ ]
86
+ }`;
87
+
88
+ function ensureConfig() {
89
+ const configDir = join(configPath, '..');
90
+ if (!existsSync(configPath)) {
91
+ mkdirSync(configDir, { recursive: true });
92
+ writeFileSync(configPath, bundledConfig);
93
+ }
94
+ }
95
+
96
+ function checkFastfetch() {
97
+ const result = spawnSync('which', ['fastfetch'], { encoding: 'utf8' });
98
+ if (result.error || result.status !== 0) {
99
+ console.error(
100
+ 'fastfetch is not installed. To install it:\n'
101
+ );
102
+ console.error(' Debian/Ubuntu: sudo apt install fastfetch\n');
103
+ console.error(' macOS: brew install fastfetch\n');
104
+ console.error(' Arch: sudo pacman -S fastfetch\n');
105
+ return 1;
106
+ }
107
+ return 0;
108
+ }
109
+
110
+ function checkPokemonColorscripts() {
111
+ const result = spawnSync('which', ['pokemon-colorscripts'], { encoding: 'utf8' });
112
+ if (result.error || result.status !== 0) {
113
+ console.error(
114
+ 'pokemon-colorscripts is not installed. To install it:\n'
115
+ );
116
+ console.error(
117
+ ' git clone https://gitlab.com/phoneybadger/pokemon-colorscripts.git\n'
118
+ );
119
+ console.error(' cd pokemon-colorscripts\n');
120
+ console.error(' sudo ./install.sh\n');
121
+ console.error('Then verify the install by running: pokemon-colorscripts\n');
122
+ return 1;
123
+ }
124
+ return 0;
125
+ }
126
+
127
+ function main() {
128
+ const fastfetchExit = checkFastfetch();
129
+ if (fastfetchExit === 1) {
130
+ process.exit(fastfetchExit);
131
+ }
132
+
133
+ const colorscriptsExit = checkPokemonColorscripts();
134
+ if (colorscriptsExit === 1) {
135
+ process.exit(colorscriptsExit);
136
+ }
137
+
138
+ ensureConfig();
139
+
140
+ const colorscripts = spawn('pokemon-colorscripts', [
141
+ '--no-title',
142
+ '-s',
143
+ '-r',
144
+ ]);
145
+
146
+ const fastfetch = spawn('fastfetch', [
147
+ '-c',
148
+ configPath,
149
+ '--logo-type',
150
+ 'file-raw',
151
+ '--logo-height',
152
+ '10',
153
+ '--logo-width',
154
+ '5',
155
+ '--logo',
156
+ '-',
157
+ ]);
158
+
159
+ colorscripts.stdout.pipe(fastfetch.stdin);
160
+ fastfetch.stdout.pipe(process.stdout);
161
+ fastfetch.stderr.pipe(process.stderr);
162
+
163
+ fastfetch.on('error', (err) => {
164
+ console.error('Fastfetch error:', err.message);
165
+ });
166
+
167
+ fastfetch.on('close', (code) => {
168
+ process.exit(code ?? 1);
169
+ });
170
+ }
171
+
172
+ main();
@@ -0,0 +1,78 @@
1
+ {
2
+ "$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
3
+ "logo": {
4
+ "height": 5,
5
+ "width": 10,
6
+ "padding": {
7
+ "top": 1
8
+ }
9
+ },
10
+ "display": {
11
+ "separator": " -> "
12
+ },
13
+ "modules": [
14
+ "break",
15
+ {
16
+ "type": "title",
17
+ "keyWidth": 10,
18
+ "format": " {6}{7}{8}"
19
+ },
20
+ {
21
+ "type": "custom",
22
+ "format": " ─────────────────────────── "
23
+ },
24
+ {
25
+ "type": "kernel",
26
+ "key": " ",
27
+ "keyColor": "yellow"
28
+ },
29
+ {
30
+ "type": "wm",
31
+ "key": " ",
32
+ "keyColor": "blue"
33
+ },
34
+ {
35
+ "type": "shell",
36
+ "key": " ",
37
+ "keyColor": "yellow"
38
+ },
39
+ {
40
+ "type": "terminal",
41
+ "key": " ",
42
+ "keyColor": "blue"
43
+ },
44
+ {
45
+ "type": "memory",
46
+ "key": "󰍛 ",
47
+ "keyColor": "magenta",
48
+ "format": "{1} / {2}"
49
+ },
50
+ {
51
+ "type": "cpu",
52
+ "key": "󰘚",
53
+ "keyColor": "Green",
54
+ "format": "{1}"
55
+ },
56
+ {
57
+ "type": "gpu",
58
+ "key": "󰢮",
59
+ "keyColor": "Green",
60
+ "hideType": "integrated",
61
+ "format": "{2}"
62
+ },
63
+ {
64
+ "type": "uptime",
65
+ "key": "󰔛 ",
66
+ "keyColor": "green"
67
+ },
68
+ {
69
+ "type": "custom",
70
+ "format": " ─────────────────────────── "
71
+ },
72
+ {
73
+ "type": "custom",
74
+ "format": "         "
75
+ },
76
+ "break"
77
+ ]
78
+ }
package/package.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "@joddabod5scripts/pokemon-fastfetch",
3
+ "version": "1.0.0",
4
+ "bin": {
5
+ "pokemon-fastfetch": "./bin/index.js"
6
+ },
7
+ "preferGlobal": false
8
+ }