local-pack
is a CLI tool that simplifies packaging and installing local dependencies in your project.
You can install local-pack
either globally or locally in your project:
-
Global Installation (recommended for system-wide use):
npm install -g local-pack
This allows you to use the
localpack
command in any project. -
Local Installation (specific to a single project):
npm install local-pack --save-dev
Then, run the command with
npx
:npx localpack /path/to/consuming-project
Once installed, you can use the localpack
command to package and install a local dependency in another project.
localpack /path/to/consuming-project
-
Install and Package Local Dependency:
localpack /path/to/consuming-project
This command will:
- Update the package version in
local-pack
. - Build and create a
.tgz
package file. - Update the dependency in the target project to use the local
.tgz
file. - Install the updated dependency in the target project.
- Update the package version in
-
Clean Up Changes:
localpack /path/to/consuming-project --clean
This command will:
- Revert the version change in
local-pack
. - Remove
.tgz
files generated during packaging. - Restore the original dependency version in the target project.
- Revert the version change in
-
Package and Install:
localpack /Users/username/my-consuming-app
-
Clean Up Changes:
localpack /Users/username/my-consuming-app --clean
And that’s it! local-pack
is ready to help you manage your local dependencies effortlessly.