Compare commits

...

11 Commits

Author SHA1 Message Date
Michael H
cff22e0b0e Merge branch 'main' into riskymh/bunfig 2025-01-21 12:32:41 +11:00
RiskyMH
ff632dbeb2 Revert "--config shouldn't have any point being optional now that its autoloaded"
done because technically its not needed, but this apprears to create more prpblems rn, will consider this change in followup (or allowing `-c` itself at very least)

This reverts commit dcbdb9766a.
2025-01-18 14:04:52 +01:00
Michael H
dcbdb9766a --config shouldn't have any point being optional now that its autoloaded 2025-01-18 20:14:01 +11:00
Michael H
fb3691c084 Merge branch 'main' into riskymh/bunfig 2025-01-18 20:11:12 +11:00
RiskyMH
4a32ac1d48 be better, everything else was install except bunx (so just add it there) 2025-01-08 15:19:35 +01:00
RiskyMH
c5a948c993 .installcommand already loads config itself 2025-01-08 14:49:14 +01:00
Michael H
10f11e1777 Merge branch 'main' into riskymh/bunfig 2025-01-09 00:25:06 +11:00
Michael H
2b022edf12 Merge branch 'main' into riskymh/bunfig 2025-01-08 17:16:32 +11:00
RiskyMH
82a7e9a620 docs 2024-12-05 08:34:27 +01:00
RiskyMH
7bace05844 more global 2024-12-05 08:27:07 +01:00
RiskyMH
70763f118e read bunfig more often 2024-12-05 08:20:28 +01:00
3 changed files with 18 additions and 28 deletions

View File

@@ -457,8 +457,6 @@ editor = "code"
The `bun run` command can be configured under the `[run]` section. These apply to the `bun run` command and the `bun` command when running a file or executable or script.
Currently, `bunfig.toml` isn't always automatically loaded for `bun run` in a local project (it does check for a global `bunfig.toml`), so you might still need to pass `-c` or `-c=bunfig.toml` to use these settings.
### `run.shell` - use the system shell or Bun's shell
The shell to use when running package.json scripts via `bun run` or `bun`. On Windows, this defaults to `"bun"` and on other platforms it defaults to `"system"`.

View File

@@ -23,7 +23,7 @@ const RegularExpression = bun.RegularExpression;
const builtin = @import("builtin");
const File = bun.sys.File;
const debug = Output.scoped(.CLI, true);
const debug = Output.scoped(.CLI, false);
const sync = @import("./sync.zig");
const Api = @import("api/schema.zig").Api;
@@ -397,7 +397,7 @@ pub const Arguments = struct {
var auto_loaded: bool = false;
if (config_path_.len == 0 and (user_config_path_ != null or
Command.Tag.always_loads_config.get(cmd) or
Command.Tag.loads_config.get(cmd) or
(cmd == .AutoCommand and
// "bun"
(ctx.positionals.len == 0 or
@@ -1141,6 +1141,11 @@ pub const Arguments = struct {
ctx.debug.silent = true;
}
// "run.bun" in bunfig.toml
if (args.flag("--bun")) {
ctx.debug.run_in_bun = true;
}
if (args.option("--elide-lines")) |elide_lines| {
if (elide_lines.len > 0) {
ctx.bundler_options.elide_lines = std.fmt.parseInt(usize, elide_lines, 10) catch {
@@ -1156,13 +1161,6 @@ pub const Arguments = struct {
}
}
if (cmd == .RunCommand or cmd == .AutoCommand or cmd == .BunxCommand) {
// "run.bun" in bunfig.toml
if (args.flag("--bun")) {
ctx.debug.run_in_bun = true;
}
}
opts.resolve = Api.ResolveMode.lazy;
ctx.bundler_options.experimental.html = args.flag("--experimental-html");
@@ -2572,14 +2570,19 @@ pub const Command = struct {
pub fn readGlobalConfig(this: Tag) bool {
return switch (this) {
.BunxCommand,
.PackageManagerCommand,
.BuildCommand,
.TestCommand,
.InstallCommand,
.AddCommand,
.RemoveCommand,
.UpdateCommand,
.PatchCommand,
.PatchCommitCommand,
.PackageManagerCommand,
.BunxCommand,
.AutoCommand,
.RunCommand,
.RunAsNodeCommand,
.OutdatedCommand,
.PublishCommand,
=> true,
@@ -2624,21 +2627,6 @@ pub const Command = struct {
.PublishCommand = true,
});
pub const always_loads_config: std.EnumArray(Tag, bool) = std.EnumArray(Tag, bool).initDefault(false, .{
.BuildCommand = true,
.TestCommand = true,
.InstallCommand = true,
.AddCommand = true,
.RemoveCommand = true,
.UpdateCommand = true,
.PatchCommand = true,
.PatchCommitCommand = true,
.PackageManagerCommand = true,
.BunxCommand = true,
.OutdatedCommand = true,
.PublishCommand = true,
});
pub const uses_global_options: std.EnumArray(Tag, bool) = std.EnumArray(Tag, bool).initDefault(true, .{
.CreateCommand = false,
.InstallCommand = false,

View File

@@ -354,6 +354,10 @@ pub const BunxCommand = struct {
true,
);
if (!ctx.debug.loaded_bunfig) {
try bun.CLI.Arguments.loadConfig(ctx.allocator, null, ctx, comptime .BunxCommand);
}
try Run.configurePathForRun(
ctx,
root_dir_info,