Skip to content

Commit 0eacae5

Browse files
author
deleonn
committed
Update README.md to follow new conventions
1 parent ea37290 commit 0eacae5

File tree

1 file changed

+61
-1
lines changed

1 file changed

+61
-1
lines changed

README.md

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ JS Library for the Particle Cloud API for Node.js and the browser
33

44
[![Build Status](https://circleci.com/gh/particle-iot/particle-api-js.svg?style=shield)](https://app.circleci.com/pipelines/github/particle-iot/particle-api-js)
55

6+
[Installation](#installation) | [Development](#development) | [Conventions](#conventions) | [Docs](#docs--resources) | [Examples](#examples) | [Building](#building) | [Releasing](#releasing) | [License](#license)
7+
68
## Installation
79

810
`particle-api-js` is available from `npm` to use in Node.js, `bower` or jsDelivr CDN for use in the browser.
@@ -23,7 +25,62 @@ $ bower install particle-api-js
2325
</script>
2426
```
2527

26-
## Documentation
28+
## Development
29+
30+
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`
31+
32+
<details id="develop-run-tests">
33+
<summary><b>How to run your tests</b></summary>
34+
<p>
35+
36+
to run the tests:
37+
38+
`npm test`
39+
40+
to run the coverage:
41+
42+
`npm run coverage`
43+
44+
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):
45+
46+
`npm run test:browser`
47+
48+
</p>
49+
</details>
50+
51+
52+
<details id="develop-npm-scripts">
53+
<summary><b>How to name npm scripts</b></summary>
54+
<p>
55+
56+
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`.
57+
58+
when creating a new script, be sure it does not already exist and use the following naming convention:
59+
60+
`<category>:[<subcategory>]:[<action>]`
61+
62+
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`).
63+
64+
`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.
65+
66+
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.
67+
68+
</p>
69+
</details>
70+
71+
## Conventions
72+
73+
* [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
74+
* document developer-facing process / tooling instructions in the [Development](#development) section
75+
* plan to release your changes upon merging to `main` - refrain from merging if you cannot so you don't leave unpublished changes to others
76+
* avoid making changes in files unrelated to the work you are doing so you aren't having to publish trivial updates
77+
* test files live alongside their source files and are named like `*.test.js` or `*.spec.js`
78+
* if the linter does not flag your code (error or warning), it's formatted properly
79+
* avoid reformatting unflagged code as it can obscure more meaningful changes and increase the chance of merge conflicts
80+
* todo comments include your last name and are formatted like: `TODO (mirande): <message>`
81+
82+
83+
## Docs & Resources
2784

2885
First, read the [documentation for Particle API JS on the Documentation website.][docs-website] It contains examples to get started.
2986

@@ -55,6 +112,9 @@ Update the API docs with your changes:
55112
$ npm run docs
56113
```
57114

115+
## Releasing
116+
117+
See the release process in the [RELEASE.md](RELEASE.md) file.
58118

59119
## License
60120

0 commit comments

Comments
 (0)