made-in-common

install-pkg

Install package programmatically.

by made-in-common

TypeScript

TypeScript99.5%
JavaScript0.5%

Commit activity

Last 12 weeks · 6 commits

Full graph →

Community health

3 of 6 standards met

Community profile →
50
✓README✓License○Contributing✓Code of Conduct○Issue Template○PR Template
tutinoko2048

Describe the bug fails when the detected package manager is pnpm 12.4.1, and the same operation worked with pnpm 11.26.0. I think this issue is caused by a regression of pnpm, so I also posted issue: https://github.com/pnpm/pnpm/issues/14868 This issue can be solved when pnpm patches the issue. But for now, always fails to install package through pnpm. Error** Reproduction https://github.com/tutinoko2048/pnpm12-install-pkg-repro System Info Used Package Manager pnpm Validations [x] Follow our Code of Conduct [x] Read the Contributing Guide. [x] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate. [x] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead. [x] The provided reproduction is a minimal reproducible of the bug. Contributions [ ] I am willing to submit a PR to fix this issue [ ] I am willing to submit a PR with failing tests (actually just go ahead and do it, thanks!)

tutinoko2048 · 2mo ago
wingjie

🕘 Context When installPackage is called from a package inside a pnpm workspace, the original implementation only checked whether pnpm-workspace.yaml existed in the current working directory. This caused package installation to behave incorrectly when cwd pointed to a workspace subpackage, because the workspace root could not be detected automatically. 📚 Description This PR improves pnpm workspace handling in installPackage. What changed Resolve the pnpm workspace root by searching upward from the target directory. Detect the current package from its package.json. Use pnpm --filter install when the target package has a valid name. Fall back to pnpm -w install when the target package cannot be identified. Run pnpm commands from the workspace root when operating inside a monorepo. Keep the existing behavior unchanged for non-workspace projects and other package managers. Why This allows installPackage to work correctly when called from a nested package in a pnpm monorepo, while avoiding unintended installation at the wrong workspace level. ✅ Verification Verified pnpm workspace root detection from nested directories. Verified package installation using --filter for workspace packages. Verified fallback behavior when package.json is missing, has no name, or cannot be parsed. Existing npm/yarn behavior remains unchanged. ⚠️ Notes No API changes are introduced. The change is limited to pnpm workspace installation behavior.

wingjie · 2mo ago
Structured data for AI agents

Repository: made-in-common/install-pkg. Description: Install package programmatically. Stars: 205, Forks: 25. Primary language: TypeScript. Languages: TypeScript (99.5%), JavaScript (0.5%). License: MIT. Latest release: v2.1.0 (2mo ago). Open PRs: 0, open issues: 0. Last activity: 1d ago. Community health: 50%. Top contributors: antfu, benmccann, antfubot, SukkaW, ntnyq, otakustay, userquin, joshuajaco, Simon-He95, cimchd and others.