Skip to content

Commit

Permalink
fix: add error message for invalid plugin name
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Aug 31, 2022
1 parent c602bb4 commit ea8d9a3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/generators/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ export default class Plugin extends Generator {
type: 'input',
name: 'name',
message: 'Name (must start with plugin-)',
validate: (input: string): boolean => /plugin-[a-z]+$/.test(input),
validate: (input: string): boolean | string => {
const result = /plugin-[a-z]+$/.test(input);
if (result) return true;

return 'Name must start with plugin- and be lowercase';
},
when: (answers: { internal: boolean }): boolean => answers.internal,
},
{
Expand Down

0 comments on commit ea8d9a3

Please sign in to comment.