npm-fork
Publish forks of npm packages with ease.
Occasionally, we fork an npm project to fix some bugs or add some features. But to publish the forked package, we have to manually change the package name and version in package.json
and JavaScript files. This tool automates the process and leave the source code untouched.
What it does?
- It patches
package.json
and JavaScript files (usingnpm-packlist
) with different/additional scope and prerelease versions. - It runs
npm publish
to publish the forked packages. - It runs
git restore .
to reset the patches after publishing.
Installation
npm install --global npm-fork
Usage
Commit or stage your changes and then use npm-fork patch
to apply patches to the current project:
# single package
npm-fork patch --scope "@fork"
# multiple packages
npm-fork patch --scope "@fork" --package "name" --package "@origin/*"
# use package paths instead of names if workspace is not configured or recognized (e.g., pnpm).
npm-fork patch --scope "@fork" --package "packages/*"
Or directly npm-fork publish
:
npm-fork publish --scope "@fork"
License
MIT License.