Skip to content

Commit

Permalink
Merge pull request #1165 from libris/fix-husky-and-lint-staged
Browse files Browse the repository at this point in the history
  • Loading branch information
johanbissemattsson authored Nov 15, 2024
2 parents 1dfe25c + 82e6056 commit 7fac6a9
Show file tree
Hide file tree
Showing 16 changed files with 50 additions and 42 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/codemirror-lang-lxlquery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
with:
node-version: 22
- name: Install dependencies
env:
HUSKY: ${{ env.HUSKY }}
run: npm ci
- name: Run tests
run: npm run test
2 changes: 2 additions & 0 deletions .github/workflows/lxl-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
with:
node-version: 22
- name: Install dependencies
env:
HUSKY: ${{ env.HUSKY }}
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/supersearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
with:
node-version: 22
- name: Install dependencies
env:
HUSKY: ${{ env.HUSKY }}
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
Expand Down
6 changes: 6 additions & 0 deletions .husky/install.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Skip Husky install in production and CI
if (process.env.NODE_ENV === "production" || process.env.CI === "true") {
process.exit(0);
}
const husky = (await import("husky")).default;
console.log(husky());
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
1 change: 0 additions & 1 deletion lxl-web/.husky/pre-commit

This file was deleted.

7 changes: 7 additions & 0 deletions lxl-web/.lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"*.{js,ts,svelte,css,scss,postcss,md,json}": [
"prettier --write --plugin-search-dir=.",
"prettier --check --plugin-search-dir=."
],
"*.{js,ts,svelte}": "eslint"
}
12 changes: 1 addition & 11 deletions lxl-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,7 @@
"lint": "prettier --check . && eslint .",
"format": "prettier --write .",
"test:integration": "playwright test",
"test:unit": "vitest",
"prepare": "cd .. && husky lxl-web/.husky"
},
"lint-staged": {
"*.{js,ts,svelte,css,scss,postcss,md,json}": [
"prettier --write --plugin-search-dir=.",
"prettier --check --plugin-search-dir=."
],
"*.{js,ts,svelte}": "eslint"
"test:unit": "vitest"
},
"devDependencies": {
"@axe-core/playwright": "^4.9.1",
Expand All @@ -43,10 +35,8 @@
"eslint-plugin-svelte": "^2.43.0",
"estree-walker": "^3.0.3",
"globals": "^15.9.0",
"husky": "^9.1.4",
"jmespath": "^0.16.0",
"js-cookie": "^3.0.5",
"lint-staged": "^15.2.9",
"lxljs": "^1.1.0",
"magic-string": "^0.30.11",
"mdsvex": "^0.12.3",
Expand Down
12 changes: 5 additions & 7 deletions package-lock.json

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

9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,12 @@
"packages/*",
"lxl-web",
"lxljs"
]
],
"devDependencies": {
"husky": "^9.1.6",
"lint-staged": "^15.2.10"
},
"scripts": {
"prepare": "node .husky/install.mjs"
}
}
1 change: 0 additions & 1 deletion packages/codemirror-lang-lxlquery/.husky/pre-commit

This file was deleted.

7 changes: 7 additions & 0 deletions packages/codemirror-lang-lxlquery/.lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"*.{js,ts,md,json}": [
"prettier --write --plugin-search-dir=.",
"prettier --check --plugin-search-dir=."
],
"*.{js,ts}": "eslint"
}
11 changes: 1 addition & 10 deletions packages/codemirror-lang-lxlquery/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,10 @@
"description": "Libris XL query language support for CodeMirror",
"scripts": {
"test": "vitest",
"prepare": "cd ../../ && husky && cd ./packages/codemirror-lang-lxlquery && rollup -c",
"prepare": "rollup -c",
"lint": "eslint . && prettier --check .",
"format": "prettier --write ."
},
"lint-staged": {
"*.{js,ts,md,json}": [
"prettier --write --plugin-search-dir=.",
"prettier --check --plugin-search-dir=."
],
"*.{js,ts}": "eslint"
},
"type": "module",
"main": "dist/index.cjs",
"module": "dist/index.js",
Expand All @@ -34,8 +27,6 @@
"eslint": "^9.14.0",
"eslint-config-prettier": "^9.1.0",
"globals": "^15.12.0",
"husky": "^9.1.6",
"lint-staged": "^15.2.10",
"prettier": "^3.3.3",
"rollup": "^2.60.2",
"rollup-plugin-dts": "^4.0.1",
Expand Down
1 change: 0 additions & 1 deletion packages/supersearch/.husky/pre-commit

This file was deleted.

7 changes: 7 additions & 0 deletions packages/supersearch/.lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"*.{js,ts,svelte,css,scss,postcss,md,json}": [
"prettier --write --plugin-search-dir=.",
"prettier --check --plugin-search-dir=."
],
"*.{js,ts,svelte}": "eslint"
}
11 changes: 1 addition & 10 deletions packages/supersearch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,7 @@
"test:unit": "vitest",
"lint": "eslint . && prettier --check .",
"format": "prettier --write .",
"prepare": "cd ../../ && husky && cd ./packages/supersearch && npm run package"
},
"lint-staged": {
"*.{js,ts,svelte,css,scss,postcss,md,json}": [
"prettier --write --plugin-search-dir=.",
"prettier --check --plugin-search-dir=."
],
"*.{js,ts,svelte}": "eslint"
"prepare": "npm run package"
},
"files": [
"dist",
Expand Down Expand Up @@ -59,8 +52,6 @@
"eslint-plugin-svelte": "^2.36.0",
"esm-env": "^1.1.4",
"globals": "^15.0.0",
"husky": "^9.1.6",
"lint-staged": "^15.2.10",
"prettier": "^3.3.2",
"prettier-plugin-css-order": "^2.1.2",
"prettier-plugin-svelte": "^3.2.6",
Expand Down

0 comments on commit 7fac6a9

Please sign in to comment.