@particle/device-constants
v3.5.0
Published
static device identifiers and meta-data for Particle hardware
Downloads
2,881
Maintainers
Keywords
Readme
Particle Device Constants
The static device identifiers and meta-data for Particle hardware.
This project contains the constants as well as very lightweight wrappers around the constants and enables publishing them as NPM modules and Ruby Gems. All languages' libraries follow the same versioning scheme.
Installation | Development | Releasing
Installation
- Install Node.js [
[email protected]
and[email protected]
are required] - Clone this repository
$ git clone [email protected]:particle-iot-inc/device-constants.git && cd ./device-constants
- Install dependencies
$ npm install
- make sure you are signed into npm and a member of the
@particle
org (docs)
- make sure you are signed into npm and a member of the
- View available commands
$ npm run
- Run the tests
$ npm test
- Start Hacking!
Development
The Device Constants repo contains static specs for official Particle platform devices and the tooling to support publishing a series of language-specific packages with that data. All essential commands are available via npm run <script name>
- e.g. npm run lint
. To view the available commands, run: npm run
To add a new Particle platform device, simply:
- Open the
src/constants.json
file in your favorite code editor - Add a new entry like:
"example": {
"id": <integer - the unique identifier>,
"name": <string - the unique name used by Device OS' build system>,
"displayName": <string - human-facing platform name>,
"generation": <integer - e.g. `2` for photon, `3` for boron, `4` for p2>,
"features": <array of strings - the features supported e.g. `wifi`, `ble`>,
"billingConnectivity": <string for where data ops for this device type should be counted e.g. `wifi`, or `cellular``>,
"public": <boolean - whether or not the platform is available to end-users>
},
NOTE: See src/constants.schema.json
for latest field definitions
- Validate your additions adhere to the current schema:
npm run validate
- Stage and commit:
git add -p && git commit
Constants data must adhere to the JSON Schema (https://json-schema.org) specs in src/constants.schema.json
. In some cases, you may need to extend the current schema to support addition properies, etc. To do that:
- Read through the "Getting Started" docs
- Open the
src/constants.schema.json
file in your favorite code editor - Update the schema with your additions or changes - in some cases, you can jumpstart the process using the online generator at: https://www.jsonschema.net but be sure to scrutinize what it provides as it's not always super-accurate :)
- Validate your changes have not rendered existing data invalid:
npm run validate
- Stage and commit:
git add -p && git commit
Making changes to the ruby wrapper
See the src/ruby/README.md
file for more info on the Ruby Gem wrapper.
Releasing
Packages are only released from the main
branch after peer review.
- make sure you have the latest:
$ git checkout main
$ git pull
- make sure tests pass
$ npm test
- run the release command
$ npm run release
- follow the on-screen instructions, wait for confirmation of success
- push your tags:
$ git push origin main --follow-tags