Skip to content

Commit 069f70c

Browse files
committed
feat: Ask when deleting, and explanations
1 parent 85167e9 commit 069f70c

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

templates/cli/lib/commands/push.js.twig

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,14 @@ const attributesToCreate = async (remoteAttributes, localAttributes, collection)
481481
return { Key: change.key, Action: change.action, Reason: change.reason, };
482482
}));
483483

484-
if (!cliConfig.force) {
484+
if (!cliConfig.force && (deleting.length > 0 || conflicts.length > 0)) {
485+
if (deleting.length > 0) {
486+
log(`Attribute deletion will cause ${chalk.red('loss of data')}`);
487+
}
488+
if (conflicts.length > 0) {
489+
log(`Attribute recreation will cause ${chalk.red('loss of data')}`);
490+
}
491+
485492
const answers = await inquirer.prompt(questionsPushCollections[1]);
486493

487494
if (answers.changes.toLowerCase() !== 'yes') {
@@ -1045,7 +1052,7 @@ const pushCollection = async ({ returnOnZero } = { returnOnZero: false }) => {
10451052
}
10461053
}))
10471054

1048-
// Serialize attribute actions
1055+
// Serialize attribute actions
10491056
for (let collection of collections) {
10501057
let attributes = collection.attributes;
10511058

templates/cli/lib/questions.js.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ const questionsPushCollections = [
672672
{
673673
type: "input",
674674
name: "changes",
675-
message: `Are you sure you want to override this collection? This can lead to loss of data! Type "YES" to confirm.`
675+
message: `Do you want to apply these changes? Type "YES" to confirm.`
676676
}
677677
]
678678

0 commit comments

Comments
 (0)