@agilecustoms/envctl 0.22.2 → 0.22.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/dist/service/EnvCtl.js +18 -23
- package/package.json +1 -1
package/dist/service/EnvCtl.js
CHANGED
|
@@ -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
|
-
|
|
153
|
-
if (env.status === EnvStatus.
|
|
154
|
-
|
|
155
|
-
|
|
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
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
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);
|