Skip to content

Commit

Permalink
ci: add deduplicate:check script and run on precommit and CI
Browse files Browse the repository at this point in the history
- `--list --fail` will make it error out with a list of the deps that
  need deduplication

- add yarn-deduplicate as a devDep since it's now used in a few places
  and would be good to cache install of it
  - ironically, adding it created a duplicate dep on semver, which made
    it fail precommit until I usd it to resolve that
  • Loading branch information
agilgur5 committed Aug 25, 2020
1 parent d053912 commit 22133ce
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 9 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ on:
types: [opened, synchronize, reopened]

jobs:
lint:
lint-and-dedupe:
runs-on: ubuntu-latest

name: Lint on node 10.x and ubuntu-latest
name: Lint & Deduplicate deps on node 10.x and ubuntu-latest

steps:
- uses: actions/checkout@v1
Expand All @@ -23,6 +23,9 @@ jobs:
- name: Lint codebase
run: yarn lint:post-build

- name: Deduplicate dependencies
run: yarn deduplicate:check

test:
runs-on: ${{ matrix.os }}

Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"test:post-build": "node dist/index.js test",
"start": "tsc -p tsconfig.json --watch",
"release": "np",
"deduplicate": "npx yarn-deduplicate -s fewer yarn.lock"
"deduplicate": "yarn-deduplicate -s fewer yarn.lock",
"deduplicate:check": "yarn-deduplicate -s fewer yarn.lock --list --fail"
},
"files": [
"dist",
Expand Down Expand Up @@ -125,11 +126,12 @@
"rollup-plugin-postcss": "^2.5.0",
"styled-components": "^5.0.1",
"tiny-invariant": "^1.1.0",
"tiny-warning": "^1.0.3"
"tiny-warning": "^1.0.3",
"yarn-deduplicate": "^2.1.1"
},
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged --pattern '!test/tests/lint/**' && yarn lint && doctoc README.md"
"pre-commit": "pretty-quick --staged --pattern '!test/tests/lint/**' && yarn lint && yarn deduplicate:check && doctoc README.md"
}
},
"prettier": {
Expand Down
27 changes: 23 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1391,6 +1391,11 @@
semver "^6.3.0"
tsutils "^3.17.1"

"@yarnpkg/lockfile@^1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31"
integrity sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==

abab@^2.0.0:
version "2.0.3"
resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.3.tgz#623e2075e02eb2d3f2475e49f99c91846467907a"
Expand Down Expand Up @@ -2376,6 +2381,11 @@ commander@^2.11.0, commander@^2.20.0:
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==

commander@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-5.1.0.tgz#46abbd1652f8e059bddaef99bbdcb2ad9cf179ae"
integrity sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==

commondir@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b"
Expand Down Expand Up @@ -7322,10 +7332,10 @@ semver@6.x, semver@^6.0.0, semver@^6.1.2, semver@^6.2.0, semver@^6.3.0:
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==

semver@^7.1.1:
version "7.1.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.1.1.tgz#29104598a197d6cbe4733eeecbe968f7b43a9667"
integrity sha512-WfuG+fl6eh3eZ2qAf6goB7nhiCd7NPXhmyFxigB/TOkQyeLP8w8GsVehvtGNtnNmyboz4TgeK40B1Kbql/8c5A==
semver@^7.1.1, semver@^7.3.2:
version "7.3.2"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938"
integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==

serialize-javascript@^1.7.0:
version "1.9.1"
Expand Down Expand Up @@ -8577,3 +8587,12 @@ yargs@^15.3.1:
which-module "^2.0.0"
y18n "^4.0.0"
yargs-parser "^18.1.1"

yarn-deduplicate@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/yarn-deduplicate/-/yarn-deduplicate-2.1.1.tgz#500a3010e4bdee3c3250936e210910c7cae3d75d"
integrity sha512-lbFJGOMnqG/ncGjNBUt+JG4qfAGqeh8o9i4i5LXqNBdQ8ov8av6T1jizWQqr+zLPLCOqp/BYBZz8FymPQSR4RA==
dependencies:
"@yarnpkg/lockfile" "^1.1.0"
commander "^5.1.0"
semver "^7.3.2"

1 comment on commit 22133ce

@vercel
Copy link

@vercel vercel bot commented on 22133ce Aug 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.