Skip to content

Commit 129490b

Browse files
authored
Merge pull request #48 from indaco/setup-husky-lintstaged
ci: setup husky, commilint and lint-staged
2 parents 72b9afd + e084ab2 commit 129490b

File tree

8 files changed

+1427
-58
lines changed

8 files changed

+1427
-58
lines changed

.githooks/commit-msg

Lines changed: 0 additions & 13 deletions
This file was deleted.

.husky/commit-msg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
pnpm commitlint ${1}

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx lint-staged

.lintstagedrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"*.{js,ts,svelte}": ["pnpm format --", "pnpm lint --"],
3+
"*.json": "prettier --write --ignore-path ./.prettierignore --"
4+
}

.prettierrc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,20 @@
33
"singleQuote": true,
44
"trailingComma": "none",
55
"printWidth": 100,
6-
"plugins": ["prettier-plugin-svelte"],
6+
"plugins": ["prettier-plugin-svelte", "prettier-plugin-packagejson"],
77
"overrides": [
88
{
99
"files": ["*.svelte"],
1010
"options": {
1111
"bracketSameLine": false,
1212
"parser": "svelte"
1313
}
14+
},
15+
{
16+
"files": ["package.json"],
17+
"options": {
18+
"useTabs": false
19+
}
1420
}
1521
]
1622
}

commitlint.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default {
2+
extends: ['@commitlint/config-conventional']
3+
};

package.json

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
{
22
"name": "@indaco/svelte-iconoir",
33
"version": "6.0.3",
4-
"type": "module",
5-
"packageManager": "pnpm@8.10.1",
6-
"author": "indaco <github@mircoveltri.me>",
74
"description": "Iconoir SVG icons as Svelte components.",
8-
"license": "MIT",
95
"keywords": [
106
"iconoir",
117
"icons",
@@ -15,17 +11,39 @@
1511
"sveltekit",
1612
"svg-icons"
1713
],
14+
"bugs": {
15+
"url": "https://github.com/indaco/svelte-iconoir/issues"
16+
},
1817
"repository": {
1918
"type": "git",
2019
"url": "https://github.com/indaco/svelte-iconoir"
2120
},
22-
"bugs": {
23-
"url": "https://github.com/indaco/svelte-iconoir/issues"
24-
},
25-
"peerDependencies": {
26-
"svelte": "^3.59.1 || ^4.0.0"
21+
"license": "MIT",
22+
"author": "indaco <github@mircoveltri.me>",
23+
"sideEffects": false,
24+
"type": "module",
25+
"svelte": "./index.js",
26+
"scripts": {
27+
"build": "rimraf dist && pnpm sync && svelte-package",
28+
"postbuild": "pnpm generate:pkgjson && pnpm cpfiles && pnpm exec publint ./dist",
29+
"check": "pnpm sync && svelte-check --tsconfig ./tsconfig.json",
30+
"check:watch": "pnpm sync && svelte-check --tsconfig ./tsconfig.json --watch",
31+
"clean": "rimraf dist && pnpm compile && node build/scripts/cleanAll.js",
32+
"commitlint": "commitlint --edit",
33+
"compile": "tsc --outDir build/scripts",
34+
"cpfiles": "node build/scripts/cpFiles.js",
35+
"dev": "pnpm sync && vite dev",
36+
"format": "prettier --write --plugin prettier-plugin-svelte --ignore-path ./.prettierignore .",
37+
"generate:icons": "pnpm compile && pnpm clean && node build/scripts/buildIconsDataset.js",
38+
"generate:pkgjson": "pnpm compile && node build/scripts/makeProdPkg.js",
39+
"lint": "prettier --check . && eslint .",
40+
"prepare": "husky install",
41+
"preview": "vite preview",
42+
"sync": "svelte-kit sync"
2743
},
2844
"devDependencies": {
45+
"@commitlint/cli": "^18.2.0",
46+
"@commitlint/config-conventional": "^18.1.0",
2947
"@sveltejs/adapter-auto": "^2.1.0",
3048
"@sveltejs/kit": "^1.27.2",
3149
"@sveltejs/package": "^2.2.2",
@@ -38,8 +56,11 @@
3856
"eslint-config-prettier": "^9.0.0",
3957
"eslint-plugin-svelte": "^2.34.0",
4058
"hast-util-to-html": "^9.0.0",
59+
"husky": "^8.0.0",
60+
"lint-staged": "^15.0.2",
4161
"picocolors": "1.0.0",
4262
"prettier": "^3.0.3",
63+
"prettier-plugin-packagejson": "^2.4.6",
4364
"prettier-plugin-svelte": "^3.0.3",
4465
"publint": "^0.2.5",
4566
"rimraf": "^5.0.5",
@@ -50,22 +71,8 @@
5071
"typescript": "^5.2.2",
5172
"vite": "^4.5.0"
5273
},
53-
"scripts": {
54-
"build": "rimraf dist && pnpm sync && svelte-package",
55-
"check": "pnpm sync && svelte-check --tsconfig ./tsconfig.json",
56-
"check:watch": "pnpm sync && svelte-check --tsconfig ./tsconfig.json --watch",
57-
"clean": "rimraf dist && pnpm compile && node build/scripts/cleanAll.js",
58-
"compile": "tsc --outDir build/scripts",
59-
"cpfiles": "node build/scripts/cpFiles.js",
60-
"dev": "pnpm sync && vite dev",
61-
"format": "prettier --write --plugin prettier-plugin-svelte --ignore-path ./.prettierignore .",
62-
"generate:icons": "pnpm compile && pnpm clean && node build/scripts/buildIconsDataset.js",
63-
"generate:pkgjson": "pnpm compile && node build/scripts/makeProdPkg.js",
64-
"lint": "prettier --check . && eslint .",
65-
"postbuild": "pnpm generate:pkgjson && pnpm cpfiles && pnpm exec publint ./dist",
66-
"preview": "vite preview",
67-
"sync": "svelte-kit sync"
74+
"peerDependencies": {
75+
"svelte": "^3.59.1 || ^4.0.0"
6876
},
69-
"sideEffects": false,
70-
"svelte": "./index.js"
71-
}
77+
"packageManager": "pnpm@8.10.1"
78+
}

0 commit comments

Comments
 (0)