CLI Bulk Pattern Importer
Knapsack now provides a quick and easy method for bulk importing of your existing React components. This is made possible by a command line interface utility written into our main application.
Using the CLI
- From the root of your local knapsack repo — run
yarn knapsack create-react-patterns
. - First, you will be prompted for a package path.
- For example,
@knapsack-cloud/workspace-react
. - If you're not sure what your package path is, ensure your package is installed within your workspace and review the
package.json
within that npm package (within thenode_modules
directory).
- For example,
- Next the CLI will ask if you'd like to remove a prefix from the auto-generated pattern name that the system will inject. If you do not wish to remove any prefix, just hit <enter>.
- For example, if all of your patterns begin with something specific but you'd rather the name of the component being imported reflect just the name, add that string during this step.
- Lastly, after the CLI parses your npm package you'll have the ability to select specific patterns to import OR filter out the list of components to make it easier on you while you make your selections.
After the import
When the import completes — simply fire up knapsack ( yarn start
) and navigate to your freshly imported component that is now ready for you to add content! 🎉
Coming soon
- The ability to run the above as a one-liner (using flags)
At the time of writing — React is the only renderer currently supported. Please let us know if your team desires this functionality for another renderer.