diff --git a/.changeset/wise-ghosts-attack.md b/.changeset/wise-ghosts-attack.md new file mode 100644 index 0000000..a845151 --- /dev/null +++ b/.changeset/wise-ghosts-attack.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100755 index 0000000..45348d3 --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +pnpm exec commitlint --edit "$1" diff --git a/.husky/post-merge b/.husky/post-merge new file mode 100755 index 0000000..e44472b --- /dev/null +++ b/.husky/post-merge @@ -0,0 +1,14 @@ +#!/usr/bin/env sh +. "$(dirname "$0")/_/husky.sh" + +[ -n "$CI" ] && exit 0 + +changedFiles="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" + +hasChanged() { + echo "$changedFiles" | grep -q "$1" +} + +if hasChanged 'pnpm-lock.yaml'; then + pnpm install +fi diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000..fb25df7 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,6 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +[ -n "$CI" ] && exit 0 + +pnpm exec lint-staged diff --git a/.husky/pre-push b/.husky/pre-push new file mode 100755 index 0000000..844abfb --- /dev/null +++ b/.husky/pre-push @@ -0,0 +1,6 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +[ -n "$CI" ] && exit 0 + +pnpm exec changeset status --since main diff --git a/package.json b/package.json index dfce8db..9bbeee4 100644 --- a/package.json +++ b/package.json @@ -12,14 +12,11 @@ "clean:root": "rm -rf .turbo && rm -rf node_modules", "format": "prettier --write \"**/*.{cjs,js,jsx,ts,tsx,json,md,mdx,yml}\"", "lint": "turbo run lint", + "prepare": "ts-node ./scripts/prepare.ts", "release": "changeset publish", "sort-package-json": "pnpm dlx sort-package-json && turbo run sort-package-json", "version-packages": "changeset version" }, - "simple-git-hooks": { - "pre-commit": "pnpm exec lint-staged && pnpm run changeset status --since main", - "commit-msg": "pnpm exec commitlint --edit ${1}" - }, "commitlint": { "extends": [ "@commitlint/config-conventional" @@ -36,11 +33,15 @@ "@commitlint/config-conventional": "^17.1.0", "@mheob/eslint-config": "workspace:*", "@mheob/prettier-config": "workspace:*", + "@types/node": "^18.7.18", "eslint": "^8.23.1", + "husky": "^8.0.0", + "is-ci": "^3.0.1", "lint-staged": "^13.0.3", "prettier": "^2.7.1", - "simple-git-hooks": "^2.8.0", - "turbo": "^1.4.6" + "ts-node": "^10.9.1", + "turbo": "^1.4.6", + "typescript": "^4.8.3" }, "packageManager": "pnpm@7.11.0", "engines": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 76c9451..28315a3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,22 +9,30 @@ importers: '@commitlint/config-conventional': ^17.1.0 '@mheob/eslint-config': workspace:* '@mheob/prettier-config': workspace:* + '@types/node': ^18.7.18 eslint: ^8.23.1 + husky: ^8.0.0 + is-ci: ^3.0.1 lint-staged: ^13.0.3 prettier: ^2.7.1 - simple-git-hooks: ^2.8.0 + ts-node: ^10.9.1 turbo: ^1.4.6 + typescript: ^4.8.3 devDependencies: '@changesets/cli': 2.24.4 '@commitlint/cli': 17.1.2 '@commitlint/config-conventional': 17.1.0 '@mheob/eslint-config': link:packages/eslint-config '@mheob/prettier-config': link:packages/prettier-config + '@types/node': 18.7.18 eslint: 8.23.1 + husky: 8.0.1 + is-ci: 3.0.1 lint-staged: 13.0.3 prettier: 2.7.1 - simple-git-hooks: 2.8.0 + ts-node: 10.9.1_bidgzm5cq2du6gnjtweqqjrrn4 turbo: 1.4.6 + typescript: 4.8.3 packages/eslint-config: specifiers: @@ -893,6 +901,10 @@ packages: resolution: {integrity: sha512-LhF+9fbIX4iPzhsRLpK5H7iPdvW8L4IwGciXQIOEcuF62+9nw/VQVsOViAOOGxY3OlOKGLFv0sWwJXdwQeTn6A==} dev: true + /@types/node/18.7.18: + resolution: {integrity: sha512-m+6nTEOadJZuTPkKR/SYK3A2d7FZrgElol9UP1Kae90VVU4a6mxnPuLiIW1m4Cq4gZ/nWb9GrdVXJCoCazDAbg==} + dev: true + /@types/normalize-package-data/2.4.1: resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==} @@ -2426,6 +2438,12 @@ packages: engines: {node: '>=12.20.0'} dev: true + /husky/8.0.1: + resolution: {integrity: sha512-xs7/chUH/CKdOCs7Zy0Aev9e/dKOMZf3K1Az1nar3tzlv0jfqnYtu235bstsWTmXOR0EfINrPa97yy4Lz6RiKw==} + engines: {node: '>=14'} + hasBin: true + dev: true + /iconv-lite/0.4.24: resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} engines: {node: '>=0.10.0'} @@ -3712,12 +3730,6 @@ packages: resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} dev: true - /simple-git-hooks/2.8.0: - resolution: {integrity: sha512-ocmZQORwa6x9mxg+gVIAp5o4wXiWOHGXyrDBA0+UxGKIEKOyFtL4LWNKkP/2ornQPdlnlDGDteVeYP5FjhIoWA==} - hasBin: true - requiresBuild: true - dev: true - /slash/3.0.0: resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} engines: {node: '>=8'} @@ -3962,6 +3974,37 @@ packages: engines: {node: '>=8'} dev: true + /ts-node/10.9.1_bidgzm5cq2du6gnjtweqqjrrn4: + resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} + hasBin: true + peerDependencies: + '@swc/core': '>=1.2.50' + '@swc/wasm': '>=1.2.50' + '@types/node': '*' + typescript: '>=2.7' + peerDependenciesMeta: + '@swc/core': + optional: true + '@swc/wasm': + optional: true + dependencies: + '@cspotcode/source-map-support': 0.8.1 + '@tsconfig/node10': 1.0.9 + '@tsconfig/node12': 1.0.11 + '@tsconfig/node14': 1.0.3 + '@tsconfig/node16': 1.0.3 + '@types/node': 18.7.18 + acorn: 8.8.0 + acorn-walk: 8.2.0 + arg: 4.1.3 + create-require: 1.1.1 + diff: 4.0.2 + make-error: 1.3.6 + typescript: 4.8.3 + v8-compile-cache-lib: 3.0.1 + yn: 3.1.1 + dev: true + /ts-node/10.9.1_ck2axrxkiif44rdbzjywaqjysa: resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} hasBin: true diff --git a/scripts/prepare.ts b/scripts/prepare.ts new file mode 100644 index 0000000..10c505b --- /dev/null +++ b/scripts/prepare.ts @@ -0,0 +1,7 @@ +import { install as installHusky } from 'husky'; + +const isCI = process.env.CI !== undefined; + +if (!isCI) { + installHusky(); +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..5e4187e --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "./packages/tsconfig/base.json" +}