Bun: re-generate the lock file when we go to install for the first time or in CI#414
Bun: re-generate the lock file when we go to install for the first time or in CI#414
Conversation
WalkthroughA new function, Changes
Poem
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
internal/bundler/bundler.go (1)
144-154: Simplify function signature by removing redundant logger parameter.The function accepts a
logger.Loggerparameter but it's always called withctx.Logger. Since the function already has access to theBundleContext, this parameter is redundant and adds unnecessary complexity.Apply this diff to simplify the function signature:
-func generateBunLockfile(ctx BundleContext, logger logger.Logger, dir string) error { +func generateBunLockfile(ctx BundleContext, dir string) error { args := []string{"install", "--lockfile-only"} install := exec.CommandContext(ctx.Context, "bun", args...) install.Dir = dir out, err := install.CombinedOutput() if err != nil { return fmt.Errorf("failed to generate bun lockfile: %w. %s", err, string(out)) } - logger.Debug("re-generated bun lockfile: %s", strings.TrimSpace(string(out))) + ctx.Logger.Debug("re-generated bun lockfile: %s", strings.TrimSpace(string(out))) return nil }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
internal/bundler/bundler.go(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: Test CLI Upgrade Path (windows-latest)
- GitHub Check: Test CLI Upgrade Path (blacksmith-4vcpu-ubuntu-2204-arm)
- GitHub Check: Test CLI Upgrade Path (blacksmith-4vcpu-ubuntu-2204)
- GitHub Check: Build and Test (blacksmith-4vcpu-ubuntu-2204-arm)
- GitHub Check: Build and Test (blacksmith-4vcpu-ubuntu-2204)
- GitHub Check: Build and Test (macos-latest)
- GitHub Check: Analyze (go)
- GitHub Check: Analyze (actions)
🔇 Additional comments (1)
internal/bundler/bundler.go (1)
164-168: LGTM! Well-integrated lockfile generation call.The placement of the
generateBunLockfilecall before the actualbun installcommand is appropriate and aligns with the PR objective. The explanatory comments clearly document why this step is necessary. Error handling is properly implemented with early return on failure.Note: Update the function call if you apply the suggested refactor above:
- if err := generateBunLockfile(ctx, ctx.Logger, dir); err != nil { + if err := generateBunLockfile(ctx, dir); err != nil {
Summary by CodeRabbit