@pega/custom-dx-components
Version:
Utility for building custom UI components
63 lines (61 loc) • 1.72 kB
JavaScript
import { sanitize, validateSemver } from '../../util.js';
export const getInitProjectQuestions = () => {
return [
{
name: 'projectName',
message: 'Enter Project name (required)',
validate: value => {
/* value should not be empty
It should not have spaces
It should not start with a number
Only case-insensitive alphanumeric values are allowed
*/
if (value && !/^\d/.test(value) && value === sanitize(value)) {
return true;
}
return 'Only alphanumeric values are allowed, starting with alphabets';
}
},
{
name: 'organization',
message: 'Enter Organization name (required)',
validate: value => {
/* value should not be empty
It should not have spaces
It should not start with a number
Only case-insensitive alphanumeric values are allowed
*/
if (value && !/^\d/.test(value) && value === sanitize(value)) {
return true;
}
return 'Only alphanumeric values are allowed, starting with alphabets';
}
},
// {
// name: 'version',
// message: 'Version',
// default: '1.0.0',
// validate: value => {
// if (validateSemver(value)) {
// return true;
// }
// return 'Please provide semver compatible version e.g 0.0.1';
// }
// },
{
name: 'description',
message: 'Description',
default: ''
},
// {
// name: 'gitRepositoryUrl',
// message: 'Git repository url (optional)',
// default: ''
// },
{
name: 'author',
message: 'Author',
default: ''
}
];
};