Skip to content

Commit 4a2d645

Browse files
authored
feat: ci caching (#592)
* feat: eslint cache location * ci: enable custom cache * feat: prettier cache * chore: devcontainer updates * chore: remove pre-commit prettier as DOA * feat: typescript cache * ci: node version * fix: cache directory * cli: update all * feat: knip cache * feat: vitest cache * ci: update cache key hash * ci: fix lint * fix: engine node
1 parent 2310462 commit 4a2d645

File tree

9 files changed

+29
-24
lines changed

9 files changed

+29
-24
lines changed

.devcontainer/devcontainer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717
}
1818
},
1919
"postCreateCommand": "sed -i '/^ZSH_THEME/c\\ZSH_THEME=\"bira\"' ~/.zshrc && pnpm i && pre-commit install",
20-
"updateContentCommand": "pnpm i && pre-commit install",
20+
"updateContentCommand": "rm -rf .cache && pnpm i && pre-commit install",
2121
"features": {
22-
"ghcr.io/devcontainers-contrib/features/act:1": {},
22+
"ghcr.io/devcontainers-extra/features/act:1": {},
2323
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {},
2424
"ghcr.io/devcontainers/features/node:1": {
25-
"version": "20.18.2",
26-
"pnpmVersion": "10.2.1"
25+
"version": "20.19.3",
26+
"pnpmVersion": "10.12.4"
2727
},
2828
"ghcr.io/devcontainers/features/github-cli:1": {},
29-
"ghcr.io/devcontainers-contrib/features/pre-commit:2": {}
29+
"ghcr.io/devcontainers-extra/features/pre-commit:2": {}
3030
}
3131

3232
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
languages: ${{ matrix.language }}
3030
- uses: andykenward/github-actions/setup-pnpm@32471b1e0a5df8a09500a54b1254e3f0f881e52d #v1.0.3
3131
with:
32-
node-version: 20.x
32+
node-version: 20
3333
- name: Rebuild the dist/ directory
3434
run: pnpm run build
3535
- name: Perform CodeQL Analysis

.github/workflows/test.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,14 @@ jobs:
2323
- uses: andykenward/github-actions/setup-pnpm@32471b1e0a5df8a09500a54b1254e3f0f881e52d #v1.0.3
2424
with:
2525
node-version: 20
26+
- name: Cache
27+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 #v4.2.3
28+
with:
29+
path: |
30+
~/.cache/
31+
key: ${{ runner.os }}-node-${{ hashFiles('**/pnpm-lock.yaml', '**/eslint.config.js', '**/prettier.config.cjs', '**/tsconfig.json', '**/knip.json', '**/vitest.config.ts', '**/vitest.setup.ts') }}
2632
- name: Lint
27-
run: pnpm run lint
33+
run: pnpm run lint --cache-strategy content
2834
- name: Typecheck
2935
run: pnpm run tsc:check
3036
- name: Test

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ Thumbs.db
2929
# Coverage directory used by tools like istanbul
3030
coverage
3131
*.lcov
32+
33+
# custom cache
34+
.cache

.pre-commit-config.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,3 @@ repos:
1414
rev: v1.0.0
1515
hooks:
1616
- id: check-json5
17-
- repo: https://github.com/pre-commit/mirrors-prettier
18-
rev: v4.0.0-alpha.8
19-
hooks:
20-
- id: prettier
21-
additional_dependencies:
22-
- prettier@3.5.3
23-
- '@ianvs/prettier-plugin-sort-imports@4.4.1'
24-
- 'prettier-plugin-packagejson@2.5.10'

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ example/
55
payload-examples/
66
tsconfig.tsnode.json
77
__generated__/
8+
.cache
89
.changeset/*.md

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,21 @@
1919
"exports": "./dist/deploy/index.js",
2020
"scripts": {
2121
"act:d": "act -j delete --secret-file .env",
22-
"all": "pnpm run knip && pnpm run codegen && pnpm run codegen:events && pnpm run tsc:ls && pnpm run format && pnpm run lint:ls && pnpm run test && pnpm run build",
22+
"all": "pnpm run knip && pnpm run codegen && pnpm run codegen:events && pnpm run tsc:check && pnpm run format && pnpm run lint && pnpm run test && pnpm run build",
2323
"build": "rm -rf ./dist/* && node ./esbuild.config.js",
2424
"changeset": "changeset",
2525
"codegen": "graphql-codegen-esm --config graphql.config.ts",
2626
"codegen:events": "tsx bin/codegen/index.ts",
2727
"codegen:watch": "pnpm run codegen --watch",
2828
"deployments:delete": "tsx bin/deployments/index.ts",
2929
"download": "tsx bin/download/index.ts",
30-
"format": "prettier --write .",
31-
"format:check": "prettier --check .",
32-
"knip": "knip",
33-
"lint": "eslint .",
30+
"format": "prettier --write . --cache --cache-location '.cache/prettier/'",
31+
"format:check": "pnpm run format --check",
32+
"knip": "knip --cache --cache-location '.cache/knip'",
33+
"lint": "eslint --cache --cache-location '.cache/eslint/' .",
3434
"lint:debug": "pnpm run lint --debug",
3535
"lint:fix": "pnpm run lint --fix",
36-
"lint:ls": "DEBUG=eslint:cli-engine pnpm run lint",
36+
"lint:ls": "DEBUG=eslint:eslint pnpm run lint",
3737
"release": "pnpm run all && changeset publish",
3838
"start": "node -r dotenv/config ./dist/index.js",
3939
"test": "vitest run",
@@ -89,10 +89,10 @@
8989
"peerDependencies": {
9090
"wrangler": "^4.13.2"
9191
},
92-
"packageManager": "pnpm@10.11.0",
92+
"packageManager": "pnpm@10.12.4",
9393
"engines": {
94-
"node": "^20.11.0",
95-
"pnpm": "^10.2.1"
94+
"node": "^20.19.2",
95+
"pnpm": "^10.12.4"
9696
},
9797
"pnpm": {
9898
"peerDependencyRules": {

tsconfig.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
22
"extends": "@tsconfig/node20/tsconfig.json",
33
"compilerOptions": {
4+
"tsBuildInfoFile": ".cache/.tsbuildinfo",
45
"allowJs": true,
6+
"incremental": true,
57
"verbatimModuleSyntax": true,
68
"noEmit": true,
79
"resolveJsonModule": true,

vitest.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import path from 'node:path'
77
import {defaultExclude, defineConfig} from 'vitest/config'
88

99
export default defineConfig({
10+
cacheDir: '.cache/.vitest',
1011
test: {
1112
environment: 'node',
1213
setupFiles: ['vitest.setup.ts'],

0 commit comments

Comments
 (0)