deno icon indicating copy to clipboard operation
deno copied to clipboard

`install` doesn't auto discover config file

Open vwkd opened this issue 2 years ago • 2 comments

It seems deno install currently doesn't auto-discover a deno.json or deno.jsonc config file.

This is suggested in the help entry for deno install -help.

    -c, --config <FILE>
            The configuration file can be used to configure different aspects of
            deno including TypeScript, linting, and code formatting. **Typically
            the configuration file will be called `deno.json` or `deno.jsonc`
            and automatically detected; in that case this flag is not necessary.**
            See
            https://deno.land/[email protected]/getting_started/configuration_file

Steps To Reproduce

deno install -n my-module main.ts

Expected Result

#!/bin/sh
# generated by deno install
exec deno run --config /Users/foo/.deno/bin/.my-module.deno.json 'file:///Users/foo/my-module/main.ts' "$@"

Actual Result

#!/bin/sh
# generated by deno install
exec deno run --no-config 'file:///Users/foo/my-module/main.ts' "$@"

vwkd avatar Jan 28 '23 15:01 vwkd

This is by design. When running deno install, it's very rare that someone would want it to pull in the config file from the local directory since deno install is a global action rather than a project based one. That said, perhaps it should do this if someone specifies a local file, but I'm not sure that's worth the effort to have different behaviour for considering most people won't be doing that and different behaviour depending on the file specified might create some confusion.

I believe the word "Typically" in the help text means "not always". That help text is shared across many sub commands.

dsherret avatar Jan 28 '23 19:01 dsherret

@dsherret Thanks for the clarification.

Maybe the help entry could mention which commands don't support config file auto-discovery?

Currently deno install --help suggest config file auto-discovery

-c, --config <FILE> The configuration file can be used to configure different aspects of deno including TypeScript, linting, and code formatting. Typically the configuration file will be called deno.json or deno.jsonc and automatically detected; in that case this flag is not necessary. See https://deno.land/[email protected]/getting_started/configuration_file

vwkd avatar Jan 29 '23 19:01 vwkd

Opened https://github.com/denoland/deno/issues/17855

dsherret avatar Feb 21 '23 17:02 dsherret