From 15b2cc5ab9c1763738c29d26040cf73865890dc7 Mon Sep 17 00:00:00 2001 From: Brad Garropy Date: Mon, 22 Feb 2021 22:14:09 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=8E=20style=20scripts=20(#11)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 2 +- .github/workflows/style.yml | 22 ++++++++++++++++++++++ .github/workflows/test.yml | 2 +- .prettierignore | 21 +++++++++++++++++++++ package-lock.json | 23 +++++++++++++++++++++-- package.json | 7 ++++++- tests/hue/turnOffAllLights.test.ts | 2 +- tests/hue/turnOnAllLights.test.ts | 2 +- 8 files changed, 74 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/style.yml create mode 100644 .prettierignore diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f7fa42d..4292cba 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,7 +17,7 @@ jobs: node-version: 14 registry-url: https://registry.npmjs.org/ - name: "๐Ÿ“ฆ install" - run: npm install + run: npm ci - name: "๐Ÿงช test" run: npm run test - name: "๐Ÿ‘– coveralls" diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml new file mode 100644 index 0000000..9960156 --- /dev/null +++ b/.github/workflows/style.yml @@ -0,0 +1,22 @@ +name: "๐Ÿ’Ž style" + +on: pull_request + +jobs: + style: + name: "๐Ÿ’Ž style" + runs-on: ubuntu-latest + steps: + - name: "๐Ÿ“š checkout" + uses: actions/checkout@v2.3.4 + - name: "๐ŸŸข node" + uses: actions/setup-node@v2.1.4 + with: + node-version: 14 + registry-url: https://registry.npmjs.org/ + - name: "๐Ÿ“ฆ install" + run: npm ci + - name: "๐Ÿงถ lint" + run: npm run lint + - name: "๐Ÿ’พ format" + run: npm run format diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bf31f46..ed08e44 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,6 +15,6 @@ jobs: node-version: 14 registry-url: https://registry.npmjs.org/ - name: "๐Ÿ“ฆ install" - run: npm install + run: npm ci - name: "๐Ÿงช test" run: npm run test diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..ffa5dd6 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,21 @@ +# editor +.vscode + +# dependencies +.cache +node_modules + +# build +dist + +# test +coverage + +# host +.netlify + +# secrets +.env* + +# logs +debug.log diff --git a/package-lock.json b/package-lock.json index 0ac27a3..a5dc90e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@bradgarropy/hue-sdk", - "version": "1.5.1", + "version": "1.5.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@bradgarropy/hue-sdk", - "version": "1.5.1", + "version": "1.5.2", "license": "MIT", "dependencies": { "node-fetch": "^2.6.1", @@ -25,6 +25,7 @@ "eslint-plugin-simple-import-sort": "^7.0.0", "jest": "^26.6.3", "jest-fetch-mock": "^3.0.3", + "prettier": "^2.2.1", "ts-jest": "^26.5.0", "typescript": "^4.1.3" }, @@ -6650,6 +6651,18 @@ "node": ">= 0.8.0" } }, + "node_modules/prettier": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz", + "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + } + }, "node_modules/pretty-format": { "version": "26.6.2", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-26.6.2.tgz", @@ -14016,6 +14029,12 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, + "prettier": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz", + "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", + "dev": true + }, "pretty-format": { "version": "26.6.2", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-26.6.2.tgz", diff --git a/package.json b/package.json index b0c713c..d254bcd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bradgarropy/hue-sdk", - "version": "1.5.1", + "version": "1.5.2", "description": "๐Ÿ’ก philips hue sdk", "keywords": [ "javascript", @@ -35,6 +35,10 @@ "scripts": { "start": "tsc --watch", "build": "tsc", + "lint": "eslint .", + "lint:fix": "eslint --fix .", + "format": "prettier --check .", + "format:fix": "prettier --write .", "test": "jest --passWithNoTests", "test:watch": "jest --passWithNoTests --watch", "prepare": "tsc" @@ -56,6 +60,7 @@ "eslint-plugin-simple-import-sort": "^7.0.0", "jest": "^26.6.3", "jest-fetch-mock": "^3.0.3", + "prettier": "^2.2.1", "ts-jest": "^26.5.0", "typescript": "^4.1.3" }, diff --git a/tests/hue/turnOffAllLights.test.ts b/tests/hue/turnOffAllLights.test.ts index c2e035d..8eaf528 100644 --- a/tests/hue/turnOffAllLights.test.ts +++ b/tests/hue/turnOffAllLights.test.ts @@ -1,7 +1,7 @@ import fetch from "jest-fetch-mock" -import hue from "../utils/hue" import {generateLights, generateRawLights} from "../utils/generators" +import hue from "../utils/hue" import {updateResponse} from "../utils/mocks" test("turns off all lights", async () => { diff --git a/tests/hue/turnOnAllLights.test.ts b/tests/hue/turnOnAllLights.test.ts index a98c2aa..7a78b3a 100644 --- a/tests/hue/turnOnAllLights.test.ts +++ b/tests/hue/turnOnAllLights.test.ts @@ -1,7 +1,7 @@ import fetch from "jest-fetch-mock" -import hue from "../utils/hue" import {generateLights, generateRawLights} from "../utils/generators" +import hue from "../utils/hue" import {updateResponse} from "../utils/mocks" test("turns on all lights", async () => {