Skip to content

Commit 87e88c3

Browse files
committed
chore(cli): Adapting pull request
1 parent 2962472 commit 87e88c3

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ const pullResources = async () => {
2929
}
3030
} else {
3131
const answers = await inquirer.prompt(questionsPullResources[0]);
32-
answers.resources.forEach((resource) => {
32+
33+
for (let resource of answers.resources) {
3334
const action = actions[resource];
3435
if (action !== undefined) {
35-
action();
36+
await action();
3637
}
37-
})
38+
}
3839
}
3940
};
4041

@@ -112,10 +113,9 @@ const pullCollection = async () => {
112113

113114
if (databases.length === 0) {
114115
if (cliConfig.all) {
115-
databases = (await paginate(databasesList, { parseOutput: false }, 100, 'databases')).databases.map(database=>database.$id);
116-
} else{
116+
databases = (await paginate(databasesList, { parseOutput: false }, 100, 'databases')).databases.map(database => database.$id);
117+
} else {
117118
databases = (await inquirer.prompt(questionsPullCollection)).databases;
118-
}
119119
}
120120
}
121121

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -290,18 +290,18 @@ const pushResources = async () => {
290290
}
291291

292292
if (cliConfig.all) {
293-
for(let action of Object.values(actions)){
293+
for (let action of Object.values(actions)) {
294294
await action();
295295
}
296296
} else {
297297
const answers = await inquirer.prompt(questionsPushResources[0]);
298298

299-
answers.resources.forEach((resource) => {
299+
for (let resource of answers.resources) {
300300
const action = actions[resource];
301301
if (action !== undefined) {
302-
await action();
302+
await action();
303303
}
304-
})
304+
}
305305
}
306306
};
307307

@@ -932,15 +932,14 @@ const pushCollection = async () => {
932932
databaseId: collection['databaseId'],
933933
collectionId: collection['$id'],
934934
parseOutput: false,
935-
});
936935
});
937936

938937
if (remoteCollection.name !== collection.name) {
939938
await databasesUpdateCollection({
940939
databaseId: collection['databaseId'],
941940
collectionId: collection['$id'],
942941
name: collection.name,
943-
name: collection.name,
942+
name: collection.name,
944943
parseOutput: false
945944
})
946945

@@ -949,7 +948,8 @@ const pushCollection = async () => {
949948
collection.remoteVersion = remoteCollection;
950949

951950
collection.isExisted = true;
952-
} catch (e) {
951+
} catch
952+
(e) {
953953
if (Number(e.code) === 404) {
954954
log(`Collection ${collection.name} does not exist in the project. Creating ... `);
955955
await databasesCreateCollection({
@@ -966,7 +966,7 @@ const pushCollection = async () => {
966966
}
967967
}))
968968

969-
// Serialize attribute actions
969+
// Serialize attribute actions
970970
for (let collection of collections) {
971971
let attributes = collection.attributes;
972972

0 commit comments

Comments
 (0)