@purpleschool/infisical-env 0.1.1 → 0.1.3
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 +2 -1
- package/src/cli.js +16 -19
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@purpleschool/infisical-env",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"infisical-env": "src/cli.js"
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"picocolors": "^1.0.1",
|
|
16
|
+
"prompts": "^2.4.2",
|
|
16
17
|
"yaml": "^2.4.5"
|
|
17
18
|
}
|
|
18
19
|
}
|
package/src/cli.js
CHANGED
|
@@ -3,10 +3,10 @@ import fs from "node:fs";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
|
-
import readline from "node:readline/promises";
|
|
7
6
|
import YAML from "yaml";
|
|
8
7
|
import os from "node:os";
|
|
9
8
|
import pc from "picocolors";
|
|
9
|
+
import prompts from "prompts";
|
|
10
10
|
|
|
11
11
|
const __filename = fileURLToPath(import.meta.url);
|
|
12
12
|
const __dirname = path.dirname(__filename);
|
|
@@ -139,25 +139,22 @@ function validateEnv(value) {
|
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
async function promptEnv() {
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
if (!Number.isInteger(index) || index < 0 || index >= ALLOWED_ENVS.length) {
|
|
155
|
-
throw new Error("Invalid environment selection");
|
|
142
|
+
const response = await prompts(
|
|
143
|
+
{
|
|
144
|
+
type: "select",
|
|
145
|
+
name: "env",
|
|
146
|
+
message: "Select environment",
|
|
147
|
+
choices: ALLOWED_ENVS.map((value) => ({ title: value, value })),
|
|
148
|
+
initial: 0,
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
onCancel: () => {
|
|
152
|
+
throw new Error("Environment selection canceled");
|
|
153
|
+
},
|
|
156
154
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
return validateEnv(response.env);
|
|
161
158
|
}
|
|
162
159
|
|
|
163
160
|
function resolveDeploymentPath(repoRoot) {
|