pack-local v1.0.0-beta.4
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-localCommands
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-localconfiguration 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.jsonfile with default settings.pack-local initThis creates a config file and adds a
"pack-local"script topackage.jsonfor 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 runThis command:
- Removes old tarballs.
- Increments the version with a
-packsuffix. - Builds the library.
- Creates a new tarball.
- Updates the consuming app’s
package.jsonto use the new tarball.
Cleanup Configuration:
If you want to remove the
pack-local.config.jsonfile and thepack-localscript frompackage.json, run:pack-local cleanupThis command will:
- Remove the
pack-local.config.jsonfile. - 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-localThis will update your consuming app to use the latest version of your component library locally.
License
ISC License