@schemifyjs/cli
Version:
Official CLI for SchemifyJS.
18 lines (17 loc) • 651 B
JavaScript
import { ValidationError } from '../../utils/error-handler.js';
export function ensureProjectNameProvided(name) {
if (!name) {
throw new ValidationError('You must specify a project name.', [
'Example: schemify new my-project',
'The name must be valid for a project directory'
]);
}
}
export function validateCliProjectName(name) {
if (!/^[a-zA-Z0-9_-]+$/.test(name)) {
throw new ValidationError('The project name contains invalid characters.', [
'Use only letters, numbers, hyphens (-) and underscores (_)',
'Example: schemify new my-project-123'
]);
}
}