Creating an app
You can install Lithium in two ways, using the NPX command to scaffold a project or directly installing it into your node project.
npx
command#
Installing via the This method uses the default Lithium starter. It's a bit similar to create-react-app
if you've every used that.
npx lithium-cli new YOUR_PROJECT_NAME
This is the faster method. You can start creating your CLI within the src
folder.
After you've installed it, navigate to the project folder and:
npm i -g .
This adds this your CLI to the system path, allowing you to do something like lithium_starter say hello
.
The command that this adds to your path is the name
property in your package.json
. To change it, edit package.json
and then run another npm i -g .
. This will sort everything out.
Behind the scenes, this sets up the bin property to run your Node script, it adds the little boilerplate that there is, and sets up the file structure.
#
Installing via the NPM packageThis method requires using npm i
directly. Use this for existing JS projects.
npm install lithium-cli# ORyarn add lithium-cli
If you do this, please:
Add the NodeJS shebang,
#!/usr/bin/env node
to the file that your CLI starts inAdd your file path, for example,
./src/cli.js
, to yourpackage.json
like this:"bin": "./src/cli.js"
.
Once you're done, check out how to use Lithium.