Skip to content
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

Support for arbitrary/more extensions (.mts, .cts, .mjs,…) #123

Open
JulianCataldo opened this issue Jun 17, 2024 · 2 comments
Open

Support for arbitrary/more extensions (.mts, .cts, .mjs,…) #123

JulianCataldo opened this issue Jun 17, 2024 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@JulianCataldo
Copy link

Hey,
I love this project, thanks for your hard work!

I wonder if it's possible to add any kind extensions to the CLI, like you could with Prettier or ESLint.
Actually, it's only for .js or .ts`, meaning you can't use some files in a lot of projects.

At least, standard extensions : ctsx, cjsx, js, ts, mts, cts, mjs, cjs (I hope I haven't forgot one 😅) would be awesome.

Bye

@JasonShin
Copy link
Owner

Thanks for the idea, this is interesting

I can potentially extend https://github.com/JasonShin/sqlx-ts/blob/953ee1c47da9c9e113e0c4dbeba45d411b5c6f93/src/common/cli.rs#L28C9-L28C12 to support the additional JS types.

jsx/tsx is a tricky one because that requires a whole lot of work in the parser to grab sql string literals - (maybe or maybe not)

@JulianCataldo
Copy link
Author

No worries for the JSX/TSX part. I think that, conceptually, this is not the typical place where you should put sql queries ;)
I think most dev will agree, even more if it add difficulty for dev/maintenance.

I tried sqlx-ts with ESM and CommonJS, and excluding the file extension issue, it went smoothly.

@JasonShin JasonShin added enhancement New feature or request good first issue Good for newcomers labels Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants