@gravirei/reis 1.0.0 → 1.0.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.
- package/lib/install.js +33 -17
- package/package.json +1 -1
package/lib/install.js
CHANGED
|
@@ -21,7 +21,9 @@ ${chalk.white.bold(' ██ ██ ███████ ██ ████
|
|
|
21
21
|
// Check if running in CI environment or sudo (where stdin is not available)
|
|
22
22
|
const isCIEnvironment = process.env.CI === 'true' || process.argv.includes('--silent');
|
|
23
23
|
const isSudo = process.getuid && process.getuid() === 0;
|
|
24
|
-
|
|
24
|
+
// Check if stdin is actually readable (not just isTTY)
|
|
25
|
+
const hasInteractiveStdin = process.stdin.isTTY && !process.stdin.destroyed && typeof process.stdin.read === 'function';
|
|
26
|
+
const isInteractive = !isCIEnvironment && !isSudo && hasInteractiveStdin;
|
|
25
27
|
|
|
26
28
|
// Main installation function
|
|
27
29
|
async function install() {
|
|
@@ -45,27 +47,41 @@ async function install() {
|
|
|
45
47
|
// Interactive mode - show prompt
|
|
46
48
|
console.log(chalk.white('This will install REIS files to ~/.rovodev/reis/\n'));
|
|
47
49
|
|
|
48
|
-
//
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
message: 'Continue with installation?',
|
|
54
|
-
default: true
|
|
55
|
-
}
|
|
56
|
-
]);
|
|
57
|
-
|
|
58
|
-
if (!confirm) {
|
|
59
|
-
console.log(chalk.yellow('\n✗ Installation cancelled'));
|
|
60
|
-
process.exit(0);
|
|
50
|
+
// Double-check we can actually prompt
|
|
51
|
+
if (!isInteractive) {
|
|
52
|
+
console.log(chalk.gray('Non-interactive mode detected - installing automatically...\n'));
|
|
53
|
+
await performInstallation();
|
|
54
|
+
return;
|
|
61
55
|
}
|
|
62
56
|
|
|
63
|
-
|
|
64
|
-
|
|
57
|
+
try {
|
|
58
|
+
// Prompt for confirmation
|
|
59
|
+
const { confirm } = await inquirer.prompt([
|
|
60
|
+
{
|
|
61
|
+
type: 'confirm',
|
|
62
|
+
name: 'confirm',
|
|
63
|
+
message: 'Continue with installation?',
|
|
64
|
+
default: true
|
|
65
|
+
}
|
|
66
|
+
]);
|
|
67
|
+
|
|
68
|
+
if (!confirm) {
|
|
69
|
+
console.log(chalk.yellow('\n✗ Installation cancelled'));
|
|
70
|
+
process.exit(0);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
console.log('');
|
|
74
|
+
await performInstallation();
|
|
75
|
+
} catch (promptError) {
|
|
76
|
+
// inquirer failed, install anyway
|
|
77
|
+
console.log(chalk.gray('Prompt failed - installing automatically...\n'));
|
|
78
|
+
await performInstallation();
|
|
79
|
+
}
|
|
65
80
|
|
|
66
81
|
} catch (error) {
|
|
67
82
|
console.error(chalk.red('\n✗ Installation failed:'), error.message);
|
|
68
|
-
|
|
83
|
+
// Don't exit with error code - allow npm install to continue
|
|
84
|
+
console.log(chalk.yellow('Installation had issues but package is available.'));
|
|
69
85
|
}
|
|
70
86
|
}
|
|
71
87
|
|
package/package.json
CHANGED