Skip to content

Commit e9f4cc9

Browse files
committed
Auto format CLI template
1 parent 0c86a8a commit e9f4cc9

File tree

4 files changed

+556
-556
lines changed

4 files changed

+556
-556
lines changed

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

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const awaitPools = {
4848
const { attributes: remoteAttributes } = await databasesListAttributes({
4949
databaseId,
5050
collectionId,
51-
queries: [ 'limit(100)' ],
51+
queries: ['limit(100)'],
5252
parseOutput: false
5353
});
5454

@@ -68,7 +68,7 @@ const awaitPools = {
6868
const { indexes: remoteIndexes } = await databasesListIndexes({
6969
databaseId,
7070
collectionId,
71-
queries: [ 'limit(100)' ],
71+
queries: ['limit(100)'],
7272
parseOutput: false
7373
});
7474

@@ -88,7 +88,7 @@ const awaitPools = {
8888
const { attributes: remoteAttributes } = await databasesListAttributes({
8989
databaseId,
9090
collectionId,
91-
queries: [ 'limit(100)' ],
91+
queries: ['limit(100)'],
9292
parseOutput: false
9393
});
9494

@@ -120,7 +120,7 @@ const awaitPools = {
120120
const { indexes: remoteIndexes } = await databasesListIndexes({
121121
databaseId,
122122
collectionId,
123-
queries: [ 'limit(100)' ],
123+
queries: ['limit(100)'],
124124
parseOutput: false
125125
});
126126

@@ -159,9 +159,9 @@ const deployFunction = async ({ functionId, all, yes } = {}) => {
159159

160160
const functionIds = [];
161161

162-
if(functionId) {
162+
if (functionId) {
163163
functionIds.push(functionId);
164-
} else if(all) {
164+
} else if (all) {
165165
const functions = localConfig.getFunctions();
166166
if (functions.length === 0) {
167167
throw new Error("No functions found in the current directory.");
@@ -171,22 +171,22 @@ const deployFunction = async ({ functionId, all, yes } = {}) => {
171171
}));
172172
}
173173

174-
if(functionIds.length <= 0) {
174+
if (functionIds.length <= 0) {
175175
const answers = await inquirer.prompt(questionsDeployFunctions[0]);
176176
functionIds.push(...answers.functions);
177177
}
178178

179179
let functions = functionIds.map((id) => {
180-
const functions = localConfig.getFunctions();
181-
const func = functions.find((f) => f.$id === id);
180+
const functions = localConfig.getFunctions();
181+
const func = functions.find((f) => f.$id === id);
182182

183-
if(!func) {
184-
throw new Error("Function '" + id + "' not found.")
185-
}
183+
if (!func) {
184+
throw new Error("Function '" + id + "' not found.")
185+
}
186186

187-
return func;
187+
return func;
188188
});
189-
189+
190190
for (let func of functions) {
191191
log(`Deploying function ${func.name} ( ${func['$id']} )`)
192192

@@ -196,22 +196,22 @@ const deployFunction = async ({ functionId, all, yes } = {}) => {
196196
parseOutput: false,
197197
});
198198

199-
if(response.runtime !== func.runtime) {
199+
if (response.runtime !== func.runtime) {
200200
throw new Error(`Runtime missmatch! (local=${func.runtime},remote=${response.runtime}) Please delete remote function or update your appwrite.json`);
201201
}
202202

203-
if(func.variables) {
203+
if (func.variables) {
204204
// Delete existing variables
205205

206206
// TODO: Pagination?
207207
const { variables: remoteVariables } = await functionsListVariables({
208208
functionId: func['$id'],
209-
queries: [ 'limit(100)' ],
209+
queries: ['limit(100)'],
210210
parseOutput: false
211211
});
212212

213-
if(remoteVariables.length > 0) {
214-
if(!yes) {
213+
if (remoteVariables.length > 0) {
214+
if (!yes) {
215215
const variableAnswers = await inquirer.prompt(questionsDeployFunctions[1])
216216

217217
if (variableAnswers.override !== "YES") {
@@ -417,21 +417,21 @@ const deployCollection = async ({ all, yes } = {}) => {
417417
let collectionIds = [];
418418
const configCollections = localConfig.getCollections();
419419

420-
if(all) {
420+
if (all) {
421421
if (configCollections.length === 0) {
422422
throw new Error("No collections found in the current directory. Run `{{ language.params.executableName }} init collection` to fetch all your collections.");
423423
}
424424
collectionIds.push(...configCollections.map((c) => c.$id));
425425
}
426426

427-
if(collectionIds.length <= 0) {
427+
if (collectionIds.length <= 0) {
428428
let answers = await inquirer.prompt(questionsDeployCollections[0])
429429
collectionIds.push(...answers.collections);
430430
}
431431

432432
let collections = [];
433433

434-
for(const collectionId of collectionIds) {
434+
for (const collectionId of collectionIds) {
435435
const idCollections = configCollections.filter((c) => c.$id === collectionId);
436436
collections.push(...idCollections);
437437
}
@@ -457,7 +457,7 @@ const deployCollection = async ({ all, yes } = {}) => {
457457
})
458458

459459
success(`Updated ${localDatabase.name} ( ${collection.databaseId} )`);
460-
} catch(err) {
460+
} catch (err) {
461461
log(`Database ${collection.databaseId} not found. Creating it now...`);
462462
const database = await databasesCreate({
463463
databaseId: collection.databaseId,
@@ -475,7 +475,7 @@ const deployCollection = async ({ all, yes } = {}) => {
475475
})
476476
log(`Collection ${collection.name} ( ${collection['$id']} ) already exists.`);
477477

478-
if(!yes) {
478+
if (!yes) {
479479
answers = await inquirer.prompt(questionsDeployCollections[1])
480480
if (answers.override !== "YES") {
481481
log(`Received "${answers.override}". Skipping ${collection.name} ( ${collection['$id']} )`);
@@ -489,7 +489,7 @@ const deployCollection = async ({ all, yes } = {}) => {
489489
const { indexes: remoteIndexes } = await databasesListIndexes({
490490
databaseId,
491491
collectionId: collection['$id'],
492-
queries: [ 'limit(100)' ],
492+
queries: ['limit(100)'],
493493
parseOutput: false
494494
});
495495

@@ -511,10 +511,10 @@ const deployCollection = async ({ all, yes } = {}) => {
511511
const { attributes: remoteAttributes } = await databasesListAttributes({
512512
databaseId,
513513
collectionId: collection['$id'],
514-
queries: [ 'limit(100)' ],
514+
queries: ['limit(100)'],
515515
parseOutput: false
516516
});
517-
517+
518518
await Promise.all(remoteAttributes.map(async attribute => {
519519
await databasesDeleteAttribute({
520520
databaseId,
@@ -633,21 +633,21 @@ const deployBucket = async ({ all, yes } = {}) => {
633633
let bucketIds = [];
634634
const configBuckets = localConfig.getBuckets();
635635

636-
if(all) {
636+
if (all) {
637637
if (configBuckets.length === 0) {
638638
throw new Error("No buckets found in the current directory. Run `appwrite init bucket` to fetch all your buckets.");
639639
}
640640
bucketIds.push(...configBuckets.map((b) => b.$id));
641641
}
642642

643-
if(bucketIds.length === 0) {
643+
if (bucketIds.length === 0) {
644644
let answers = await inquirer.prompt(questionsDeployBuckets[0])
645645
bucketIds.push(...answers.buckets);
646646
}
647647

648648
let buckets = [];
649649

650-
for(const bucketId of bucketIds) {
650+
for (const bucketId of bucketIds) {
651651
const idBuckets = configBuckets.filter((b) => b.$id === bucketId);
652652
buckets.push(...idBuckets);
653653
}
@@ -662,7 +662,7 @@ const deployBucket = async ({ all, yes } = {}) => {
662662
})
663663
log(`Bucket ${bucket.name} ( ${bucket['$id']} ) already exists.`);
664664

665-
if(!yes) {
665+
if (!yes) {
666666
answers = await inquirer.prompt(questionsDeployBuckets[1])
667667
if (answers.override !== "YES") {
668668
log(`Received "${answers.override}". Skipping ${bucket.name} ( ${bucket['$id']} )`);
@@ -720,21 +720,21 @@ const deployTeam = async ({ all, yes } = {}) => {
720720
let teamIds = [];
721721
const configTeams = localConfig.getTeams();
722722

723-
if(all) {
723+
if (all) {
724724
if (configTeams.length === 0) {
725725
throw new Error("No teams found in the current directory. Run `appwrite init team` to fetch all your teams.");
726726
}
727727
teamIds.push(...configTeams.map((t) => t.$id));
728728
}
729729

730-
if(teamIds.length === 0) {
730+
if (teamIds.length === 0) {
731731
let answers = await inquirer.prompt(questionsDeployTeams[0])
732732
teamIds.push(...answers.teams);
733733
}
734734

735735
let teams = [];
736736

737-
for(const teamId of teamIds) {
737+
for (const teamId of teamIds) {
738738
const idTeams = configTeams.filter((t) => t.$id === teamId);
739739
teams.push(...idTeams);
740740
}
@@ -749,7 +749,7 @@ const deployTeam = async ({ all, yes } = {}) => {
749749
})
750750
log(`Team ${team.name} ( ${team['$id']} ) already exists.`);
751751

752-
if(!yes) {
752+
if (!yes) {
753753
answers = await inquirer.prompt(questionsDeployTeams[1])
754754
if (answers.override !== "YES") {
755755
log(`Received "${answers.override}". Skipping ${team.name} ( ${team['$id']} )`);

0 commit comments

Comments
 (0)