-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
proposal: Deno.configPath(): string | undefined
#19322
Comments
Ref: #15482 |
This would be nice. Perhaps this should be a just |
in the referenced issue by @crowlKats there is also the discussion of getting not just the config path but also the config data. That is not part of this proposal, but probably will be discussed in future proposal. |
Having a |
@iuioiua That would be true if it was just
And who knows if the config file changes again as it did by adding |
You could use a
When configs were added in Here's the way I see the config path / parsed config file argument: Config Path
Config Data
|
These are very nice pro/contra tables, I agree with most of the points made.
Maybe there is a use case where just the config file location is needed. If both data and path are exposed, there is nothing that stops the user from parsing it themselves if desired. But most use cases I can imagine also need to parse the file, so this seems like an unnecessary added step.
I guess so, but Deno resolves and uses the config file data internally, so couldn't it just be branched off and exposed from that?
These two issues would be solved when we declare that |
Closing in favor of #24628. |
It's good we never added this API because with workspaces there are now many different configs. |
I think |
There probably needs to be a Wasm build of https://github.com/denoland/deno_config eventually (which is being renamed to deno_workspace soon). |
The purpose of this function is to expose the path of the Deno configuration file (
deno.json
) that the current script is using. Such functionality would be ideal in a script that needs to know where this file is.For example, Fresh uses the
deno.json
file to start the server but uses a hardcoded path. Instead, it could callDeno.configPath()
. This would become particularly useful whendeno.json
is in a different folder than other files that depend on it.Related: #961
The text was updated successfully, but these errors were encountered: