Skip to content

Commit d816f79

Browse files
committed
Merge branch 'refs/heads/feat-async-function-deployments' into feat-functions-deployment-status
# Conflicts: # templates/cli/lib/commands/push.js.twig
2 parents 1fb5d09 + 836e79c commit d816f79

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

src/SDK/Language/CLI.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ public function getFiles(): array
134134
],
135135
[
136136
'scope' => 'default',
137-
'destination' => 'lib/updater.js',
138-
'template' => 'cli/lib/updater.js.twig',
137+
'destination' => 'lib/spinner.js',
138+
'template' => 'cli/lib/spinner.js.twig',
139139
],
140140
[
141141
'scope' => 'default',

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const inquirer = require("inquirer");
22
const JSONbig = require("json-bigint")({ storeAsString: false });
33
const { Command } = require("commander");
44
const { localConfig } = require("../config");
5-
const { Updater, SPINNER_ARC, SPINNER_DOTS } = require('../updater');
5+
const { Spinner, SPINNER_ARC, SPINNER_DOTS } = require('../spinner');
66
const { paginate } = require('../paginate');
77
const { questionsPushBuckets, questionsPushTeams, questionsPushFunctions, questionsGetEntrypoint, questionsPushCollections, questionsConfirmPushCollections } = require("../questions");
88
const { actionRunner, success, log, error, commandDescriptions } = require("../parser");
@@ -273,8 +273,7 @@ const pushFunction = async ({ functionId, all, yes } = {}) => {
273273

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

279278
if (!func.entrypoint) {
280279
log(`Function ${func.name} does not have an endpoint`);
@@ -312,7 +311,7 @@ const pushFunction = async ({ functionId, all, yes } = {}) => {
312311
log('All functions are validated');
313312
log('Pushing functions\n');
314313

315-
Updater.start(false);
314+
Spinner.start(false);
316315
let successfullyPushed = 0;
317316
let successfullyDeployed = 0;
318317

@@ -321,7 +320,7 @@ const pushFunction = async ({ functionId, all, yes } = {}) => {
321320
let functionExists = false;
322321
let deploymentCreated = false;
323322

324-
const updaterRow = new Updater({ status: '', resource: func.name, id: func['$id'], end: `Ignoring using: ${ignore}` });
323+
const updaterRow = new Spinner({ status: '', resource: func.name, id: func['$id'], end: `Ignoring using: ${ignore}` });
325324

326325
updaterRow.update({ status: 'Getting' }).startSpinner(SPINNER_DOTS);
327326

@@ -498,7 +497,7 @@ const pushFunction = async ({ functionId, all, yes } = {}) => {
498497
updaterRow.stopSpinner();
499498
}));
500499

501-
Updater.stop();
500+
Spinner.stop();
502501

503502
success(`Pushed ${successfullyPushed} functions with ${successfullyDeployed} successfully deployed`);
504503
}

templates/cli/lib/updater.js.twig renamed to templates/cli/lib/spinner.js.twig

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ const spinners = {
1515
}
1616
}
1717

18-
class Updater {
18+
class Spinner {
1919
static start(clearOnComplete = true, hideCursor = true) {
20-
Updater.updatesBar = new progress.MultiBar({
20+
Spinner.updatesBar = new progress.MultiBar({
2121
format: this.#formatter,
2222
hideCursor,
2323
clearOnComplete,
@@ -27,7 +27,7 @@ class Updater {
2727
}
2828

2929
static stop() {
30-
Updater.updatesBar.stop();
30+
Spinner.updatesBar.stop();
3131
}
3232

3333
static #formatter(options, params, payload) {
@@ -54,7 +54,7 @@ class Updater {
5454
end = chalk.red(payload.errorMessage);
5555
}
5656

57-
return Updater.#line(prefix, start, middle, end);
57+
return Spinner.#line(prefix, start, middle, end);
5858
}
5959

6060
static #line(prefix, start, middle, end, separator = '•') {
@@ -63,7 +63,7 @@ class Updater {
6363
}
6464

6565
constructor(payload, total = 100, startValue = 0) {
66-
this.bar = Updater.updatesBar.create(total, startValue, payload)
66+
this.bar = Spinner.updatesBar.create(total, startValue, payload)
6767
}
6868

6969
update(payload) {
@@ -98,7 +98,7 @@ class Updater {
9898

9999

100100
module.exports = {
101-
Updater,
101+
Spinner,
102102
SPINNER_ARC,
103103
SPINNER_DOTS
104104
}

0 commit comments

Comments
 (0)