CLI to switch pnpm dependencies between local, GitHub, and NPM sources.
npm install -g pnpm-dep-source
# or
pnpm add -g pnpm-dep-source# In your project directory
pnpm-dep-source init ../../path/to/local/pkg -g github-user/repo
# Or with alias
pds init ../../path/to/local/pkg -g github-user/repopds local <dep> # or pds l <dep>This will:
- Set
package.jsondependency toworkspace:* - Create/update
pnpm-workspace.yamlwith the local path - Add to
vite.config.tsoptimizeDeps.exclude(if vite config exists) - Run
pnpm install
pds github <dep> # Uses r/dist branch HEAD (resolved to SHA)
pds github <dep> main # Uses specific ref
pds gh <dep> -s v1.0.0 # Resolves tag to SHAThis will:
- Set
package.jsondependency togithub:user/repo#sha - Remove local path from
pnpm-workspace.yaml - Remove from
vite.config.tsoptimizeDeps.exclude - Run
pnpm install
pds npm <dep> # Latest version
pds npm <dep> 1.2.3 # Specific version
pds n <dep> # Aliaspds status # Show all configured deps
pds status <dep> # Show specific dep
pds s # Aliaspds list # or pds lsThe tool stores configuration in .pnpm-dep-source.json:
{
"dependencies": {
"@scope/package-name": {
"localPath": "../../path/to/local",
"github": "user/repo",
"npm": "@scope/package-name",
"distBranch": "dist"
}
}
}-I, --no-install: Skip runningpnpm installafter changes-s, --sha: Resolve git ref to SHA (forgithubcommand)-g, --github <repo>: GitHub repo forinitcommand-n, --npm <name>: NPM package name forinitcommand-b, --dist-branch <branch>: Dist branch name (default: "dist")
MIT