Skip to content

Commit

Permalink
feat(nextjs): add pascal case options for Next.js component generators
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysoo authored and Jack Hsu committed Oct 18, 2022
1 parent ed05ca3 commit 5e654dc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/next/src/generators/component/component.ts
Expand Up @@ -10,6 +10,8 @@ interface Schema {
style: SupportedStyles;
directory?: string;
flat?: boolean;
pascalCaseFiles?: boolean;
pascalCaseDirectory?: boolean;
}

function getDirectory(host: Tree, options: Schema) {
Expand All @@ -31,7 +33,6 @@ export async function componentGenerator(host: Tree, options: Schema) {
const componentInstall = await reactComponentGenerator(host, {
...options,
directory: getDirectory(host, options),
pascalCaseFiles: false,
classComponent: false,
routing: false,
});
Expand Down
12 changes: 12 additions & 0 deletions packages/next/src/generators/component/schema.json
Expand Up @@ -86,6 +86,18 @@
"type": "boolean",
"description": "Create component at the source root rather than its own directory.",
"default": false
},
"pascalCaseFiles": {
"type": "boolean",
"description": "Use pascal case component file name (e.g. `App.tsx`).",
"alias": "P",
"default": false
},
"pascalCaseDirectory": {
"type": "boolean",
"description": "Use pascal case directory name (e.g. `App/App.tsx`).",
"alias": "R",
"default": false
}
},
"required": ["name", "project"],
Expand Down

0 comments on commit 5e654dc

Please sign in to comment.