mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-19 18:18:27 -05:00
feat(tools/scripts): test project create tool (#55247)
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
@@ -6,7 +6,7 @@ import { format } from 'prettier';
|
||||
import ObjectID from 'bson-objectid';
|
||||
|
||||
import { SuperBlocks } from '../../shared/config/superblocks';
|
||||
import { createStepFile } from './utils';
|
||||
import { createStepFile, validateBlockName } from './utils';
|
||||
import { getSuperBlockSubPath } from './fs-utils';
|
||||
import { Meta } from './helpers/project-metadata';
|
||||
|
||||
@@ -198,17 +198,9 @@ void prompt([
|
||||
{
|
||||
name: 'block',
|
||||
message: 'What is the dashed name (in kebab-case) for this project?',
|
||||
validate: (block: string) => {
|
||||
if (!block.length) {
|
||||
return 'please enter a dashed name';
|
||||
}
|
||||
if (/[^a-z0-9-]/.test(block)) {
|
||||
return 'please use alphanumerical characters and kebab case';
|
||||
}
|
||||
return true;
|
||||
},
|
||||
validate: validateBlockName,
|
||||
filter: (block: string) => {
|
||||
return block.toLowerCase();
|
||||
return block.toLowerCase().trim();
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user