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 Bun + Typescript #769

Open
akefirad opened this issue Jul 7, 2024 · 3 comments
Open

Support Bun + Typescript #769

akefirad opened this issue Jul 7, 2024 · 3 comments

Comments

@akefirad
Copy link

akefirad commented Jul 7, 2024

Is your feature request related to a problem? Please describe.
Does node-config support Bun? If not, any plan to support it?
I'm not sure if this is a bug or lack of feature, I saw in one old issue people mentioned some failure while using node-config in Bun, but I suspect it's not in TS.

Describe the solution you'd like
I'd like to use node-config in Bun in TS. The current codebase works flawlessly with node-config in TS in Node. Migrating to Bun, it fails, complaining that it couldn't find ts-node in node_modules. (Looking at the code, this is not surprising since the parser for .ts files is indeed ts-node.)

Describe alternatives you've considered
Right now I converted all files to JSON, but the default file contains some logic (e.g. reading secrets from AWS SecretManager) which can't be converted to JSON. Converting it to JS does seem to be working. But it's a bit off to have a single JS file in a fully TS codebase.

Please tell us about your environment:

  • node-config version: 3.3.12
  • node-version: #N/A
  • bun-version: 1.1.18

Thanks.

@lorenwest
Copy link
Collaborator

I have not used Bun, but my guess is it'll work if you add ts-node to your package.json dependencies.

By default, node-config only loads a couple of parsers - JSON and JSON5. Every other parser has to be specified as a dependency in your package.json file. This is so every app doesn't download every parser that has ever been integrated.

There's a short mention of this in the docs, but documentation is for wimps ;)

@akefirad
Copy link
Author

akefirad commented Jul 8, 2024

Right, but that's kinda the point; if people use Bun then they don't have Node and (I'm guessing that) ts-node is not an option for them. So the idea is to use Bun instead of ts-node as a Parser. (I'm not sure if ts-node can utilize Bun instead of Node.)
Does that make sense?

@lorenwest
Copy link
Collaborator

None of this makes sense. If you're not using node.js for node-config, you're on your own.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants