dotenvx-interactive-cli
Advanced tools
+21
-9
@@ -5,14 +5,26 @@ #!/usr/bin/env node | ||
| import { promises } from 'fs'; | ||
| import { spawnSync } from 'child_process'; | ||
| import { $ } from 'zx'; | ||
| import { spawnSync, spawn } from 'child_process'; | ||
| import { glob } from 'glob'; | ||
| async function executeCommand(cmd, ...args) { | ||
| console.log(chalk.blue(`Executing: ${[cmd, ...args].join(" ")}`)); | ||
| const result = await $`${cmd} ${args}`.nothrow(); | ||
| return { | ||
| stdout: result.stdout?.toString() ?? "", | ||
| stderr: result.stderr?.toString() ?? "", | ||
| exitCode: result.exitCode ?? 0 | ||
| }; | ||
| return new Promise((resolve) => { | ||
| const child = spawn(cmd, args, { shell: true }); | ||
| let stdout = ""; | ||
| let stderr = ""; | ||
| child.stdout?.on("data", (data) => { | ||
| process.stdout.write(data); | ||
| stdout += data.toString(); | ||
| }); | ||
| child.stderr?.on("data", (data) => { | ||
| process.stderr.write(data); | ||
| stderr += data.toString(); | ||
| }); | ||
| child.on("close", (code) => { | ||
| resolve({ | ||
| stdout, | ||
| stderr, | ||
| exitCode: code ?? 0 | ||
| }); | ||
| }); | ||
| }); | ||
| } | ||
@@ -19,0 +31,0 @@ async function checkDotenvxInstallation() { |
+2
-3
| { | ||
| "name": "dotenvx-interactive-cli", | ||
| "version": "0.3.2", | ||
| "version": "0.4.0", | ||
| "description": "An interactive CLI tool for managing .env files with dotenvx - encrypt, decrypt, and manage environment variables with ease.", | ||
@@ -49,4 +49,3 @@ "author": "Maxiviper117", | ||
| "glob": "^11.0.1", | ||
| "inquirer": "^12.5.2", | ||
| "zx": "^8.5.3" | ||
| "inquirer": "^12.5.2" | ||
| }, | ||
@@ -53,0 +52,0 @@ "devDependencies": { |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
11643
1.73%8
-11.11%246
5.13%