@agilecustoms/envctl 0.22.2 → 0.22.4

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.
@@ -25,6 +25,10 @@ export class EnvApiClient {
25
25
  await this.httpClient.post('/ci/env', env);
26
26
  return { ...env, ephemeral: false, status: EnvStatus.Deploying };
27
27
  }
28
+ async setVars(env, vars) {
29
+ await this.httpClient.post(`/ci/env/${env.key}/vars`, vars);
30
+ env.vars = { ...env.vars || {}, ...vars };
31
+ }
28
32
  async activate(env) {
29
33
  await this.httpClient.post(`/ci/env/${env.key}/activate`);
30
34
  env.status = EnvStatus.Active;
@@ -49,8 +53,4 @@ export class EnvApiClient {
49
53
  env.status = EnvStatus.Deleting;
50
54
  return result.statusText;
51
55
  }
52
- async setVars(env, vars) {
53
- await this.httpClient.post(`/ci/env/${env.key}/vars`, vars);
54
- env.vars = { ...env.vars || {}, ...vars };
55
- }
56
56
  }
@@ -148,33 +148,28 @@ export class EnvCtl {
148
148
  }
149
149
  async delete(project, envName, force, cwd) {
150
150
  const env = await this.get(project, envName);
151
- if (force) {
152
- console.log('Force deletion');
153
- if (env.status === EnvStatus.Deploying || env.status === EnvStatus.Updating) {
154
- console.log(`Env status is ${env.status}, will unlock it`);
155
- await this.envApi.activate(env);
151
+ if (!force) {
152
+ this.checkStatus(env);
153
+ if (env.status === EnvStatus.Init) {
154
+ await this.envApi.delete(env);
155
+ console.log(`Env ${env.key} is deleted`);
156
+ return;
156
157
  }
157
- }
158
- this.checkStatus(env);
159
- if (env.status === EnvStatus.Init) {
160
- await this.envApi.delete(env);
161
- console.log(`Env ${env.key} is deleted`);
162
- return;
163
- }
164
- const kind = this.cliHelper.ensureKind(undefined, cwd);
165
- if (env.kind && env.kind !== kind) {
166
- const answerYes = await this.cliHelper.promptYesNo(`Env ${env.key} kind (dir-name): ${env.kind}\n`
167
- + 'You\'re deleting env deployed from different dir\n'
168
- + 'Do you want to proceed?');
169
- if (!answerYes) {
170
- console.log('Aborting deletion');
158
+ const kind = this.cliHelper.ensureKind(undefined, cwd);
159
+ if (env.kind && env.kind !== kind) {
160
+ const answerYes = await this.cliHelper.promptYesNo(`Env ${env.key} kind (dir-name): ${env.kind}\n`
161
+ + 'You\'re deleting env deployed from different dir\n'
162
+ + 'Do you want to proceed?');
163
+ if (!answerYes) {
164
+ console.log('Aborting deletion');
165
+ return;
166
+ }
167
+ }
168
+ await this.promptUnlock(env);
169
+ if (env.status !== EnvStatus.Active) {
171
170
  return;
172
171
  }
173
172
  }
174
- await this.promptUnlock(env);
175
- if (env.status !== EnvStatus.Active) {
176
- return;
177
- }
178
173
  console.log('Deleting env');
179
174
  const message = await this.envApi.delete(env);
180
175
  console.log(message);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agilecustoms/envctl",
3
3
  "description": "node.js CLI client for manage environments",
4
- "version": "0.22.2",
4
+ "version": "0.22.4",
5
5
  "author": "Alex Chekulaev",
6
6
  "type": "module",
7
7
  "bin": {