@mohitkumawat/warmup-cli 1.2.6 → 1.2.8
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 +1 -1
- package/scripts/postinstall.js +39 -9
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -1,16 +1,46 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const isGlobal = process.env.npm_config_global === 'true';
|
|
4
|
+
|
|
5
|
+
if (!isGlobal) {
|
|
4
6
|
process.exit(0);
|
|
5
7
|
}
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
// Simple color codes to avoid dependency issues during postinstall
|
|
10
|
+
const reset = '\x1b[0m';
|
|
11
|
+
const bright = '\x1b[1m';
|
|
12
|
+
const green = '\x1b[32m';
|
|
13
|
+
const yellow = '\x1b[33m';
|
|
14
|
+
const cyan = '\x1b[36m';
|
|
15
|
+
|
|
16
|
+
const message = `
|
|
17
|
+
${bright}${green}WarmUp CLI has been installed successfully!${reset}
|
|
18
|
+
Starting initial setup...
|
|
19
|
+
`;
|
|
15
20
|
|
|
16
21
|
process.stdout.write(message);
|
|
22
|
+
|
|
23
|
+
// Automatically trigger "warmup setup" if we are in an interactive terminal
|
|
24
|
+
if (process.stdout.isTTY) {
|
|
25
|
+
try {
|
|
26
|
+
const { execSync } = require('child_process');
|
|
27
|
+
|
|
28
|
+
// We run it synchronously so the user is immediately dropped into the setup prompt
|
|
29
|
+
execSync('warmup setup', { stdio: 'inherit' });
|
|
30
|
+
} catch (err) {
|
|
31
|
+
// If the warmup command isn't immediately available or fails, fallback to instructions
|
|
32
|
+
const fallbackMessage = `
|
|
33
|
+
${bright}${yellow}Could not automatically start setup.${reset}
|
|
34
|
+
To finish the setup and start pre-warming Claude, please run:
|
|
35
|
+
${bright}${cyan} warmup setup${reset}
|
|
36
|
+
`;
|
|
37
|
+
process.stdout.write(fallbackMessage);
|
|
38
|
+
}
|
|
39
|
+
} else {
|
|
40
|
+
// CI/CD or non-interactive environments
|
|
41
|
+
const fallbackMessage = `
|
|
42
|
+
To finish the setup and start pre-warming Claude, please run:
|
|
43
|
+
${bright}${yellow} warmup setup${reset}
|
|
44
|
+
`;
|
|
45
|
+
process.stdout.write(fallbackMessage);
|
|
46
|
+
}
|