@particle/device-constants

3.3.1 • Public • Published

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.

CI

Installation | Development | Releasing

Installation

  1. Install Node.js [node@16.x and npm@8.x are required]
  2. Clone this repository $ git clone git@github.com:particle-iot-inc/device-constants.git && cd ./device-constants
  3. Install dependencies $ npm install
    • make sure you are signed into npm and a member of the @particle org (docs)
  4. View available commands $ npm run
  5. Run the tests $ npm test
  6. 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

How to add a new platform

To add a new Particle platform device, simply:

  1. Open the src/constants.json file in your favorite code editor
  2. 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>,
	"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

  1. Validate your additions adhere to the current schema: npm run validate
  2. Stage and commit: git add -p && git commit
How to extend the device schema

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:

  1. Read through the "Getting Started" docs
  2. Open the src/constants.schema.json file in your favorite code editor
  3. 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 :)
  4. Validate your changes have not rendered existing data invalid: npm run validate
  5. 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.

  1. make sure you have the latest:
    • $ git checkout main
    • $ git pull
  2. make sure tests pass
    • $ npm test
  3. run the release command
    • $ npm run release
  4. follow the on-screen instructions, wait for confirmation of success
  5. push your tags:
    • $ git push origin main --follow-tags

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 3.3.1
    520
    • latest

Version History

Package Sidebar

Install

npm i @particle/device-constants

Weekly Downloads

985

Version

3.3.1

License

UNLICENSED

Unpacked Size

19.6 kB

Total Files

3

Last publish

Collaborators

  • jackson-particle
  • mike.grundy.npm
  • mohitparticle
  • eugene_particle
  • kmok23
  • karlag
  • cole-abbeduto-particle
  • pedrosordo
  • guohui
  • sbrust
  • particlebot
  • no1089
  • carlos.hdez
  • keeramis5
  • monkbroc
  • suda
  • mstan
  • sergeuz
  • debbie23
  • avtolstoy
  • mlauer
  • wraithan
  • azenk
  • bwalach
  • parteberseth
  • rickkas7
  • mrlambchop_particle
  • hugo.montero
  • mphsi