Add experimental support for pnpm and yarn#160
Conversation
There was a problem hiding this comment.
PR Overview
This PR introduces experimental support for pnmp and yarn by adjusting how the action command is executed based on the package manager. Key changes include:
- Updating the run command logic in src/commands/run.ts to handle different package manager invocations.
- Adding new tests in tests/utils/package.test.ts and updating the jest configuration.
- Implementing yarn unplugging and re-plugging logic alongside adjustments in dependency path resolving.
Reviewed Changes
| File | Description |
|---|---|
| tests/utils/package.test.ts | New tests added for verifying the ESM package detection function. |
| src/commands/run.ts | Extensive modifications to support conditional dependency resolution, including unplugging/re-plugging for yarn. |
| jest.config.ts | Updated coverage ignore patterns to exclude additional files. |
| src/utils/package.ts | Minor update: adding an istanbul-ignore comment before directory pop. |
| fixtures/fs.ts | Added mocks for existsSync and readFileSync to support tests. |
| tests/commands/run.test.ts | Tests for the run command were completely removed. |
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
tests/commands/run.test.ts:1
- The removal of tests in tests/commands/run.test.ts appears to decrease the coverage for the run command functionality. Consider adding tests to validate the behavior of action() after these experimental changes.
import { jest } from '@jest/globals'
Tip: Copilot only keeps its highest confidence comments to reduce noise and keep you focused. Learn more
🦙 MegaLinter status: ❌ ERROR
See detailed report in MegaLinter reports |
There was a problem hiding this comment.
PR Overview
This PR introduces experimental support for pnpm and yarn by adjusting how the action command is invoked based on the package manager and its version. Key changes include:
- Updating the command invocation logic in src/commands/run.ts to accommodate npm, pnpm, and yarn.
- Modifying tests, changelog, and configuration files to reflect the new behavior.
- Removing the tests/commands/run.test.ts file, potentially affecting test coverage of the run command.
Reviewed Changes
| File | Description |
|---|---|
| tests/utils/package.test.ts | Added tests for the isESM utility function. |
| CHANGELOG.md | Updated changelog to document experimental support for pnpm and yarn. |
| src/commands/run.ts | Revised logic for determining module paths and handling different package managers. |
| jest.config.ts | Expanded coveragePathIgnorePatterns to include new and modified files. |
| README.md | Updated reference to the changelog. |
| src/utils/package.ts | Minor update to add a missing istanbul ignore comment. |
| fixtures/fs.ts | Extended mocks to include existsSync and readFileSync functions. |
| tests/commands/run.test.ts | Entire test file removed, affecting test coverage for run command. |
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (2)
CHANGELOG.md:5
- The package manager name 'pnmp' appears to be a typo; it should be 'pnpm' to match the proper name and usage in the code.
This version adds **experimental** support for [pnmp](https://pnpm.io/) and
tests/commands/run.test.ts:1
- The removal of this test file reduces coverage for the run command behavior. Please ensure that critical scenarios remain adequately tested.
Entire file removed
Tip: Copilot code review supports C#, Go, Java, JavaScript, Markdown, Python, Ruby and TypeScript, with more languages coming soon. Learn more

This PR adds experimental support for pnpm and yarn.
Depending on the package manager and version, the invocation of the
tsxcommand that drives@github/local-actionis invoked differently.npmnpm execpnpmpnpm dlxyarn<= 3yarn execyarn>= 4yarn dlxAlongside this, yarn PnP support is implemented via unplugging any modules stubbed by
@github/local-actionand "re-plugging" after completion of the action run.