pack-local
v1.0.0-beta.4
Published
A CLI tool for locally packing component libraries
Downloads
13
Maintainers
Readme
Pack-Local
pack-local
is a CLI tool for locally packing and testing component libraries in projects. It automates the process of versioning, building, packing, and linking a component library to a consuming app.
Installation
npm install -g pack-local
Commands
pack-local init
: Initializes configuration for local packing and adds a script topackage.json
.pack-local run
: Executes the entire packing process, updating the consuming app’s dependencies to use the latest local tarball.pack-local cleanup
: Removes thepack-local
configuration and script from the project, restoring it to its original state.
Usage
Initialize the Configuration:
Run this command in the root directory of your component library to generate a
pack-local.config.json
file with default settings.pack-local init
This creates a config file and adds a
"pack-local"
script topackage.json
for easy execution.Run the Local Pack Process:
Execute the main command to package and update the consuming app. Make sure to run this command after
init
.pack-local run
This command:
- Removes old tarballs.
- Increments the version with a
-pack
suffix. - Builds the library.
- Creates a new tarball.
- Updates the consuming app’s
package.json
to use the new tarball.
Cleanup Configuration:
If you want to remove the
pack-local.config.json
file and thepack-local
script frompackage.json
, run:pack-local cleanup
This command will:
- Remove the
pack-local.config.json
file. - Remove the
"pack-local"
script frompackage.json
(if it exists). - Restore the project to its original state before using
pack-local
.
- Remove the
Configuration
pack-local.config.json
:
packagePath
: Path to the component library (default:"./"
).packageManager
: Package manager to use (npm
,yarn
, orpnpm
).
Example
After setting up, simply run:
npm run pack-local
This will update your consuming app to use the latest version of your component library locally.
License
ISC License