particle-commands 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,68 @@
1
+ version: 2.1
2
+
3
+ jobs:
4
+ run-tests:
5
+ parameters:
6
+ node-version:
7
+ type: string
8
+ docker:
9
+ - image: cimg/node:<< parameters.node-version >> # Primary execution image
10
+ auth:
11
+ username: $DOCKERHUB_USERNAME
12
+ password: $DOCKERHUB_PASSWORD
13
+ steps:
14
+ - checkout
15
+ - run:
16
+ name: NPM install
17
+ command: npm ci
18
+ - run:
19
+ name: Run tests with coverage
20
+ command: npm run test:ci
21
+ publish-npm:
22
+ docker:
23
+ - image: cimg/node:16.15.0 # Primary execution image
24
+ auth:
25
+ username: $DOCKERHUB_USERNAME
26
+ password: $DOCKERHUB_PASSWORD
27
+ steps:
28
+ - checkout
29
+ - run:
30
+ name: NPM install
31
+ command: npm ci
32
+ - run:
33
+ name: Authenticate with NPM
34
+ command: npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
35
+ - run:
36
+ name: Publish package
37
+ command: |
38
+ # Publish as beta for pre-release tags like v1.2.3-pre.1
39
+ [[ $CIRCLE_TAG =~ ^v.*- ]] && NPM_TAG=--tag=beta
40
+ npm publish $NPM_TAG
41
+
42
+ workflows:
43
+ version: 2
44
+ test-and-publish:
45
+ jobs:
46
+ - run-tests:
47
+ context:
48
+ - particle-ci-private
49
+ matrix:
50
+ parameters:
51
+ node-version: ["12.22.12", "14.19.2", "16.15.0"]
52
+ # run tests for all branches and tags
53
+ filters:
54
+ tags:
55
+ only: /^v.*/
56
+ branches:
57
+ only: /.*/
58
+ - publish-npm:
59
+ requires:
60
+ - run-tests
61
+ context:
62
+ - particle-ci-private
63
+ # publish for tags only
64
+ filters:
65
+ tags:
66
+ only: /^v.*/
67
+ branches:
68
+ ignore: /.*/
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ 16
package/CHANGELOG.md CHANGED
@@ -3,6 +3,9 @@
3
3
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
4
4
  and this project adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
+ ### 0.4.0 - 2022-05-31
7
+ - Move to `node@16` and `npm@8` for local development
8
+
6
9
  ### 0.3.0 - 2018-09-06
7
10
  ### Change
8
11
  - revert changes for analytics
package/README.md CHANGED
@@ -1,15 +1,94 @@
1
- # Particle Commands [![Build Status](https://travis-ci.org/spark/particle-commands.svg?branch=master)](https://travis-ci.org/spark/particle-commands)
1
+ # Particle Commands
2
2
  UX-neutral commands for developer tools
3
3
 
4
- # Release
4
+ [![Build Status](https://circleci.com/gh/particle-iot/particle-commands.svg?style=shield)](https://app.circleci.com/pipelines/github/particle-iot/particle-commands)
5
5
 
6
- Run these commands to release
7
- ```
8
- npm version <minor|major|patch>
9
- # update CHANGELOG.md
10
- git push --follow-tags
11
- npm publish
12
- ```
6
+ [Installation](#installation) | [Development](#development) | [Conventions](#conventions) | [Docs](#docs--resources) | [Releasing](#releasing) | [License](#license)
13
7
 
14
- Then create a GitHub release
8
+ ## Installation
9
+ 1. Install Node.js [`node@16.x` and `npm@8.x` are required]
10
+ 1. Clone this repository `$ git clone git@github.com:particle-iot/particle-commands.git && cd ./particle-commands`
11
+ 1. Install dependencies `$ npm install`
12
+ 1. View available commands `$ npm run`
13
+ 1. Run the tests `$ npm test`
14
+ 1. Start Hacking!
15
15
 
16
+ ## Development
17
+
18
+ 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`
19
+
20
+ <details id="develop-run-tests">
21
+ <summary><b>How to run your tests</b></summary>
22
+ <p>
23
+
24
+ to run the tests:
25
+
26
+ `npm test`
27
+
28
+ to run the coverage:
29
+
30
+ `npm run coverage`
31
+
32
+ </p>
33
+ </details>
34
+
35
+
36
+ <details id="develop-npm-scripts">
37
+ <summary><b>How to name npm scripts</b></summary>
38
+ <p>
39
+
40
+ 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`.
41
+
42
+ when creating a new script, be sure it does not already exist and use the following naming convention:
43
+
44
+ `<category>:[<subcategory>]:[<action>]`
45
+
46
+ 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`).
47
+
48
+ `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.
49
+
50
+ 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.
51
+
52
+ </p>
53
+ </details>
54
+
55
+
56
+ ## Conventions
57
+
58
+ * [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
59
+ * document developer-facing process / tooling instructions in the [Development](#development) section
60
+ * plan to release your changes upon merging to `main` - refrain from merging if you cannot so you don't leave unpublished changes to others
61
+ * avoid making changes in files unrelated to the work you are doing so you aren't having to publish trivial updates
62
+ * test files live alongside their source files and are named like `*.test.js` or `*.spec.js`
63
+ * if the linter does not flag your code (error or warning), it's formatted properly
64
+ * avoid reformatting unflagged code as it can obscure more meaningful changes and increase the chance of merge conflicts
65
+ * todo comments include your last name and are formatted like: `TODO (mirande): <message>`
66
+
67
+ ## Docs & Resources
68
+
69
+ * [Mocha](https://mochajs.org/)
70
+ * [Chai](http://www.chaijs.com/api/bdd/)
71
+ * [Sinon](https://sinonjs.org/)
72
+ * [NYC](https://github.com/istanbuljs/nyc)
73
+
74
+ ## Releasing
75
+
76
+ Packages are only released from the `main` branch after peer review.
77
+
78
+ 1. make sure you have the latest:
79
+ * `$ git checkout main`
80
+ * `$ git pull`
81
+ 1. make sure tests pass
82
+ * `$ npm test`
83
+ 1. run the version command
84
+ * `$ npm version <major|minor|patch>`
85
+ * This command will bump the current version of the library in the `package.json` file. Before the command finishes, update `CHANGELOG.md`.
86
+ 1. push your tags:
87
+ * `$ git push origin main --follow-tags`
88
+ 1. CircleCI will publish the npm package to the `latest` tag
89
+ 1. Create a release on GitHub with the notes from the `CHANGELOG.md`
90
+ 1. Point your project to the new version `npm install particle-commands@latest`
91
+
92
+ ## License
93
+
94
+ Copyright &copy; 2016 Particle Industries, Inc. Released under the Apache 2.0 license. See [LICENSE](/LICENSE) for details.
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "particle-commands",
3
3
  "description": "Library of UX-neutral commands that provide key functionality for developer tools",
4
- "version": "0.3.0",
4
+ "version": "0.4.0",
5
5
  "author": "Matthew McGowan",
6
6
  "bugs": {
7
- "url": "https://github.com/spark/particle-commands/issues"
7
+ "url": "https://github.com/particle-iot/particle-commands/issues"
8
8
  },
9
9
  "contributors": [
10
10
  {
@@ -40,9 +40,9 @@
40
40
  "eslint": "~2.2.0",
41
41
  "eslint-config-particle": "^1.0.1",
42
42
  "fs-extra": "^0.30.0",
43
- "istanbul": "^0.3.22",
44
43
  "mocha": "^3.0.2",
45
- "mock-fs": "^3.12.1",
44
+ "mock-fs": "^5.1.2",
45
+ "nyc": "^15.1.0",
46
46
  "proxyquire": "^1.6.0",
47
47
  "rimraf-promise": "^2.0.0",
48
48
  "sinon": "^1.15.4",
@@ -52,10 +52,7 @@
52
52
  "testdouble-chai": "^0.2.2",
53
53
  "tmp": "0.0.28"
54
54
  },
55
- "engines": {
56
- "node": ">=0.10.40"
57
- },
58
- "homepage": "https://github.com/spark/particle-commands/",
55
+ "homepage": "https://github.com/particle-iot/particle-commands/",
59
56
  "keywords": [
60
57
  "cli",
61
58
  "core",
@@ -70,22 +67,27 @@
70
67
  "preferGlobal": false,
71
68
  "repository": {
72
69
  "type": "git",
73
- "url": "https://github.com/spark/particle-commands"
70
+ "url": "https://github.com/particle-iot/particle-commands"
74
71
  },
75
72
  "scripts": {
76
- "all": "npm run lint && npm run test && npm run accept",
73
+ "prepublish": "npm run compile",
74
+ "preversion": "npm run lint && npm run test && npm run prepublish",
75
+ "version": "npm run update-changelog",
76
+ "compile": "babel src -d dist --copy-files",
77
77
  "babel-watch": "babel src -d dist --watch --source-maps --copy-files",
78
- "coverage": "istanbul cover ./node_modules/mocha/bin/_mocha -- -R spec test/ --compilers js:babel-register",
79
- "coveralls": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec --compilers js:babel-register test/ && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage",
80
78
  "doctoc": "doctoc --title '## Table of Contents' README.md",
81
79
  "list-folders": "node --require babel-register bin/list_folders.js",
80
+ "test": "npm run lint && npm run test:unit",
81
+ "test:ci": "npm run lint && npm run test:unit -- --forbid-only && npm run coverage",
82
+ "test:unit": "mocha test test/cmd test/integration --compilers js:babel-register",
83
+ "test:unit:silent": "npm run test:unit > tmp/test-unit-log.txt 2>&1",
82
84
  "lint": "eslint -f unix src/**/*.js",
83
85
  "lint:fix": "eslint --fix -f unix src/ test/",
84
- "test": "mocha test test/cmd test/integration --compilers js:babel-register",
85
- "compile": "babel src -d dist --copy-files",
86
- "prepublish": "npm run compile",
87
- "preversion": "npm run lint && npm run test && npm run prepublish",
88
- "version": "npm run update-changelog",
86
+ "coverage": "nyc --reporter=text --include='src/**/*.js' --temp-dir=./tmp/ --check-coverage --lines 50 npm run test:unit:silent",
89
87
  "update-changelog": "VERSION=`node -p -e \"require('./package.json').version\"` bash -c 'read -p \"Update CHANGELOG.md for version $VERSION and press ENTER when done.\"' && git add CHANGELOG.md"
88
+ },
89
+ "engines": {
90
+ "node": ">=12.x",
91
+ "npm": "8.x"
90
92
  }
91
93
  }
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="JavaScriptLibraryMappings">
4
- <includedPredefinedLibrary name="ECMAScript 6" />
5
- </component>
6
- </project>
package/.idea/misc.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="JavaScriptSettings">
4
- <option name="languageLevel" value="ES6" />
5
- </component>
6
- </project>
package/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/particle-commands.iml" filepath="$PROJECT_DIR$/.idea/particle-commands.iml" />
6
- </modules>
7
- </component>
8
- </project>
@@ -1,10 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="WEB_MODULE" version="4">
3
- <component name="NewModuleRootManager">
4
- <content url="file://$MODULE_DIR$">
5
- <excludeFolder url="file://$MODULE_DIR$/dist" />
6
- </content>
7
- <orderEntry type="inheritedJdk" />
8
- <orderEntry type="sourceFolder" forTests="false" />
9
- </component>
10
- </module>
package/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
- </component>
6
- </project>
@@ -1,4 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectTasksOptions" suppressed-tasks="Babel" />
4
- </project>