oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.24k stars 2.69k forks source link

File not found when running `bun --config bunfig.toml` #13070

Open joas8211 opened 1 month ago

joas8211 commented 1 month ago

What version of Bun is running?

1.1.21+70ca2b76c

What platform is your computer?

Linux 6.6.40-2-lts x86_64 unknown

What steps can reproduce the bug?

  1. Open an project folder with an empty bunfig.toml file.
  2. Run bun --config bunfig.toml

What is the expected behavior?

I'm expected to see list of possible commands outputted like when --config is not specified. Like so:

Bun is a fast JavaScript runtime, package manager, bundler, and test runner. (1.1.21+70ca2b76c)

Usage: bun <command> [...flags] [...args]

Commands:
  run       ./my-script.ts       Execute a file with Bun
            lint                 Run a package.json script
  test                           Run unit tests with Bun
  x         eslint               Execute a package binary (CLI), installing if needed (bunx)
  repl                           Start a REPL session with Bun
  exec                           Run a shell script directly with Bun

  install                        Install dependencies for a package.json (bun i)
  add       tailwindcss          Add a dependency to package.json (bun a)
  remove    babel-core           Remove a dependency from package.json (bun rm)
  update    elysia               Update outdated dependencies
  link      [<package>]          Register or link a local npm package
  unlink                         Unregister a local npm package
  patch <pkg>                    Prepare a package for patching
  pm <subcommand>                Additional package management utilities

  build     ./a.ts ./b.jsx       Bundle TypeScript & JavaScript into a single file

  init                           Start an empty Bun project from a blank template
  create    next-app             Create a new project from a template (bun c)
  upgrade                        Upgrade to latest version of Bun.
  <command> --help               Print help text for command.

Learn more about Bun:            https://bun.sh/docs
Join our Discord community:      https://bun.sh/discord

What do you see instead?

error: File not found: "bunfig.toml"

Additional information

I suspect this is the reason why project configuration options from bunfig.toml don't apply also when --config is not specified, like in these issues: #12990, #11445

Issue #12753 suggests also that some validation is happening before not found error is outputted.

Following issue could also be related to this: #12987.

vktrl commented 1 month ago

You need to use this syntax: bun --config="bunfig.toml", otherwise the last arg is interpreted as the entrypoint.