@bva/bva-cli
v1.0.0
Published
CLI for internal and external BVA tools
Downloads
52
Readme
bva-cli
A simple CLI tool used for internal dev things.
Table of Contents
Install
Copy/paste the following command into your terminal:
yarn global add @bva/bva-cli
How To Use
This tool is used by calling bva
and passing options to it. For example, if you want to install the Recommendations module to a Slate project you would do:
bva --add @bva/recommendations
Command Options
-i --interactive
- Uses interactive mode to make it easier to accomplish tasks.
Non interactive commands provide a specific level of control, but most important things can be accomplished by using interactive mode.
-a --add
- Adds a module to the project its being called from (see below for current list of modules) - Ex:bva --add module-name
--add-help
- Display the help menu for--add
-l --list
- Lists all items associated with a specific list type (bva --list module
)-h --help
- Displays the help menu (bva --help
)-v --version
- Displays the CLI version (bva --version
)
Subhelp Menus
All command options that take arguments will also have an associated help menu to go along with them. To view these help menus you just need to use help
as the argument. An example would look like bva --list help
. An alias for h
will also be accepted bva --list h
.
How To Add A Module
Modules are automatically added if certain things are done within the module's codebase. At the simplest level, a module can be added by:
- Making sure the name of the module is
@bva/module-name
in package.json - Adding
keywords":["bva-module"]
to package.json - Publishing the package to NPM
This will create a BVA scoped package and by adding bva-module
as a keyword the CLI tool knows to treat the package as a BVA module.
Adding Files to Slate Projects
Doing the above will allow your package to either yarn add
in the Slate project it's requested for, but that's not the main benefit. The main benefit of using the CLI tool for installing BVA modules is extra files can also be added to the project. The purpose of these extra files is to provide developers with the ability to rapidly develop a feature using the module. So usually these files would include some of the baseline required code to get the module working. To add extra files to modules, do the following:
- Create a root level folder called
templates
. Steps 2-5 are performed within thetemplates
folder. - (optional) To add a JS file, create a file with the following structure:
bva-module-name.js
- (optional) To add a stylesheet, create a file with the following structure:
bva-module-name.scss
- (optional) To add a section, create a file with the following structure:
section-bva-module-name.liquid
- (optional) To add a snippet, create a files with the following structure:
snippet-bva-module-name.liquid
Any or all of the files above marked (optional) can be omitted and everything else will be handled by the CLI tool.
Contributing
Changelog
To see the most recent changes view the CHANGELOG.