@rowlabs/ev 0.4.1 → 0.4.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/dist/index.js +97 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6650,6 +6650,9 @@ var init_api_client = __esm({
|
|
|
6650
6650
|
async deleteEnvironment(appId, envId) {
|
|
6651
6651
|
return this.request("DELETE", `/apps/${appId}/environments/${envId}`);
|
|
6652
6652
|
}
|
|
6653
|
+
async deleteApp(projectId, appId) {
|
|
6654
|
+
return this.request("DELETE", `/projects/${projectId}/apps/${appId}`);
|
|
6655
|
+
}
|
|
6653
6656
|
async rotateKeys(projectId, body) {
|
|
6654
6657
|
return this.request("POST", `/projects/${projectId}/rotate`, body);
|
|
6655
6658
|
}
|
|
@@ -6729,7 +6732,7 @@ var init_auth = __esm({
|
|
|
6729
6732
|
|
|
6730
6733
|
// src/index.ts
|
|
6731
6734
|
init_dist();
|
|
6732
|
-
import { Command as
|
|
6735
|
+
import { Command as Command20 } from "commander";
|
|
6733
6736
|
|
|
6734
6737
|
// src/commands/login.ts
|
|
6735
6738
|
init_dist();
|
|
@@ -6917,11 +6920,11 @@ var initCommand = new Command2("init").description("Initialize ev in the current
|
|
|
6917
6920
|
console.log(` ${app.name} \u2192 ${app.path}`);
|
|
6918
6921
|
}
|
|
6919
6922
|
const rl = await import("readline");
|
|
6920
|
-
const
|
|
6923
|
+
const readline3 = rl.createInterface({ input: process.stdin, output: process.stdout });
|
|
6921
6924
|
const answer = await new Promise((resolve) => {
|
|
6922
|
-
|
|
6925
|
+
readline3.question("\nAdd these as app mappings to ev.yaml? (y/N) ", resolve);
|
|
6923
6926
|
});
|
|
6924
|
-
|
|
6927
|
+
readline3.close();
|
|
6925
6928
|
if (answer.toLowerCase() === "y") {
|
|
6926
6929
|
const appsConfig = {};
|
|
6927
6930
|
for (const app of detectedApps) {
|
|
@@ -7579,16 +7582,16 @@ envCommand.command("create <name>").description("Create a new environment").acti
|
|
|
7579
7582
|
});
|
|
7580
7583
|
envCommand.command("delete <name>").description("Delete an environment").action(async (name) => {
|
|
7581
7584
|
const rl = await import("readline");
|
|
7582
|
-
const
|
|
7585
|
+
const readline3 = rl.createInterface({ input: process.stdin, output: process.stdout });
|
|
7583
7586
|
const answer = await new Promise((resolve) => {
|
|
7584
|
-
|
|
7587
|
+
readline3.question(
|
|
7585
7588
|
chalk10.red(
|
|
7586
7589
|
`Delete environment "${name}"? This removes all secrets and releases. Type the environment name to confirm: `
|
|
7587
7590
|
),
|
|
7588
7591
|
resolve
|
|
7589
7592
|
);
|
|
7590
7593
|
});
|
|
7591
|
-
|
|
7594
|
+
readline3.close();
|
|
7592
7595
|
if (answer !== name) {
|
|
7593
7596
|
console.log(chalk10.yellow("Cancelled."));
|
|
7594
7597
|
process.exit(0);
|
|
@@ -7722,11 +7725,11 @@ accessCommand.command("grant <email>").description("Invite a user and share the
|
|
|
7722
7725
|
});
|
|
7723
7726
|
accessCommand.command("revoke <email>").description("Remove a member's access").action(async (email) => {
|
|
7724
7727
|
const rl = await import("readline");
|
|
7725
|
-
const
|
|
7728
|
+
const readline3 = rl.createInterface({ input: process.stdin, output: process.stdout });
|
|
7726
7729
|
const answer = await new Promise((resolve) => {
|
|
7727
|
-
|
|
7730
|
+
readline3.question(chalk12.yellow(`Revoke access for ${email}? (y/N) `), resolve);
|
|
7728
7731
|
});
|
|
7729
|
-
|
|
7732
|
+
readline3.close();
|
|
7730
7733
|
if (answer.toLowerCase() !== "y") {
|
|
7731
7734
|
console.log(chalk12.yellow("Cancelled."));
|
|
7732
7735
|
process.exit(0);
|
|
@@ -8415,6 +8418,7 @@ _ev() {
|
|
|
8415
8418
|
'update:Update ev to latest version'
|
|
8416
8419
|
'doctor:Check setup for issues'
|
|
8417
8420
|
'completions:Generate shell completions'
|
|
8421
|
+
'delete:Delete an app or environment'
|
|
8418
8422
|
)
|
|
8419
8423
|
|
|
8420
8424
|
_arguments -C \\
|
|
@@ -8467,7 +8471,7 @@ var BASH_COMPLETION = `_ev() {
|
|
|
8467
8471
|
cur="\${COMP_WORDS[COMP_CWORD]}"
|
|
8468
8472
|
prev="\${COMP_WORDS[COMP_CWORD-1]}"
|
|
8469
8473
|
|
|
8470
|
-
commands="login init push pull diff log get rollback env promote access backend import status scan doctor completions update"
|
|
8474
|
+
commands="login init push pull diff log get rollback env promote access backend import status scan doctor completions update delete"
|
|
8471
8475
|
|
|
8472
8476
|
case "\${prev}" in
|
|
8473
8477
|
ev)
|
|
@@ -8521,6 +8525,7 @@ complete -c ev -n '__fish_use_subcommand' -a scan -d 'Scan for env var reference
|
|
|
8521
8525
|
complete -c ev -n '__fish_use_subcommand' -a update -d 'Update ev to latest version'
|
|
8522
8526
|
complete -c ev -n '__fish_use_subcommand' -a doctor -d 'Check setup for issues'
|
|
8523
8527
|
complete -c ev -n '__fish_use_subcommand' -a completions -d 'Generate shell completions'
|
|
8528
|
+
complete -c ev -n '__fish_use_subcommand' -a delete -d 'Delete an app or environment'
|
|
8524
8529
|
|
|
8525
8530
|
# env subcommands
|
|
8526
8531
|
complete -c ev -n '__fish_seen_subcommand_from env' -a create -d 'Create environment'
|
|
@@ -8857,7 +8862,7 @@ var updateCommand = new Command18("update").description("Update ev to the latest
|
|
|
8857
8862
|
const spinner = ora12("Checking for updates...").start();
|
|
8858
8863
|
try {
|
|
8859
8864
|
const latest = execSync2("npm view @rowlabs/ev version", { encoding: "utf-8" }).trim();
|
|
8860
|
-
const current = "0.4.
|
|
8865
|
+
const current = "0.4.2";
|
|
8861
8866
|
if (current === latest) {
|
|
8862
8867
|
spinner.succeed(chalk20.green(`Already on the latest version (${current})`));
|
|
8863
8868
|
return;
|
|
@@ -8871,9 +8876,86 @@ var updateCommand = new Command18("update").description("Update ev to the latest
|
|
|
8871
8876
|
}
|
|
8872
8877
|
});
|
|
8873
8878
|
|
|
8879
|
+
// src/commands/delete.ts
|
|
8880
|
+
init_api_client();
|
|
8881
|
+
init_config();
|
|
8882
|
+
import { Command as Command19 } from "commander";
|
|
8883
|
+
import chalk21 from "chalk";
|
|
8884
|
+
import ora13 from "ora";
|
|
8885
|
+
import readline2 from "readline";
|
|
8886
|
+
var deleteCommand = new Command19("delete").description("Delete an app or environment").argument("<target>", "App name to delete, or app:env to delete a specific environment").action(async (target) => {
|
|
8887
|
+
try {
|
|
8888
|
+
const resolved = await resolveCurrentContext();
|
|
8889
|
+
if (!resolved) {
|
|
8890
|
+
console.error(chalk21.red("No ev.yaml found. Run `ev init` first."));
|
|
8891
|
+
process.exit(1);
|
|
8892
|
+
}
|
|
8893
|
+
const { context } = resolved;
|
|
8894
|
+
const client = await createApiClient();
|
|
8895
|
+
const project = await client.getProject(context.project);
|
|
8896
|
+
if (target.includes(":")) {
|
|
8897
|
+
const [appName, envName] = target.split(":");
|
|
8898
|
+
const app = project.apps.find((a2) => a2.name === appName);
|
|
8899
|
+
if (!app) {
|
|
8900
|
+
console.error(chalk21.red(`App "${appName}" not found`));
|
|
8901
|
+
process.exit(1);
|
|
8902
|
+
}
|
|
8903
|
+
const envs = await client.listEnvironments(app.id);
|
|
8904
|
+
const env = envs.find((e) => e.name === envName);
|
|
8905
|
+
if (!env) {
|
|
8906
|
+
console.error(chalk21.red(`Environment "${envName}" not found in app "${appName}"`));
|
|
8907
|
+
process.exit(1);
|
|
8908
|
+
}
|
|
8909
|
+
const answer = await prompt2(
|
|
8910
|
+
chalk21.red(`Delete environment "${appName}:${envName}"? This removes all secrets and releases. Type the environment name to confirm: `)
|
|
8911
|
+
);
|
|
8912
|
+
if (answer !== envName) {
|
|
8913
|
+
console.log(chalk21.yellow("Cancelled."));
|
|
8914
|
+
process.exit(0);
|
|
8915
|
+
}
|
|
8916
|
+
const spinner = ora13(`Deleting ${appName}:${envName}...`).start();
|
|
8917
|
+
await client.deleteEnvironment(app.id, env.id);
|
|
8918
|
+
spinner.succeed(chalk21.green(`Deleted environment "${appName}:${envName}"`));
|
|
8919
|
+
} else {
|
|
8920
|
+
const appName = target;
|
|
8921
|
+
const app = project.apps.find((a2) => a2.name === appName);
|
|
8922
|
+
if (!app) {
|
|
8923
|
+
console.error(chalk21.red(`App "${appName}" not found`));
|
|
8924
|
+
process.exit(1);
|
|
8925
|
+
}
|
|
8926
|
+
const envs = await client.listEnvironments(app.id);
|
|
8927
|
+
const secretCount = envs.reduce((sum, e) => sum + e.secretCount, 0);
|
|
8928
|
+
const answer = await prompt2(
|
|
8929
|
+
chalk21.red(
|
|
8930
|
+
`Delete app "${appName}"? This removes ${envs.length} environment${envs.length === 1 ? "" : "s"} and ${secretCount} secret${secretCount === 1 ? "" : "s"}. Type the app name to confirm: `
|
|
8931
|
+
)
|
|
8932
|
+
);
|
|
8933
|
+
if (answer !== appName) {
|
|
8934
|
+
console.log(chalk21.yellow("Cancelled."));
|
|
8935
|
+
process.exit(0);
|
|
8936
|
+
}
|
|
8937
|
+
const spinner = ora13(`Deleting ${appName}...`).start();
|
|
8938
|
+
await client.deleteApp(context.project, app.id);
|
|
8939
|
+
spinner.succeed(chalk21.green(`Deleted app "${appName}"`));
|
|
8940
|
+
}
|
|
8941
|
+
} catch (err) {
|
|
8942
|
+
console.error(chalk21.red(`Delete failed: ${err.message}`));
|
|
8943
|
+
process.exit(1);
|
|
8944
|
+
}
|
|
8945
|
+
});
|
|
8946
|
+
function prompt2(question) {
|
|
8947
|
+
const rl = readline2.createInterface({ input: process.stdin, output: process.stdout });
|
|
8948
|
+
return new Promise((resolve) => {
|
|
8949
|
+
rl.question(question, (answer) => {
|
|
8950
|
+
rl.close();
|
|
8951
|
+
resolve(answer.trim());
|
|
8952
|
+
});
|
|
8953
|
+
});
|
|
8954
|
+
}
|
|
8955
|
+
|
|
8874
8956
|
// src/index.ts
|
|
8875
|
-
var program = new
|
|
8876
|
-
program.name("ev").description("Git for env vars \u2014 sync environment variables across teams securely").version("0.4.
|
|
8957
|
+
var program = new Command20();
|
|
8958
|
+
program.name("ev").description("Git for env vars \u2014 sync environment variables across teams securely").version("0.4.2");
|
|
8877
8959
|
program.addCommand(loginCommand);
|
|
8878
8960
|
program.addCommand(initCommand);
|
|
8879
8961
|
program.addCommand(pushCommand);
|
|
@@ -8892,6 +8974,7 @@ program.addCommand(doctorCommand);
|
|
|
8892
8974
|
program.addCommand(completionsCommand);
|
|
8893
8975
|
program.addCommand(scanCommand);
|
|
8894
8976
|
program.addCommand(updateCommand);
|
|
8977
|
+
program.addCommand(deleteCommand);
|
|
8895
8978
|
async function main() {
|
|
8896
8979
|
await initCrypto();
|
|
8897
8980
|
program.parse();
|