diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a8d70e1..bbe3252 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,8 +31,61 @@ jobs: with: node-version: ${{ matrix.node-version }} + - name: Cache node modules + id: cache-npm + uses: actions/cache@v3 + env: + cache-name: cache-node-modules + with: + path: node_modules + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json,**/package.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Cache eslint + id: cache-eslint + uses: actions/cache@v3 + env: + cache-name: cache-eslint + with: + path: .eslintcache + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json,**/package.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Cache TypeScript + id: cache-typescript + uses: actions/cache@v3 + env: + cache-name: cache-typescript + with: + path: .tsbuildinfo + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json,**/package.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Cache prettier + id: cache-prettier + uses: actions/cache@v3 + env: + cache-name: cache-prettier + with: + path: node_modules/.cache/prettier/.prettier-cache + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json,**/package.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: Install dependencies run: npm install + if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} - name: Lint the project run: npm run lint diff --git a/package.json b/package.json index 6b83298..61532f2 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ }, "main": "dist/src/index.js", "scripts": { - "lint": "ifNotCi() { test \"$CI\" && echo \"$2\" || echo \"$1\"; }; `npm bin`/tsc --noEmit && `npm bin`/prettier --ignore-path=.gitignore `ifNotCi --write --check` '**/**.{ts,js,json}' && `npm bin`/eslint `ifNotCi --fix` --ignore-path=.gitignore '**/**.{ts,js,json}'", + "lint": "ifNotCi() { test \"$CI\" && echo \"$2\" || echo \"$1\"; }; `npm bin`/tsc --noEmit && `npm bin`/prettier --ignore-path=.gitignore `ifNotCi --write \"--check --cache --cache-strategy content\"` '**/**.{ts,js,json}' && `npm bin`/eslint `ifNotCi --fix \"--cache --cache-strategy content\"` --ignore-path=.gitignore '**/**.{ts,js,json}'", "start": "npm run build && npm run link && nodemon", "test": "ifNotCi() { test \"$CI\" && echo \"$2\" || echo \"$1\"; }; npm run code-generation && `npm bin`/jest `ifNotCi --watchAll`", "link": "npm install --no-save file:///$PWD/", diff --git a/tsconfig.json b/tsconfig.json index 85653a1..e72bbd6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,7 +12,9 @@ "esModuleInterop": true, "importsNotUsedAsValues": "error", "noImplicitAny": true, - "resolveJsonModule": true + "resolveJsonModule": true, + "tsBuildInfoFile": ".tsbuildinfo", + "incremental": true }, "include": ["src/", "tests/"], "exclude": []