Skip to content

Commit 4b3dbf1

Browse files
authored
Merge pull request #357 from layer5io/351-pre-commit
chore(repo): move pre-commit and prepare-commit-msg to package.json
2 parents cf9b69e + 5ef0d06 commit 4b3dbf1

File tree

5 files changed

+31
-26
lines changed

5 files changed

+31
-26
lines changed

.github/workflows/pre-release.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,16 @@ jobs:
4444

4545
- name: Identify changed packages
4646
run: |
47-
CHANGED_PACKAGES=$(yarn lerna changed --json | jq -r '.[].name' || echo "Error parsing JSON")
48-
echo $CHANGED_PACKAGES
47+
CHANGED_PACKAGES=$(yarn lerna changed --json)
48+
echo "Raw JSON output:"
49+
echo "$CHANGED_PACKAGES"
50+
51+
CHANGED_PACKAGES_NAMES=$(echo "$CHANGED_PACKAGES" | jq -r '.[].name' || echo "Error parsing JSON")
52+
echo "Parsed package names:"
53+
echo "$CHANGED_PACKAGES_NAMES"
4954
5055
- name: Version packages
51-
run: ./scripts/version-prerelease-packages.sh $CHANGED_PACKAGES
56+
run: ./scripts/version-prerelease-packages.sh $CHANGED_PACKAGES_NAMES
5257

5358
- name: Commit changes
5459
run: |

.husky/pre-commit

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

.husky/prepare-commit-msg

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

package.json

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,38 @@
99
"packages/*"
1010
],
1111
"scripts": {
12-
"prepare": "node -e \"try { require('husky').install() } catch (e) {if (e.code !== 'MODULE_NOT_FOUND') throw e}\"",
13-
"commit:sign": "git cz -S",
14-
"clean": "lerna clean -y",
1512
"build-all": "lerna run build",
13+
"clean": "lerna clean -y",
14+
"commit": "cz",
15+
"commit:sign": "cz -s",
16+
"commitlint": "commitlint --edit",
1617
"format:check": "prettier --check \"**/*.{ts,tsx,md}\" --config ./.prettierrc",
1718
"format:write": "prettier --write \"**/*.{ts,tsx,md}\" --config ./.prettierrc",
1819
"postinstall": "husky install",
19-
"lint": "eslint ."
20+
"lint": "eslint .",
21+
"prepare": "node -e \"try { require('husky').install() } catch (e) {if (e.code !== 'MODULE_NOT_FOUND') throw e}\""
22+
},
23+
"husky": {
24+
"hooks": {
25+
"pre-commit": "lint-staged",
26+
"prepare-commit-msg": "exec < /dev/tty && yarn cz --hook || true"
27+
}
2028
},
2129
"lint-staged": {
2230
"*.{ts,tsx,md}": [
23-
"eslint --fix",
24-
"yarn format:write"
31+
"prettier --write",
32+
"eslint --fix"
2533
]
2634
},
35+
"config": {
36+
"commitizen": {
37+
"path": "cz-conventional-changelog"
38+
}
39+
},
2740
"devDependencies": {
2841
"@commitlint/cli": "^17.7.2",
2942
"@commitlint/config-conventional": "^17.7.0",
43+
"commitizen": "^4.3.0",
3044
"cz-conventional-changelog": "^3.3.0",
3145
"eslint": "^8.49.0",
3246
"husky": "^8.0.0",
@@ -37,10 +51,5 @@
3751
"tsconfig": "workspace:^",
3852
"typescript": "^5.2.2"
3953
},
40-
"packageManager": "yarn@3.6.3",
41-
"config": {
42-
"commitizen": {
43-
"path": "cz-conventional-changelog"
44-
}
45-
}
54+
"packageManager": "yarn@3.6.3"
4655
}

yarn.lock

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3321,7 +3321,7 @@ __metadata:
33213321
languageName: node
33223322
linkType: hard
33233323

3324-
"commitizen@npm:^4.0.3":
3324+
"commitizen@npm:^4.0.3, commitizen@npm:^4.3.0":
33253325
version: 4.3.0
33263326
resolution: "commitizen@npm:4.3.0"
33273327
dependencies:
@@ -9328,6 +9328,7 @@ __metadata:
93289328
dependencies:
93299329
"@commitlint/cli": ^17.7.2
93309330
"@commitlint/config-conventional": ^17.7.0
9331+
commitizen: ^4.3.0
93319332
cz-conventional-changelog: ^3.3.0
93329333
eslint: ^8.49.0
93339334
husky: ^8.0.0

0 commit comments

Comments
 (0)