Skip to content

Conversation

@mxcl
Copy link
Member

@mxcl mxcl commented Mar 29, 2025

thus shim mash shims to mash* but shim mash^0.3 shims to ^0.3

@mxcl mxcl requested review from Copilot and jhheider March 29, 2025 13:55
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the pkgm shim functionality to preserve package constraints as passed in through the arguments, ensuring that a package’s constraint is maintained when shimming.

  • Refactors the loop to process arguments instead of iterating on json.pkgs.
  • Stores and applies semantic version constraints when building the shim command.

if (pkgs.length > 1) throw new Error(`ambiguous pkg: ${arg}`);
args_pkgs[pkgs[0].project] = utils.pkg.parse(arg).constraint;
projects_we_care_about.push(pkgs[0].project);
const companions = await hooks.usePantry().project(pkgs[0]).companions();
Copy link

Copilot AI Mar 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The project() call is passed pkgs[0] instead of pkgs[0].project; this may cause runtime errors if the function expects a project identifier string.

Suggested change
const companions = await hooks.usePantry().project(pkgs[0]).companions();
const companions = await hooks.usePantry().project(pkgs[0].project).companions();

Copilot uses AI. Check for mistakes.
@mxcl mxcl force-pushed the shim-preserves-constraints branch 3 times, most recently from 4083102 to 2d616c4 Compare March 29, 2025 16:24
thus `shim mash` shims to `mash*` but `shim mash^0.3` shims to ^0.3
@mxcl mxcl force-pushed the shim-preserves-constraints branch from 2d616c4 to 91cf106 Compare March 29, 2025 16:41
@mxcl mxcl merged commit 43e2381 into main Mar 29, 2025
3 checks passed
@mxcl mxcl deleted the shim-preserves-constraints branch March 29, 2025 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants