@@ -107,6 +107,13 @@ const getInstallCommand = (runtime) => {
107
107
return undefined;
108
108
};
109
109
110
+ const deployValidate = (singular, items) => {
111
+ if (items.length < = 0) {
112
+ return `Please select at least one ${singular}`;
113
+ }
114
+ return true;
115
+ }
116
+
110
117
const questionsInitProject = [
111
118
{
112
119
type: "confirm",
@@ -209,12 +216,12 @@ const questionsInitFunction = [
209
216
parseOutput: false
210
217
})
211
218
let runtimes = response["runtimes"]
212
- let choices = runtimes.map((runtime, idx) => {
219
+ let choices = runtimes.map((runtime, idx) => {
213
220
return {
214
221
name: `${runtime.name} (${runtime['$id']})`,
215
- value: {
216
- id: runtime['$id'],
217
- entrypoint: getEntrypoint(runtime['$id']),
222
+ value: {
223
+ id: runtime['$id'],
224
+ entrypoint: getEntrypoint(runtime['$id']),
218
225
ignore: getIgnores(runtime['$id']),
219
226
commands : getInstallCommand(runtime['$id'])
220
227
},
@@ -281,6 +288,7 @@ const questionsDeployFunctions = [
281
288
type: "checkbox",
282
289
name: "functions",
283
290
message: "Which functions would you like to deploy?",
291
+ validate: (i) => deployValidate('function', i),
284
292
choices: () => {
285
293
let functions = localConfig.getFunctions();
286
294
if (functions.length === 0) {
@@ -307,6 +315,7 @@ const questionsDeployCollections = [
307
315
type: "checkbox",
308
316
name: "collections",
309
317
message: "Which collections would you like to deploy?",
318
+ validate: (i) => deployValidate('collection', i),
310
319
choices: () => {
311
320
let collections = localConfig.getCollections();
312
321
if (collections.length === 0) {
@@ -332,6 +341,7 @@ const questionsDeployBuckets = [
332
341
type: "checkbox",
333
342
name: "buckets",
334
343
message: "Which buckets would you like to deploy?",
344
+ validate: (i) => deployValidate('bucket', i),
335
345
choices: () => {
336
346
let buckets = localConfig.getBuckets();
337
347
if (buckets.length === 0) {
@@ -372,6 +382,7 @@ const questionsDeployTeams = [
372
382
type: "checkbox",
373
383
name: "teams",
374
384
message: "Which teams would you like to deploy?",
385
+ validate: (i) => deployValidate('team', i),
375
386
choices: () => {
376
387
let teams = localConfig.getTeams();
377
388
if (teams.length === 0) {
@@ -403,7 +414,7 @@ const questionsListFactors = [
403
414
sdk: client,
404
415
parseOutput: false
405
416
});
406
-
417
+
407
418
const choices = [
408
419
{
409
420
name: `TOTP (Time-based One-time Password)`,
0 commit comments