-
-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using camel case with kanel-kysely #547
Comments
I don't have any experience with that plugin but you can solve almost anything by writing a pre-render hook. |
For future readers: import { camelCase } from 'change-case';
import kanel, { type Output } from 'kanel';
import kanelKysely from 'kanel-kysely';
const camelCaseHook = (output: Output): Output =>
Object.fromEntries(
Object.entries(output).map(([path, fileContents]) => [
path,
{
...fileContents,
declarations: fileContents.declarations.map((declaration) =>
declaration.declarationType === 'interface' ?
{
...declaration,
properties: declaration.properties.map((property) => ({
...property,
name: camelCase(property.name),
})),
}
: declaration,
),
},
]),
);
await kanel.processDatabase({
// ...
preRenderHooks: [kanelKysely.makeKyselyHook(), camelCaseHook],
}); Maybe this hook could come bundled with |
I'd be happy to if this is something that is common. The thing is that I don't really use Kysely myself, so I just provided what appeared to be what is expected. PR's from people with proper knowledge are very welcomed! :-) |
alecmev
added a commit
to alecmev/kanel
that referenced
this issue
May 28, 2024
Merged
alecmev
added a commit
to alecmev/kanel
that referenced
this issue
Jun 10, 2024
kristiandupont
pushed a commit
that referenced
this issue
Jun 11, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I want to use Kyselys CamelCasePlugin, how can I generate the types with Kanel accordingly? Is there some sort of workaround in place?
The text was updated successfully, but these errors were encountered: