plz cli
Toolkit for generating, building & testing packages.
Specifically, it consolidates:
- Generating new packages & apps.
- Configuring build pipelines. eg. Webpack, Babel
- Configuring and running unit & integration tests. eg. Jest + Babel
- Starting a development server for UI components & Apps.
Usage
$ plz <command> [options]
# CLI help
$ plz help
# Usage for individual commands
$ plz help <command>
Commands
create <name> [--root-path=<pwd>] [--type=<react-component>]
Generates a package called @rexsoftware/<name>
.
Uses scaffold templates found in templates/
. Defaults to react-component
template.
Can create:
react-component
react-app
module
test [options]
Starts a test runner in current directory.
Uses the jest
test runner.
stories
Starts a storybook for UI components.
Uses the storybook
tool.
build
Bundles the package/app for distribution.
Uses the nwb
toolkit.
serve
Starts a demo for UI components, or a dev server for an App.
Uses the nwb
toolkit.
clean
Removes previous build files.
Uses the nwb
toolkit.
help
Shows the help message.
Rationale
The CLI is largely a facade around other tools:
- nwb, by insin (module bundler)
- jest, by facebook (test runner)
- storybook, by kadira (ui testing environment)
But, by creating a facade around these tools we can:
- Avoid forcing developer to learn & remember individual tools until they're required to.
- Replace the tools without changing the front-facing API of plz cli
- Optimise package's output over time, without costly refactors in every package
Developing
Modifying dependencies!
Dependencies are managed are the root of the project by lerna
.
- Add/remove a dependency in package.json manually
- In the root of heidi, run
yarn install-deps
Structure
Start by looking into index.js
.
The bulk of logic are in the individal command files, in src/commands/
.
Commands can follow different code paths for different package types.
Configuration for the internal tools can be found under src/configs/
.
Testing
# Watch for changes, rerunning tests
$ yarn test
# Run watch once
$ yarn test:once
Re-generating cool ASCII logo
# Prints the name given to the cli 'bin' in package.json
node ./support/generate-ascii-logo.js