Skip to content

Commit

Permalink
chore(ci): add git hook to run prettier locally and in ci (vercel#395)
Browse files Browse the repository at this point in the history
Run prettier locally with a git hook and in CI using github actions
  • Loading branch information
styfle authored Feb 14, 2024
1 parent 0b2e370 commit 5b25e72
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,24 @@ jobs:
ports:
- 6379:6379
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
# we lock to 3.11 for a distutils requirement for node-gyp
python-version: '3.11'
- name: Prepare Install (if applicable)
run: node prepare-install.js
- name: Enable Corepack
run: corepack enable npm
- name: Install Dependencies
run: npm install
- name: Prettier
if: matrix.os == 'ubuntu-latest'
run: npm run prettier-check
- name: Build
run: npm run build
- name: Run Tests
Expand Down
8 changes: 8 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
],
"scripts": {
"build": "tsc",
"git-pre-commit": "prettier --write . && git add -A",
"prepublishOnly": "tsc && rm out/utils/*.d.ts && rm out/tsconfig.tsbuildinfo",
"prettier-check": "prettier --check .",
"prettier-fix": "prettier --write .",
Expand Down Expand Up @@ -48,6 +49,7 @@
"@types/graceful-fs": "^4.1.5",
"@types/micromatch": "^4.0.1",
"@types/node": "^14.14.37",
"@vercel/git-hooks": "^1.0.0",
"@vercel/style-guide": "^5.2.0",
"analytics-node": "^3.4.0-beta.1",
"apollo-server-express": "^2.14.2",
Expand Down

0 comments on commit 5b25e72

Please sign in to comment.