@@ -3,6 +3,7 @@ const { projectsList } = require('./commands/projects');
3
3
const { functionsListRuntimes } = require('./commands/functions');
4
4
const { accountListMfaFactors } = require("./commands/account");
5
5
const { sdkForConsole } = require("./sdks");
6
+ const { validateRequired } = require("./validations");
6
7
7
8
const { databasesList } = require('./commands/databases');
8
9
const JSONbig = require("json-bigint")({ storeAsString: false });
@@ -107,12 +108,6 @@ const getInstallCommand = (runtime) => {
107
108
return undefined;
108
109
};
109
110
110
- const deployValidate = (singular, items) => {
111
- if (items.length < = 0) {
112
- return `Please select at least one ${singular}`;
113
- }
114
- return true;
115
- }
116
111
117
112
const questionsInitProject = [
118
113
{
@@ -288,7 +283,7 @@ const questionsDeployFunctions = [
288
283
type: "checkbox",
289
284
name: "functions",
290
285
message: "Which functions would you like to deploy?",
291
- validate: (i ) => deployValidate ('function', i ),
286
+ validate: (value ) => validateRequired ('function', value ),
292
287
choices: () => {
293
288
let functions = localConfig.getFunctions();
294
289
if (functions.length === 0) {
@@ -315,7 +310,7 @@ const questionsDeployCollections = [
315
310
type: "checkbox",
316
311
name: "collections",
317
312
message: "Which collections would you like to deploy?",
318
- validate: (i ) => deployValidate ('collection', i ),
313
+ validate: (value ) => validateRequired ('collection', value ),
319
314
choices: () => {
320
315
let collections = localConfig.getCollections();
321
316
if (collections.length === 0) {
@@ -341,7 +336,7 @@ const questionsDeployBuckets = [
341
336
type: "checkbox",
342
337
name: "buckets",
343
338
message: "Which buckets would you like to deploy?",
344
- validate: (i ) => deployValidate ('bucket', i ),
339
+ validate: (value ) => validateRequired ('bucket', value ),
345
340
choices: () => {
346
341
let buckets = localConfig.getBuckets();
347
342
if (buckets.length === 0) {
@@ -382,7 +377,7 @@ const questionsDeployTeams = [
382
377
type: "checkbox",
383
378
name: "teams",
384
379
message: "Which teams would you like to deploy?",
385
- validate: (i ) => deployValidate ('team', i ),
380
+ validate: (value ) => validateRequired ('team', value ),
386
381
choices: () => {
387
382
let teams = localConfig.getTeams();
388
383
if (teams.length === 0) {
0 commit comments