@@ -265,6 +265,8 @@ const pushResources = async () => {
265
265
}
266
266
}
267
267
}
268
+
269
+ process.exit(0);
268
270
};
269
271
270
272
const pushFunction = async ({ async } = {}) => {
@@ -297,8 +299,6 @@ const pushFunction = async ({ async } = {}) => {
297
299
}
298
300
299
301
if (func.variables) {
300
- func.pushVariables = cliConfig.force;
301
-
302
302
try {
303
303
const { total } = await functionsListVariables({
304
304
functionId: func['$id'],
@@ -310,8 +310,8 @@ const pushFunction = async ({ async } = {}) => {
310
310
func.pushVariables = true;
311
311
} else if (total > 0 && !func.pushVariables) {
312
312
log(`The function ${func.name} has remote variables setup`);
313
- const variableAnswers = await inquirer.prompt(questionsPushFunctions[1])
314
- func.pushVariables = variableAnswers.override.toLowerCase() === "yes";
313
+ const variableAnswers = await inquirer.prompt(questionsPushFunctions.slice(2, 4));
314
+ func.pushVariables = variableAnswers.setupoverride ? variableAnswers.setupoverride : variableAnswers. override.toLowerCase() === "yes";
315
315
}
316
316
} catch (e) {
317
317
if (e.code != 404) {
@@ -524,6 +524,8 @@ const pushFunction = async ({ async } = {}) => {
524
524
})
525
525
526
526
success(`Pushed ${successfullyPushed} functions with ${successfullyDeployed} successful deployments.`);
527
+
528
+ process.exit(0);
527
529
}
528
530
529
531
const createAttribute = async (databaseId, collectionId, attribute) => {
@@ -641,6 +643,8 @@ const createAttribute = async (databaseId, collectionId, attribute) => {
641
643
parseOutput: false
642
644
})
643
645
}
646
+
647
+ process.exit(0);
644
648
}
645
649
646
650
const pushCollection = async () => {
@@ -707,12 +711,11 @@ const pushCollection = async () => {
707
711
708
712
log(`Collection ${collection.name} ( ${collection['$id']} ) already exists.`);
709
713
710
- if (!cliConfig.force) {
711
- const answers = await inquirer.prompt(questionsPushCollections[2])
712
- if (answers.override.toLowerCase() !== "yes") {
713
- log(`Received "${answers.override}". Skipping ${collection.name} ( ${collection['$id']} )`);
714
- continue;
715
- }
714
+ const answers = await inquirer.prompt(questionsPushCollections.slice(2, 4))
715
+ const override = answers.setupoverride ? answers.setupoverride : answers.override.toLowerCase() === "yes";
716
+ if (!override) {
717
+ log(`Skipping ${collection.name} ( ${collection['$id']} )`);
718
+ continue;
716
719
}
717
720
718
721
log(`Deleting indexes and attributes ... `);
@@ -859,6 +862,8 @@ const pushCollection = async () => {
859
862
860
863
success(`Created ${relationships.length} relationship attributes`);
861
864
}
865
+
866
+ process.exit(0);
862
867
}
863
868
864
869
const pushBucket = async () => {
@@ -884,12 +889,11 @@ const pushBucket = async () => {
884
889
})
885
890
log(`Bucket ${bucket.name} ( ${bucket['$id']} ) already exists.`);
886
891
887
- if (!cliConfig.force) {
888
- const answers = await inquirer.prompt(questionsPushBuckets[2])
889
- if (answers.override.toLowerCase() !== "yes") {
890
- log(`Received "${answers.override}". Skipping ${bucket.name} ( ${bucket['$id']} )`);
891
- continue;
892
- }
892
+ const answers = await inquirer.prompt(questionsPushBuckets.slice(2, 4))
893
+ const override = answers.setupoverride ? answers.setupoverride : answers.override.toLowerCase() === "yes";
894
+ if (!override) {
895
+ log(`Skipping ${bucket.name} ( ${bucket['$id']} )`);
896
+ continue;
893
897
}
894
898
895
899
log(`Updating bucket ...`)
@@ -934,6 +938,8 @@ const pushBucket = async () => {
934
938
}
935
939
}
936
940
}
941
+
942
+ process.exit(0);
937
943
}
938
944
939
945
const pushTeam = async () => {
@@ -959,12 +965,11 @@ const pushTeam = async () => {
959
965
})
960
966
log(`Team ${team.name} ( ${team['$id']} ) already exists.`);
961
967
962
- if (!cliConfig.force) {
963
- const answers = await inquirer.prompt(questionsPushTeams[2])
964
- if (answers.override.toLowerCase() !== "yes") {
965
- log(`Received "${answers.override}". Skipping ${team.name} ( ${team['$id']} )`);
966
- continue;
967
- }
968
+ const answers = await inquirer.prompt(questionsPushTeams.slice(2, 4))
969
+ const override = answers.setupoverride ? answers.setupoverride : answers.override.toLowerCase() === "yes";
970
+ if (!override) {
971
+ log(`Skipping ${team.name} ( ${team['$id']} )`);
972
+ continue;
968
973
}
969
974
970
975
log(`Updating team ...`)
@@ -992,27 +997,28 @@ const pushTeam = async () => {
992
997
}
993
998
}
994
999
}
1000
+
1001
+ process.exit(0);
995
1002
}
996
1003
997
1004
const pushMessagingTopic = async () => {
998
1005
let response = {};
999
1006
1000
1007
const configTopics = localConfig.getMessagingTopics();
1001
1008
const topicsIds = (await inquirer.prompt(questionsPushMessagingTopics.slice(0, 2))).topics;
1002
- let overrideExisting = cliConfig.force;
1003
1009
const topics = [];
1010
+ let overrideExisting = false;
1004
1011
1005
1012
for (const topicId of topicsIds) {
1006
1013
const id = topicId.value ? topicId.value : topicId
1007
1014
const idTopic = configTopics.filter((b) => b.$id === id);
1008
1015
topics.push(...idTopic);
1009
1016
}
1010
1017
1011
- if (!cliConfig.force) {
1012
- const answers = await inquirer.prompt(questionsPushMessagingTopics[2])
1013
- if (answers.override.toLowerCase() === "yes") {
1014
- overrideExisting = true;
1015
- }
1018
+ const answers = await inquirer.prompt(questionsPushMessagingTopics.slice(2, 4))
1019
+ const override = answers.setupoverride ? answers.setupoverride : answers.override.toLowerCase() === "yes";
1020
+ if (override) {
1021
+ overrideExisting = true
1016
1022
}
1017
1023
1018
1024
for (let topic of topics) {
@@ -1057,6 +1063,8 @@ const pushMessagingTopic = async () => {
1057
1063
}
1058
1064
}
1059
1065
}
1066
+
1067
+ process.exit(0);
1060
1068
}
1061
1069
1062
1070
const push = new Command("push")
0 commit comments