Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Disable auto-detection of config file #13452

Closed
kitsonk opened this issue Jan 21, 2022 · 7 comments · Fixed by #14555
Closed

Disable auto-detection of config file #13452

kitsonk opened this issue Jan 21, 2022 · 7 comments · Fixed by #14555
Labels
cli related to cli/ dir suggestion suggestions for new features (yet to be agreed)

Comments

@kitsonk
Copy link
Contributor

kitsonk commented Jan 21, 2022

I don't see anything in the release notes about how to disable this feature. How can I prevent deno from walking the directory hierarchy and discovering configs?

Originally posted by @jsejcksn in #13313 (comment)

@crowlKats
Copy link
Member

maybe we should have --config take an optional value, so it would act as such:
deno run foo.ts -> no config detection
deno run --config foo.ts -> config detection
deno run --config=./bar.json foo.ts -> manual config

@jsejcksn
Copy link
Contributor

I like @crowlKats suggestion. Upon reading the release notes for 1.18.0, I was very surprised to see this behavior enabled: it appears to be a deviation in the project's historical philosophy of preferring explicitness over opaque/automatic/magic defaults.

@hayd
Copy link
Contributor

hayd commented Jan 25, 2022

This is also a problem with udd (and presumably other CLI scripts) which break if run in a directory with a incompatible deno.json: hayd/deno-udd#59

Edit: One workaround would be to be able to disable looking for a config as a flag (i.e. use default config).
Edit2: I'd also hoped to be able to do something like -c https://deno.land/std/deno.json, but that doesn't work.

@kitsonk
Copy link
Contributor Author

kitsonk commented Jan 25, 2022

Several of us have talked about support remote configuration files before, I believe we should. I have opened #13488 to cover that.

@kt3k
Copy link
Member

kt3k commented Jan 26, 2022

Summarizing hayd/deno-udd#59

  1. They develop frontend app, and deno.json has "lib": ["dom"]
  2. They try to update dependencies by udd. They run deno run https://deno.land/x/udd/main.ts
  3. Here deno.json for frontend app is detected and applied to udd and causes Cannot find name 'Deno'

I feel the auto detection at step 3 is a questionable behavior. deno.json is usually for local files in my view. Is it correct to always auto-detect deno.json even when the entry script is a remote file?

@kitsonk
Copy link
Contributor Author

kitsonk commented Jan 26, 2022

@kt3k in that scenario, I tend to agree. If the main specifier is a remote specifier, then we shouldn't attempt to auto-resolve a configuration file. The vision for the resolution was to resolve relative to the target of the script. So either we attempt to resolve the remote target, or better for now, don't auto resolve.

@stale
Copy link

stale bot commented Mar 27, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
cli related to cli/ dir suggestion suggestions for new features (yet to be agreed)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants