diff options
author | 2022-05-30 03:49:42 -0700 | |
---|---|---|
committer | 2022-05-30 03:50:24 -0700 | |
commit | 882559f0b990566259144702578e2a44e4f3bef9 (patch) | |
tree | 9ed7a97999bd12a09bb2d4495234f56c96d92576 /src | |
parent | ca21c00f86b35be0099c2282a8462cdad0af9751 (diff) | |
download | bun-882559f0b990566259144702578e2a44e4f3bef9.tar.gz bun-882559f0b990566259144702578e2a44e4f3bef9.tar.zst bun-882559f0b990566259144702578e2a44e4f3bef9.zip |
Load `bunfig.toml` by default if `bun` or `bun {file}\.[cjt]sx?`
Fixes https://github.com/Jarred-Sumner/bun/issues/183
Diffstat (limited to 'src')
-rw-r--r-- | src/cli.zig | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/cli.zig b/src/cli.zig index e9bac1aac..ff1a00720 100644 --- a/src/cli.zig +++ b/src/cli.zig @@ -272,7 +272,14 @@ pub const Arguments = struct { var config_path_: []const u8 = user_config_path_ orelse ""; var auto_loaded: bool = false; - if (config_path_.len == 0 and (user_config_path_ != null or Command.Tag.always_loads_config.get(cmd))) { + if (config_path_.len == 0 and (user_config_path_ != null or + Command.Tag.always_loads_config.get(cmd) or + (cmd == .AutoCommand and + // "bun" + (ctx.positionals.len == 0 or + // "bun file.js" + ctx.positionals.len > 0 and options.defaultLoaders.has(std.fs.path.extension(ctx.positionals[0])))))) + { config_path_ = "bunfig.toml"; auto_loaded = true; } @@ -343,6 +350,7 @@ pub const Arguments = struct { } ctx.args.absolute_working_dir = cwd; + ctx.positionals = args.positionals(); if (comptime Command.Tag.loads_config.get(cmd)) { try loadConfigWithCmdArgs(cmd, allocator, args, ctx); @@ -397,7 +405,6 @@ pub const Arguments = struct { opts.no_summary = args.flag("--no-summary"); opts.disable_hmr = args.flag("--disable-hmr"); - ctx.positionals = args.positionals(); ctx.debug.silent = args.flag("--silent"); if (opts.port != null and opts.origin == null) { opts.origin = try std.fmt.allocPrint(allocator, "http://localhost:{d}/", .{opts.port.?}); @@ -444,7 +451,7 @@ pub const Arguments = struct { } if (opts.entry_points.len == 0) { - var entry_points = args.positionals(); + var entry_points = ctx.positionals; switch (comptime cmd) { .BunCommand => { |