|
| 1 | +'use strict'; |
| 2 | + |
| 3 | +// Modules |
| 4 | +const _ = require('lodash'); |
| 5 | +const dayjs = require('dayjs'); |
| 6 | + |
| 7 | +// Things the contributor helps with |
| 8 | +const eventTypes = [ |
| 9 | + {name: 'Conference, National, 500+ people', value: 'conference'}, |
| 10 | + {name: 'Camp, Regional, 100+ people', value: 'camp'}, |
| 11 | + {name: 'Meetup, Local, 10+ people', value: 'meetup'}, |
| 12 | + {name: 'Other', value: 'other'}, |
| 13 | +]; |
| 14 | + |
| 15 | +// Options for adding a contrib |
| 16 | +exports.addOptions = authors => ({ |
| 17 | + name: { |
| 18 | + describe: 'Event name', |
| 19 | + string: true, |
| 20 | + interactive: { |
| 21 | + type: 'input', |
| 22 | + message: 'Event name?', |
| 23 | + default: 'My Event', |
| 24 | + }, |
| 25 | + }, |
| 26 | + presenter: { |
| 27 | + describe: 'Event presenter', |
| 28 | + string: true, |
| 29 | + choices: authors, |
| 30 | + interactive: { |
| 31 | + type: 'list', |
| 32 | + message: 'Featuring?', |
| 33 | + default: 'Team Lando', |
| 34 | + choices: authors, |
| 35 | + }, |
| 36 | + }, |
| 37 | + date: { |
| 38 | + describe: 'Event date', |
| 39 | + string: true, |
| 40 | + interactive: { |
| 41 | + type: 'input', |
| 42 | + message: 'Event date (use format YYYY-MM-DD)', |
| 43 | + default: dayjs().format('YYYY-MM-DD'), |
| 44 | + filter: input => dayjs(input).format('YYYY-MM-DD'), |
| 45 | + validate: input => { |
| 46 | + return (dayjs(input).isValid()) ? true : 'Enter a valid date'; |
| 47 | + }, |
| 48 | + }, |
| 49 | + }, |
| 50 | + summary: { |
| 51 | + describe: 'Event summary', |
| 52 | + string: true, |
| 53 | + interactive: { |
| 54 | + type: 'input', |
| 55 | + default: 'A longer and SEO dense summary', |
| 56 | + message: 'Event summary?', |
| 57 | + validate: input => { |
| 58 | + if (_.size(input) > 280) return 'Must be 280 characters or less!'; |
| 59 | + return true; |
| 60 | + }, |
| 61 | + }, |
| 62 | + }, |
| 63 | + type: { |
| 64 | + describe: 'Event Type', |
| 65 | + array: true, |
| 66 | + alias: ['t'], |
| 67 | + choices: eventTypes, |
| 68 | + interactive: { |
| 69 | + type: 'list', |
| 70 | + default: 'meetup', |
| 71 | + message: 'Event type or size', |
| 72 | + choices: eventTypes, |
| 73 | + }, |
| 74 | + }, |
| 75 | + location: { |
| 76 | + describe: 'Event location', |
| 77 | + string: true, |
| 78 | + interactive: { |
| 79 | + type: 'input', |
| 80 | + message: 'Location? (examples: San Francisco, MIT)', |
| 81 | + }, |
| 82 | + }, |
| 83 | + url: { |
| 84 | + describe: 'Event details URL', |
| 85 | + string: true, |
| 86 | + interactive: { |
| 87 | + type: 'input', |
| 88 | + message: 'URL of event details?', |
| 89 | + }, |
| 90 | + }, |
| 91 | +}); |
0 commit comments