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

speed-up commit hook #1314

Merged
merged 1 commit into from
Nov 15, 2024
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
12 changes: 12 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@ jobs:
- name: Build
run: npm run build

- name: Verify no files changed after build
id: verify-changed-files
uses: tj-actions/verify-changed-files@v20

- name: Report file changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
env:
CHANGED_FILES: ${{ steps.verify-changed-files.outputs.changed_files }}
run: |
echo "Error - changed files after build: $CHANGED_FILES"
exit 1

- name: dotnet unit tests
run: dotnet test c-sharp-tests/c-sharp-tests.csproj

Expand Down
9 changes: 2 additions & 7 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

echo "Lint checking..."
# generate papi.d.ts as part of lint:staged
echo "Format and stylelint fixes..."
npm run lint:staged
echo "Lint check finished"

echo "Type checking..."
npm run typecheck
echo "Type check finished"
echo "Format and stylelint fixes finished"

echo "If the following fails run npm run editor:unlink"
npx yalc check
2 changes: 1 addition & 1 deletion extensions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"update-from-templates": "tsx ./lib/update-from-templates.ts"
},
"lint-staged": {
"*.{cjs,js,jsx,ts,tsx}": ["prettier --write", "cross-env NODE_ENV=development eslint --cache"],
"*.{cjs,js,jsx,ts,tsx}": ["prettier --write"],
"*.json": ["prettier --parser json --write"],
"*.{css,scss}": ["stylelint --fix"],
"*.{html,md,yml}": ["prettier --single-quote --write"]
Expand Down
2 changes: 1 addition & 1 deletion lib/papi-dts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"typecheck": "tsc -p ./tsconfig.lint.json"
},
"lint-staged": {
"*.{cjs,js,jsx,ts,tsx}": ["prettier --write", "cross-env NODE_ENV=development eslint --cache"],
"*.{cjs,js,jsx,ts,tsx}": ["prettier --write"],
"*.json": ["prettier --parser json --write"],
"*.{html,md,yml}": ["prettier --single-quote --write"]
},
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"lint": "cross-env NODE_OPTIONS=\"--max-old-space-size=4096\" npm run build:types && npm run lint:scripts && npm run lint:styles && cd lib/papi-dts && npm run lint && cd ../../extensions && npm run lint",
"lint:config": "cross-env NODE_ENV=development eslint --print-config .eslintrc.js > .eslintConfig.json",
"lint:scripts": "cross-env NODE_ENV=development eslint --ext .cjs,.js,.jsx,.ts,.tsx --cache .",
"lint:staged": "npm run build:types && lint-staged -q && cd lib/papi-dts && npm run lint:staged && cd ../../extensions && npm run lint:staged",
"lint:staged": "lint-staged -q && npm run lint:staged --workspaces --if-present",
"lint:styles": "stylelint **/*.{css,scss}",
"lint-fix": "npm run build:types && npm run lint-fix:scripts && npm run lint-fix:styles && cd lib/papi-dts && npm run lint-fix && cd ../../extensions && npm run lint-fix",
"lint-fix:scripts": "prettier --write \"**/*.{ts,tsx,js,jsx,cjs}\" && npm run lint:scripts",
Expand Down Expand Up @@ -96,7 +96,7 @@
"typecheck:platform-bible-utils": "cd lib/platform-bible-utils && npm run typecheck"
},
"lint-staged": {
"*.{cjs,js,jsx,ts,tsx}": ["prettier --write", "cross-env NODE_ENV=development eslint --cache"],
"*.{cjs,js,jsx,ts,tsx}": ["prettier --write"],
"*.json": ["prettier --parser json --write"],
"*.{css,scss}": ["stylelint --fix --allow-empty-input"],
"*.{html,md,yml}": ["prettier --single-quote --write"]
Expand Down
Loading