particle-api-js
Advanced tools
Comparing version 9.1.2 to 9.2.0
# changelog | ||
## 9.2.0 - 30 May 2022 | ||
* Move to `node@16` and `npm@8` for local development | ||
## 9.1.2 - 9 December 2021 | ||
@@ -4,0 +7,0 @@ * Fix library download |
{ | ||
"name": "particle-api-js", | ||
"version": "9.1.2", | ||
"version": "9.2.0", | ||
"description": "Particle API Client", | ||
@@ -10,7 +10,9 @@ "main": "lib/Particle.js", | ||
"compile": "babel src -sd lib", | ||
"test": "npm run lint && npm run test:node", | ||
"test:node": "mocha test/ -R spec --compilers js:babel-register", | ||
"test": "npm run lint && npm run test:unit", | ||
"test:ci": "npm run lint && npm run test:unit -- --forbid-only && npm run coverage", | ||
"test:unit": "mocha test/ -R spec --compilers js:babel-register", | ||
"test:unit:silent": "npm run test:unit > tmp/test-unit-log.txt 2>&1", | ||
"test:browser": "karma start --single-run", | ||
"test:watch": "npm run test:node -- --watch", | ||
"cover": "istanbul cover ./node_modules/.bin/_mocha test/ -- -R spec --compilers js:babel-register", | ||
"test:watch": "npm run test:unit -- --watch", | ||
"coverage": "nyc --reporter=text --include='src/**/*.js' --temp-dir=./tmp/ --check-coverage --lines 50 npm run test:unit:silent", | ||
"lint": "eslint . --ext .js --format unix --ignore-path .gitignore --ignore-pattern \"dist/*\"", | ||
@@ -62,3 +64,2 @@ "lint:fix": "npm run lint -- --fix", | ||
"eslint-config-particle": "^2.2.1", | ||
"istanbul": "1.0.0-alpha.2", | ||
"karma": "^1.1.1", | ||
@@ -73,2 +74,3 @@ "karma-browserify": "^5.1.0", | ||
"mocha": "^2.5.1", | ||
"nyc": "^15.1.0", | ||
"should": "^9.0.0", | ||
@@ -90,3 +92,7 @@ "sinon": "^7.2.5", | ||
"https": "stream-http" | ||
}, | ||
"engines": { | ||
"node": ">=12.x", | ||
"npm": "8.x" | ||
} | ||
} |
# particle-api-js | ||
JS Library for the Particle Cloud API for Node.js and the browser | ||
[](https://travis-ci.org/particle-iot/particle-api-js) | ||
[](https://app.circleci.com/pipelines/github/particle-iot/particle-api-js) | ||
[Installation](#installation) | [Development](#development) | [Conventions](#conventions) | [Docs](#docs--resources) | [Examples](#examples) | [Building](#building) | [Releasing](#releasing) | [License](#license) | ||
## Installation | ||
@@ -26,4 +28,59 @@ | ||
## Documentation | ||
## Development | ||
All essential commands are available at the root via `npm run <script name>` - e.g. `npm run lint`. To view the available commands, run: `npm run` | ||
<details id="develop-run-tests"> | ||
<summary><b>How to run your tests</b></summary> | ||
<p> | ||
to run the tests: | ||
`npm test` | ||
to run the coverage: | ||
`npm run coverage` | ||
to run browser tests with [karma](https://karma-runner.github.io/latest/index.html) (make sure you have the [Firefox launcher](https://npmjs.org/browse/keyword/karma-launcher) installed): | ||
`npm run test:browser` | ||
</p> | ||
</details> | ||
<details id="develop-npm-scripts"> | ||
<summary><b>How to name npm scripts</b></summary> | ||
<p> | ||
npm scripts are the primary means of executing programmatic tasks (e.g. tests, linting, releasing, etc) within the repo. to view available scripts, run `npm run`. | ||
when creating a new script, be sure it does not already exist and use the following naming convention: | ||
`<category>:[<subcategory>]:[<action>]` | ||
our standard categories include: `test`, `lint`, `build`, `clean`, `docs`, `package`, `dependencies`, and `release`. top-level scripts - e.g. `npm run clean` - will typically run all of its subcategories (e.g. `npm run clean:dist && npm run clean:tmp`). | ||
`npm` itself includes special handling for `test` and `start` (doc: [1](https://docs.npmjs.com/cli/v6/commands/npm-test), [2](https://docs.npmjs.com/cli/v6/commands/npm-start)) amongst other [lifecycle scripts](https://docs.npmjs.com/cli/v7/using-npm/scripts#life-cycle-scripts) - use these to expose key testing and start-up commands. | ||
sometimes your new script will be very similar to an existing script. in those cases, try to extend the existing script before adding another one. | ||
</p> | ||
</details> | ||
## Conventions | ||
* [npm scripts](https://docs.npmjs.com/misc/scripts) form the _developer's API_ for the repo and all of its packages - key orchestration commands should be exposed here | ||
* document developer-facing process / tooling instructions in the [Development](#development) section | ||
* plan to release your changes upon merging to `main` - refrain from merging if you cannot so you don't leave unpublished changes to others | ||
* avoid making changes in files unrelated to the work you are doing so you aren't having to publish trivial updates | ||
* test files live alongside their source files and are named like `*.test.js` or `*.spec.js` | ||
* if the linter does not flag your code (error or warning), it's formatted properly | ||
* avoid reformatting unflagged code as it can obscure more meaningful changes and increase the chance of merge conflicts | ||
* todo comments include your last name and are formatted like: `TODO (mirande): <message>` | ||
## Docs & Resources | ||
First, read the [documentation for Particle API JS on the Documentation website.][docs-website] It contains examples to get started. | ||
@@ -59,3 +116,6 @@ | ||
## Releasing | ||
See the release process in the [RELEASE.md](RELEASE.md) file. | ||
## License | ||
@@ -62,0 +122,0 @@ |
# Releasing a new version | ||
- `npm version <major | minor | patch>` | ||
1. Merge your changes to master and be on `master` | ||
2. Run `npm version <major|minor|patch>` | ||
1. This builds the distribution file `particle.js.min` and generates the | ||
API documentation. Before the command finishes, update `CHANGELOG.md`. | ||
3. Push to origin `git push --follow-tags` | ||
4. CircleCI will publish the npm package to the `latest` tag | ||
5. Create a release on GitHub with the notes from the `CHANGELOG.md` | ||
6. Point your project to the new version `npm install particle-api-js@latest` | ||
This builds the distribution file `particle.js.min` and generates the | ||
API documentation. Before the command finishes, update `CHANGELOG.md`. | ||
- `git push && git push --tags` | ||
- Travis will run `npm publish` if the build passes. | ||
- Create a release on GitHub with the notes from the `CHANGELOG.md` | ||
- After updating major version, update the installation instructions in the [docs](https://github.com/particle-iot/docs/blob/master/src/content/reference/SDKs/javascript.md) |
@@ -32,4 +32,5 @@ /* | ||
console.error(err); | ||
process.exit(1); | ||
}); | ||
/* eslint-enable no-console */ | ||
Sorry, the diff of this file is too big to display
1751874
9091
124