From db554038d43cd5f006bd318bf83dbc9d8575bf2a Mon Sep 17 00:00:00 2001 From: Jonathan Clem Date: Thu, 14 May 2020 15:31:19 -0400 Subject: [PATCH 1/4] Run format check before commit --- .gitattributes | 1 + .prettierrc | 7 +++++++ package-lock.json | 6 ++++++ package.json | 8 +++++--- 4 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 .prettierrc diff --git a/.gitattributes b/.gitattributes index 0f71952..9e176ea 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,2 @@ node_modules/** -diff linguist-generated=true +.licenses/** -diff linguist-generated=true diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..a6136e6 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,7 @@ +{ + "arrowParens": "avoid", + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "trailingComma": "es5" +} diff --git a/package-lock.json b/package-lock.json index e3b3664..92ac8aa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -412,6 +412,12 @@ "semver-compare": "^1.0.0" } }, + "prettier": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz", + "integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==", + "dev": true + }, "regenerator-runtime": { "version": "0.13.5", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz", diff --git a/package.json b/package.json index 8ffc68d..c593331 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,12 @@ "license": "MIT", "private": true, "scripts": { - "build": "ncc build src/setup-elixir.js" + "build": "ncc build src/setup-elixir.js", + "format": "prettier \"src/**/*.js\"" }, "husky": { "hooks": { - "pre-commit": "npm run build && git add dist/" + "pre-commit": "npm run format -- --check && npm run build && git add dist/" } }, "dependencies": { @@ -19,6 +20,7 @@ }, "devDependencies": { "@zeit/ncc": "^0.22.1", - "husky": "^4.2.5" + "husky": "^4.2.5", + "prettier": "^2.0.5" } } From bff9ed892eab11910678ab5f17bf8c3de9f6ed83 Mon Sep 17 00:00:00 2001 From: Jonathan Clem Date: Thu, 14 May 2020 16:19:55 -0400 Subject: [PATCH 2/4] Fix licensed check --- .github/workflows/licensed.yml | 6 ++++++ dist/.github/workflows/licensed.yml | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/.github/workflows/licensed.yml b/.github/workflows/licensed.yml index ee9408d..e287949 100644 --- a/.github/workflows/licensed.yml +++ b/.github/workflows/licensed.yml @@ -11,6 +11,12 @@ jobs: name: Check licenses steps: - uses: actions/checkout@v1.0.0 + - uses: actions/cache@v1 + with: + path: ~/.npm + key: ${{runner.os}}-npm-${{hashFiles('**/package-lock.json')}} + restore-keys: ${{runner.os}}-npm- + - run: npm ci - run: |- cd /tmp curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/2.3.2/licensed-2.3.2-linux-x64.tar.gz diff --git a/dist/.github/workflows/licensed.yml b/dist/.github/workflows/licensed.yml index ee9408d..e287949 100644 --- a/dist/.github/workflows/licensed.yml +++ b/dist/.github/workflows/licensed.yml @@ -11,6 +11,12 @@ jobs: name: Check licenses steps: - uses: actions/checkout@v1.0.0 + - uses: actions/cache@v1 + with: + path: ~/.npm + key: ${{runner.os}}-npm-${{hashFiles('**/package-lock.json')}} + restore-keys: ${{runner.os}}-npm- + - run: npm ci - run: |- cd /tmp curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/2.3.2/licensed-2.3.2-linux-x64.tar.gz From 9455766452f27d130d53274dcb7ef4597cd75061 Mon Sep 17 00:00:00 2001 From: Jonathan Clem Date: Thu, 14 May 2020 16:25:10 -0400 Subject: [PATCH 3/4] Update actions/checkout to v2 --- .github/workflows/licensed.yml | 5 +++-- .github/workflows/test.yml | 2 +- dist/.github/workflows/licensed.yml | 5 +++-- dist/.github/workflows/test.yml | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/licensed.yml b/.github/workflows/licensed.yml index e287949..c9b4b56 100644 --- a/.github/workflows/licensed.yml +++ b/.github/workflows/licensed.yml @@ -10,14 +10,15 @@ jobs: runs-on: ubuntu-latest name: Check licenses steps: - - uses: actions/checkout@v1.0.0 + - uses: actions/checkout@v2 - uses: actions/cache@v1 with: path: ~/.npm key: ${{runner.os}}-npm-${{hashFiles('**/package-lock.json')}} restore-keys: ${{runner.os}}-npm- - run: npm ci - - run: |- + - name: Install licensed + run: |- cd /tmp curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/2.3.2/licensed-2.3.2-linux-x64.tar.gz sudo tar -xzf licensed.tar.gz diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f09163b..165343a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,7 +22,7 @@ jobs: - otp-version: 22.0 elixir-version: master steps: - - uses: actions/checkout@v1.0.0 + - uses: actions/checkout@v2 - name: Use actions/setup-elixir uses: ./ with: diff --git a/dist/.github/workflows/licensed.yml b/dist/.github/workflows/licensed.yml index e287949..c9b4b56 100644 --- a/dist/.github/workflows/licensed.yml +++ b/dist/.github/workflows/licensed.yml @@ -10,14 +10,15 @@ jobs: runs-on: ubuntu-latest name: Check licenses steps: - - uses: actions/checkout@v1.0.0 + - uses: actions/checkout@v2 - uses: actions/cache@v1 with: path: ~/.npm key: ${{runner.os}}-npm-${{hashFiles('**/package-lock.json')}} restore-keys: ${{runner.os}}-npm- - run: npm ci - - run: |- + - name: Install licensed + run: |- cd /tmp curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/2.3.2/licensed-2.3.2-linux-x64.tar.gz sudo tar -xzf licensed.tar.gz diff --git a/dist/.github/workflows/test.yml b/dist/.github/workflows/test.yml index f09163b..165343a 100644 --- a/dist/.github/workflows/test.yml +++ b/dist/.github/workflows/test.yml @@ -22,7 +22,7 @@ jobs: - otp-version: 22.0 elixir-version: master steps: - - uses: actions/checkout@v1.0.0 + - uses: actions/checkout@v2 - name: Use actions/setup-elixir uses: ./ with: From 13359dc7e87d2f84d3064bd422e8aa5bcfb38e7b Mon Sep 17 00:00:00 2001 From: Jonathan Clem Date: Thu, 14 May 2020 16:26:15 -0400 Subject: [PATCH 4/4] Add Prettier license cache --- .github/workflows/licensed.yml | 2 +- .licenses/npm/prettier.dep.yml | 18 ++++++++++++++++++ dist/.github/workflows/licensed.yml | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 .licenses/npm/prettier.dep.yml diff --git a/.github/workflows/licensed.yml b/.github/workflows/licensed.yml index c9b4b56..70fbab0 100644 --- a/.github/workflows/licensed.yml +++ b/.github/workflows/licensed.yml @@ -20,7 +20,7 @@ jobs: - name: Install licensed run: |- cd /tmp - curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/2.3.2/licensed-2.3.2-linux-x64.tar.gz + curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/2.9.2/licensed-2.9.2-linux-x64.tar.gz sudo tar -xzf licensed.tar.gz sudo mv licensed /usr/local/bin/licensed - run: licensed status diff --git a/.licenses/npm/prettier.dep.yml b/.licenses/npm/prettier.dep.yml new file mode 100644 index 0000000..3b99b9a --- /dev/null +++ b/.licenses/npm/prettier.dep.yml @@ -0,0 +1,18 @@ +--- +name: prettier +version: 2.0.5 +type: npm +summary: Prettier is an opinionated code formatter +homepage: https://prettier.io +license: mit +licenses: +- sources: LICENSE + text: | + Copyright © James Long and contributors + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +notices: [] diff --git a/dist/.github/workflows/licensed.yml b/dist/.github/workflows/licensed.yml index c9b4b56..70fbab0 100644 --- a/dist/.github/workflows/licensed.yml +++ b/dist/.github/workflows/licensed.yml @@ -20,7 +20,7 @@ jobs: - name: Install licensed run: |- cd /tmp - curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/2.3.2/licensed-2.3.2-linux-x64.tar.gz + curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/2.9.2/licensed-2.9.2-linux-x64.tar.gz sudo tar -xzf licensed.tar.gz sudo mv licensed /usr/local/bin/licensed - run: licensed status