Skip to content

Commit 3e9d58c

Browse files
committed
refactoring(cli): deploy to push
1 parent cd273d0 commit 3e9d58c

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ const pushFunction = async ({ functionId, all, yes } = {}) => {
255255
}
256256

257257
if (functionIds.length <= 0) {
258-
const answers = await inquirer.prompt(questionsDeployFunctions[0]);
258+
const answers = await inquirer.prompt(questionsPushFunctions[0]);
259259
functionIds.push(...answers.functions);
260260
}
261261

@@ -271,7 +271,7 @@ const pushFunction = async ({ functionId, all, yes } = {}) => {
271271
});
272272

273273
log('Validating functions');
274-
// Validation is done BEFORE deploying so the deployment process can be run in async with progress update
274+
// Validation is done BEFORE pushing so the deployment process can be run in async with progress update
275275
for (let i = 0; i < functions.length; i++) {
276276
const func = functions[i];
277277

@@ -283,7 +283,7 @@ const pushFunction = async ({ functionId, all, yes } = {}) => {
283283
}
284284

285285
if (func.variables) {
286-
func.deployVariables = yes;
286+
func.pushVariables = yes;
287287

288288
try {
289289
const { total } = await functionsListVariables({
@@ -293,11 +293,11 @@ const pushFunction = async ({ functionId, all, yes } = {}) => {
293293
});
294294

295295
if (total === 0) {
296-
func.deployVariables = true;
297-
} else if (total > 0 && !func.deployVariables) {
296+
func.pushVariables = true;
297+
} else if (total > 0 && !func.pushVariables) {
298298
log(`The function ${func.name} has remote variables setup`);
299-
const variableAnswers = await inquirer.prompt(questionsDeployFunctions[1])
300-
func.deployVariables = variableAnswers.override.toLowerCase() === "yes";
299+
const variableAnswers = await inquirer.prompt(questionsPushFunctions[1])
300+
func.pushVariables = variableAnswers.override.toLowerCase() === "yes";
301301
}
302302
} catch (e) {
303303
if (e.code != 404) {
@@ -312,7 +312,7 @@ const pushFunction = async ({ functionId, all, yes } = {}) => {
312312
log('Pushing functions\n');
313313

314314
Updater.start(false,)
315-
let successfullyDeployed = 0;
315+
let successfullyPushed = 0;
316316

317317
await Promise.all(functions.map(async (func) => {
318318
const ignore = func.ignore ? 'appwrite.json' : '.gitignore';
@@ -391,7 +391,7 @@ const pushFunction = async ({ functionId, all, yes } = {}) => {
391391
}
392392

393393
if (func.variables) {
394-
if (!func.deployVariables) {
394+
if (!func.pushVariables) {
395395
updaterRow.update({ end: 'Skipping variables' });
396396
} else {
397397
updaterRow.update({ end: 'Pushing variables' });
@@ -415,7 +415,7 @@ const pushFunction = async ({ functionId, all, yes } = {}) => {
415415
return;
416416
}
417417

418-
// Deploy local variables
418+
// Push local variables
419419
await Promise.all(Object.keys(func.variables).map(async localVariableKey => {
420420
await functionsCreateVariable({
421421
functionId: func['$id'],
@@ -439,7 +439,7 @@ const pushFunction = async ({ functionId, all, yes } = {}) => {
439439
})
440440

441441
updaterRow.update({ status: 'Pushed' })
442-
successfullyDeployed++;
442+
successfullyPushed++;
443443

444444
} catch (e) {
445445
switch (e.code) {
@@ -455,7 +455,7 @@ const pushFunction = async ({ functionId, all, yes } = {}) => {
455455

456456
Updater.stop();
457457

458-
success(`Pushed ${successfullyDeployed} functions`);
458+
success(`Pushed ${successfullyPushed} functions`);
459459
}
460460

461461
const createAttribute = async (databaseId, collectionId, attribute) => {

0 commit comments

Comments
 (0)