Package Exports
- swpm
- swpm/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (swpm) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Switch Package Manager

When switching between JavaScript projects, it's often easy to forget which package manager should be used. JavaScript package managers aren't quite compatible either and each one resolves dependencies differently, so accidentally installing with npm could cause a yarn or pnpm project to break.
swpm intend to solve this problem unifying the commands for the most common Node Package Managers into one. It will recognize the Package Manager used on the project and automatically will translate those commands.
WIP: we will start with most used command, then other commands will be added gradually.
Install
npm install --global swpm
yarn global add swpm
pnpm install -global swpm Commands
With swpm --help it will show a command help resume.
swpm --help
Options:
-p, --pin pin a package manager [choices: "npm", "yarn", "pnpm"]
-u, --use use a package manager [choices: "npm", "yarn", "pnpm"]
-s, --see show equivalent command [choices: "npm", "yarn", "pnpm"]
-g, --get get current package manager
-i, --info current package manager information
--help Show help [boolean]
--version Show version number [boolean]Pinning
The swpm --pin command allows you to choose your Package Manager for a project.
swpm --pin <npm|yarn|pnpm>
swpm -p <npm|yarn|pnpm>It will store this in your package.json so you can commit your choice of tools to version control:
{
+ "swpm": "<package-manager-name>"
}You also can set it manually.
Use
The swpm --use command allows you to choose your Package Manager for a project.
swpm --use <npm|yarn|pnpm> [args]
swpm -u <npm|yarn|pnpm> [args]It will run a command using the selected Package Manager, no matter the swpm property in your package.json.
Show
The swpm --show command show the equivalent command using the selected Package Manager. It will not run the command
swpm --show <npm|yarn|pnpm> [options]
swpm -s <npm|yarn|pnpm> [options]It will run a command using the selected Package Manager, no matter the swpm property in your package.json.
Get
The swpm --get command show the current Package Manager used in the project.
swpm --get
swpm -gIt will search firs the swpm property on the package.json file, and if doesn't not found it, will try to infer the Package Manager in use with help of the lock's file.
| Lock File | PM |
|---|---|
package-lock.json |
npm |
yarn.lock |
yarn |
pnpm-lock.yaml |
pnpm |
Info
The swpm --info command show the version of the current Package Manager used in the project.
swpm --info
swpm -iIt will search firs the swpm property on the package.json file, and if doesn't not found it, will try to infer the Package Manager in use with help of the lock's file.
Run
The swpm command will run the command switching automatically to the pinned Package Manager.
swpm [args]Work In Progress
About
Built With
- VS Code - Code editing redefined.
- WSL - Windows Subsystem for Linux.
- Widows Terminal - A modern terminal application for users of command-line tools and shells.
Versioning
We use SemVer for versioning. For the versions available, see the swpm on GitHub.
Authors
- Camilo Martinez [Equiman]
See also the list of contributors who participated in this project.
Sponsors
If this project helps you, consider buying me a cup of coffee.
License
This project is licensed under the MIT License - see the LICENSE file for details.