Particle's full-stack Internet of Things (IoT) device platform gives you everything you need to securely and reliably connect your IoT devices to the web. For more details please visit www.particle.io.
The Particle CLI is a powerful tool for interacting with your IoT devices and the Particle Cloud. The CLI uses node.js and can run on Windows, Mac OS X, and Linux. It's also open source so you can edit and change it, and even send in your changes as pull requests if you want to share!
For end-users, the most up-to-date installation instructions can be found here: macOS / Linux | Windows
These next two commands are all you need to get started setting up an account, claiming a device, and discovering new features.
Guides you through creating a new account, and claiming your device!
$ particle setup
Shows you what commands are available, and how to use them. You can also give the name of a command for detailed help.
$ particle help
$ particle help keys
If you wish to easily update the system firmware running on your device to a later version, you can use the particle update
command. For the exact version it will update to, check the version of the files in the updates folder.
- Make sure you have DFU-util installed.
- Connect your device via USB, and put it into DFU mode.
- Run
particle update
.
For the full list of commands, please see the CLI command reference.
- The Wireless Photon Setup Wizard will only automatically switch networks on OS X. Users of other operating systems will need to manually connect their computer to the Photon's Wi-Fi. You will be prompted during the wizard when this is required.
- Install Node.js [
node@8.x
andnpm@5.x
are required] - Clone this repository
$ git clone git@github.com:particle-iot/particle-cli.git && cd ./particle-cli
- Install dependencies
$ npm install
- View available commands
$ npm run
- Run the tests
$ npm test
- Run the CLI
$ npm start
- Start Hacking!
To ensure compatibility with a wide range of NodeJS versions, the CLI's source is transpiled using Babel.
When developing, run individual commands using:
$ npm start -- <command> <options>
- e.g. $ npm start -- library view dotstar --readme
Anything after the --
delimiter is passed directly to the CLI (docs), source code is transpiled on-demand.
To test the transpiled source as it will be published:
- Compile:
$ npm run compile
- Register the
particle
command globally:$ npm link
- Run commands:
$ particle --help
(using standard argument formatting)
The Particle CLI has a number of automated test suites and related commands. The most important are:
npm test
- run all tests (NOTE: End-To-End tests require additional setup)npm run lint
- run the linter and print any errors to your terminalnpm run test:ci
- run all tests excluding device-dependent end-to-end test as CI doesnpm run test:unit
- run unit testsnpm run test:integration
- run integration testsnpm run coverage
- report code coverage stats
All tests use mocha, chai, and sinon with coverage handled by nyc.
We recommend running locally if you can as it greatly shortens your feedback loop. However, CI also runs against every PR and error reporting is publicly available.
-
npm run update-firmware-binaries <version>
where<version>
is the newly released system firmware version like 0.7.0 -
Test on each platform by doing
# Check old firmware version bin/particle.js serial inspect # Flash new system firmware bin/particle.js update # Verify new firmware version bin/particle.js serial inspect
-
Do not update the versions or CHANGELOG.md just yet!
-
Commit as something like "adds firmware binaries for 0.7.0" and proceed to release a new CLI version (below).
See RELEASE.md.