❗ NOTE: If you're here to use the CLI, you can go directly to the README for the cli package.
❗ NOTE: This CLI is currently considered an alpha release. It has currently has only a few specific features implemented and is a work in progress.
This is the monorepo for the SmartThings CLI. Currently, the following packages are included:
- cli - the CLI itself; @smartthings/cli node package
- lib - a library for use in the CLI and its extensions; @smartthings/cli-lib node package
- testlib - a library for use in the CLI and its extensions with utility methods to make testing with Jest easier; @smartthings/cli-testlib node package
The CLI uses lerna to manage multiple packages in a monorepo.
The CLI depends on the SmartThings Core SDK which is not yet published. To get this working for testing purposes, you'll need to check out both repositories and then:
- Be sure you're using at least NodeJS version 12.
- In the root directory of the SDK
- run
npm install. - run
npm link. If you're using a globally-installed version of node, you might need to run this with admin privileges.
- run
- Install lerna globally with
npm -g i lerna. (Alternatively, you can usenpx lernabelow instead of simplylerna.) - In the in the root directory of the CLI repository run
./bootstrap.sh. - The bootstrap script will compile the CLI but you can:
- run
lerna run compileto compile again, or - run
lerna run watchto watch for changes and compile on the fly, or - run
lerna run buildto clean and compile
- run
- To run the CLI, run the
runcommand in packages/cli/bin. You can create a link to this file to make it easier to run. Since the final installed name will be "smartthings", that's a good name for the link. For example:ln -s ~/mydevdir/smartthings-cli/packages/cli/bin/run ~/bin/smartthings
There is also a full_clean.sh script you can run to start over again. This is
sometimes helpful when pulling new code.
Before opening a pull request be sure to:
- Run eslint via
lerna run lint - Run tests with
lerna run test - If you've added or or removed commands or updated any of their arguments
or flags, be sure to update the readme. Doing a full build via
lerna run buildwill do this but you can also runlerna run readme.