Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: setup cache input and format files when committing #426

Merged
merged 1 commit into from
Apr 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn format:check
yarn lint
yarn lint-staged
5 changes: 5 additions & 0 deletions lint-staged.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
'**/*.{ts,js,tsx,jsx,mjs,json,md,mdx,scss,html,yml}': f =>
`npx nx format:write --files=${f.join(',')}`,
'{apps,libs,tools}/**/*.{ts,js}': 'eslint'
};
3 changes: 2 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"runner": "@nrwl/nx-cloud",
"options": {
"cacheableOperations": ["build", "test", "lint"],
"accessToken": "ZDc5YjI3NDItNzg5OS00YWM4LWE4ODItZjAzNjFkOWUwNzE3fHJlYWQtd3JpdGU="
"accessToken": "ZDc5YjI3NDItNzg5OS00YWM4LWE4ODItZjAzNjFkOWUwNzE3fHJlYWQtd3JpdGU=",
"runtimeCacheInputs": ["node -v", "node ./scripts/get-os.js"]
}
}
},
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"build": "nx build",
"watch": "nx build --watch --configuration development",
"test": "nx test",
"format:check": "prettier --config ./.prettierrc --list-different \"{projects,src}/**/*{.ts,.js,.json,.html,.scss}\"",
"format:all": "prettier --config ./.prettierrc --write \"{projects,src}/**/*{.ts,.js,.json,.html,.scss}\"",
"format:write": "nx format:write",
"format:check": "nx format:check",
"build:lib": "nx build @ngu/carousel",
"build:lib:watch": "nx build @ngu/carousel --watch",
"build:app": "nx build",
Expand Down Expand Up @@ -70,6 +70,7 @@
"karma-coverage": "2.2.0",
"karma-jasmine": "5.1.0",
"karma-jasmine-html-reporter": "2.0.0",
"lint-staged": "^13.2.0",
"ng-packagr": "15.0.1",
"nx": "15.4.1",
"postcss": "^8.4.5",
Expand Down
5 changes: 5 additions & 0 deletions scripts/get-os.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// This script is used as a runtime input for the Nx cache.
const os = require('os');
// Things like the version of NodeJS, whether we are running Windows or not, can affect
// the results of the computation but cannot be deduced statically.
console.log(os.type());
Loading