Skip to content

feat: log auto-discovered config file and support configFile: false - #507

Merged
dsherret merged 2 commits into
denoland:mainfrom
dsherret:feat_config_file_auto_discovery
Jul 26, 2026
Merged

feat: log auto-discovered config file and support configFile: false#507
dsherret merged 2 commits into
denoland:mainfrom
dsherret:feat_config_file_auto_discovery

Conversation

@dsherret

@dsherret dsherret commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

Closes #399

The deno.json has been auto-discovered since 0.42 (#462), but there was no indication of which config file a build ended up using. Now it's logged:

[dnt] Transforming...
[dnt] Auto-discovered config file: /home/david/dev/my_project/deno.json
[dnt] Building project...

Additionally, configFile accepts false to opt out of the discovery entirely:

await build({
  // ...etc...
  configFile: false,
});

Details:

  • The discovery already searches upwards from the entry points rather than the cwd, so the reported path is the config file that was actually used.
  • Nothing is logged when a config file is explicitly provided, when an import map is provided (it's used as the config file), or when nothing was found.
  • configFile: false maps to ConfigDiscoveryOption::Disabled, which also stops a package.json and deno.lock from being discovered. That's documented on the option and in the readme.
  • configFile is now run through valueToUrl like importMap already was, so a plain path works instead of erroring while deserializing the specifier.
  • Also fixes set_config_file in the rust test builder, which was setting the import map instead of the config file. The one test relying on it is renamed to match what it covers and a sibling test was added for the import map path.

dsherret added 2 commits July 26, 2026 18:23
The deno.json is auto-discovered by searching upwards from the entry
points, but there was no indication of which config file was used, so
log it:

```
[dnt] Auto-discovered config file: /home/david/dev/my_project/deno.json
```

Additionally, allow opting out of the auto-discovery by specifying
`configFile: false`.

Claude-Session: https://claude.ai/code/session_01SqfDuWeEek5XnHSbXxCUE9
- document that `configFile: false` also disables discovering a
  package.json and deno.lock
- clarify when no config file is reported
- restore the jsr specifier mapping coverage for import maps, which
  `set_config_file` in the test builder was incorrectly providing

Claude-Session: https://claude.ai/code/session_01SqfDuWeEek5XnHSbXxCUE9
@dsherret
dsherret merged commit 9c71afe into denoland:main Jul 26, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto-resolve deno.json

1 participant