Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function run(ComponentName) {
if (!ComponentName) {
throw new Error(`
Please supply a component name!
'npm run add-component -- YourComponentName'
`);
} else if (!changeCase.isUpperCase(ComponentName[0])) {
throw new Error(`
Custom React components need to be in PascalCase.
You provided ${ComponentName}.
Please capitalize the first letter:
"${changeCase.upperCaseFirst(ComponentName)}"
`);
}
const componentDirectory = path.join(
__dirname,
'../src/components',
ComponentName
);
createDirectory(componentDirectory);
function run(ComponentName) {
if (!ComponentName) {
throw new Error(`
Please supply a component name!
'npm run add-component -- YourComponentName'
`);
} else if (!changeCase.isUpperCase(ComponentName[0])) {
throw new Error(`
Custom React components need to be in PascalCase.
You provided ${ComponentName}.
Please capitalize the first letter:
"${changeCase.upperCaseFirst(ComponentName)}"
`);
}
const componentDirectory = path.join(
__dirname,
'../../presentation/components',
ComponentName
);
createDirectory(componentDirectory);
function run(ComponentName) {
if (!ComponentName) {
throw new Error(`
Please supply a component name!
'npm run add-component -- YourComponentName'
`);
} else if (!changeCase.isUpperCase(ComponentName[0])) {
throw new Error(`
Custom React components need to be in PascalCase.
You provided ${ComponentName}.
Please capitalize the first letter:
"${changeCase.upperCaseFirst(ComponentName)}"
`);
}
const componentDirectory = path.join(
__dirname,
'../../src/components',
ComponentName
);
createDirectory(componentDirectory);