This script automates the process of converting npm projects to pnpm within a specified directory.
- π Recursively searches for npm projects (identified by
package-lock.json
files) - π Converts npm projects to pnpm
- π¦ Installs dependencies using pnpm
- π Automatic rollback in case of failures
- π Provides a summary of the conversion process
- Bash shell
- npm
- pnpm
-
Clone this repository:
git clone https://github.com/yourusername/npm-to-pnpm-converter.git
-
Navigate to the script directory:
cd npm-to-pnpm-converter
-
Make the script executable:
chmod +x npmtopnpm.sh
-
Run the script, specifying the target directory:
./npmtopnpm.sh /path/to/your/projects
The script generates a log file named pnpm_conversion.log
in the current directory. This file contains detailed information about the conversion process.
If an error occurs during the conversion process for a project, the script will:
- Log the error
- Attempt to restore the project to its original state
- Continue with the next project
After processing all projects, the script provides a summary including:
- Total number of projects processed
- Number of successful conversions
- Number of failed conversions
Always backup your projects before running this script. While it includes rollback functionality, it's always better to have a separate backup.
Contributions, issues, and feature requests are welcome! Feel free to check issues page.
This project is MIT licensed.