As of now, if I generate a new file with nest g, its is named name.type.ts (e.g. my.module.ts).
I'd like the tool to create a file named NameType.ts (e.g. MyModule.ts) so that it matches the name of the class it contains.
Ideally, a fileNameCase configuration option in nest-cli.json of type "dot" | "pascal" | "camel" | "snake" | "kebab" would be nice.
nest g mo my generates a file named my.module.ts
All of my company source files are named with the same name as the classes that they include. It's a common convention we see in a lot of OOP projects.
Side-demand. It would be nice to also support naming test files with .test.ts instead of .spec.ts via a testFileExtension option too.
Side-demand. It would be nice to also support naming test files with .test.ts instead of .spec.ts via a testFileExtension option too.
We're tracking this here https://github.com/nestjs/schematics/issues/143
If a fileNameCase is introduced, should it only affect filenames, as suggested by the option name? What about directory names, if you specify that in the generate command, such as nest g controller auth-dir/users_dir/users --no-spec?
Should there also be introduced a directoryNameCase option? or should it just be a nameCase option that affect both files and directories?
Something like https://www.npmjs.com/package/change-case could help implement the solution without having to worry about correct case convertions
this would be a very nice addition. having to switch to kabob case is a huge pain for our team
Most helpful comment
We're tracking this here https://github.com/nestjs/schematics/issues/143