fix: set proper env_behavior defaults for different commands

- Build command uses .disable as default (env vars handled via define mechanism)
- Run/Test/other commands use .load_all_without_inlining as default
- This ensures .env files are loaded by default for run command while bundler tests still pass

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude Bot
2025-09-06 02:02:07 +00:00
parent a53ac1f152
commit 5ec48f3d4b

View File

@@ -414,7 +414,7 @@ pub const Command = struct {
production: bool = false,
env_behavior: api.DotEnvBehavior = .load_all_without_inlining,
env_behavior: api.DotEnvBehavior = .disable,
env_prefix: []const u8 = "",
elide_lines: ?usize = null,
// Compile options
@@ -433,6 +433,13 @@ pub const Command = struct {
.allocator = allocator,
};
global_cli_ctx = &context_data;
// Set appropriate default env_behavior based on command
// Build command uses .disable as default (env vars handled via define mechanism)
// Run/Test/other commands use .load_all_without_inlining as default
if (comptime command != .BuildCommand) {
global_cli_ctx.bundler_options.env_behavior = .load_all_without_inlining;
}
if (comptime Command.Tag.uses_global_options.get(command)) {
global_cli_ctx.args = try Arguments.parse(allocator, global_cli_ctx, command);