Skip to content
This repository was archived by the owner on May 19, 2025. It is now read-only.

Commit 8121665

Browse files
Made changes in warning and confirmation message
1 parent ceb716d commit 8121665

File tree

3 files changed

+9
-22
lines changed

3 files changed

+9
-22
lines changed

app.js

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const Bluebird = require('bluebird');
22
const prompt = require('prompt');
33
const chalk = require('chalk');
4-
const Confirm = require('prompt-confirm');
4+
//const Confirm = require('prompt-confirm');
55

66
const util = require('./lib/util');
77
const login = require('./lib/util/login');
@@ -25,16 +25,10 @@ login(config).then(function() {
2525

2626
prompt.start();
2727

28-
var message = chalk.red("Please Enter your Stack name, From which you want to delete ?")
28+
var message = chalk.red("To confirm the delete action, enter your stack name ?")
2929

3030
prompt.get([message], function(err, result) {
3131
if (result[message] === config.stack.name) {
32-
const confirm = new Confirm('The utility will delete all the Content Types and Assets present in the stack that you provide here.Are you sure, you want to continue')
33-
confirm
34-
.run()
35-
.then(function(answer) {
36-
// eslint-disable-next-line no-empty
37-
if(answer === true) {
3832
// eslint-disable-next-line no-undef
3933
if (process.argv.length === 3) {
4034
// eslint-disable-next-line no-undef
@@ -45,7 +39,7 @@ login(config).then(function() {
4539
log.success( 'Deletion completed successfully!');
4640
return;
4741
}).catch(function(error) {
48-
log.error('Failed to Delete ' + val + error);
42+
log.error('Failed to Delete ' +" "+JSON.stringify(error));
4943
// log.error(error);
5044
return;
5145
})
@@ -73,16 +67,9 @@ login(config).then(function() {
7367
log.error('Only one module can be deleted at a time.');
7468
return 0;
7569
}
76-
} else {
77-
return 0;
78-
}
79-
}).catch(function (error) {
80-
// eslint-disable-next-line no-console
81-
return(error);
82-
});
8370
} else {
8471
// eslint-disable-next-line no-console
85-
console.log("You have Entered Wrong Stack Name");
72+
console.log("Failed. Stack name does not match with stack detail specified in the config file.");
8673
log.error(err)
8774
return 0;
8875
}

lib/delete/delete_assets.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ DeleteAseets.prototype = {
3030
log.success(chalk.blue('Starting Assets deletion'));
3131
var self = this;
3232
return new Promise(function (resolve, reject) {
33-
const confirm = new Confirm('Are you sure, you want to delete All Assets')
33+
const confirm = new Confirm(chalk.red('The action will delete all the Assets present in the mentioned stack. Are you sure you want to continue ?'))
3434
confirm
3535
.run()
3636
.then(function(answer) {
@@ -43,7 +43,7 @@ DeleteAseets.prototype = {
4343
})
4444
} else {
4545
// eslint-disable-next-line no-console
46-
console.log("deleteAssets is not set as true in config file or you have selected No")
46+
console.log(chalk.red("Delete action failed. Either 'assetsdelete' is not set as 'true' in the config file or you declined while confirming the delete action."))
4747
return reject();
4848
}
4949
}).catch(function (error) {

lib/delete/delete_contentTypes.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ DeleteContentTypes.prototype = {
3232
var contenttypeslist = config.content_types_list;
3333
self.contentTypeList = contenttypeslist
3434
if(contenttypeslist && contenttypeslist != '' && contenttypeslist != undefined) {
35-
const confirm = new Confirm('Are you sure, you want to delete'+" "+"'"+contenttypeslist+"'"+" "+'contentTypes')
35+
const confirm = new Confirm(chalk.red('The action will delete the following Content Types.' +"'"+contenttypeslist+"'"+'.Are you sure you want to continue:?'))
3636
confirm
3737
.run()
3838
.then(function(answer) {
@@ -59,7 +59,7 @@ DeleteContentTypes.prototype = {
5959
return reject(error);
6060
});
6161
} else {
62-
const confirm = new Confirm('Are you sure, you want to delete All ContentTypes of'+" "+config.stack.name+" "+"stack")
62+
const confirm = new Confirm(chalk.red('The action will delete all the Content Types present in the mentioned stack. Are you sure you want to continue ?'))
6363
confirm
6464
.run()
6565
.then(function(answer) {
@@ -156,7 +156,7 @@ DeleteContentTypes.prototype = {
156156
concurrency: 1
157157
}).then(function () {
158158
return resolve();
159-
}).catch(function (error) {
159+
}).catch(function () {
160160
return reject();
161161
})
162162
})

0 commit comments

Comments
 (0)