diff --git a/.husky/pre-commit b/.husky/pre-commit old mode 100755 new mode 100644 index 9091e9f9..0cd898f4 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,6 +1,3 @@ -#!/usr/bin/env sh -. "$(dirname -- "$0")/_/husky.sh" - yarn todos && git add TODO.md yarn prettier --write TODO.md && git add TODO.md yarn doctoc && git add README.md diff --git a/package.json b/package.json index 45caa2ce..6027d42f 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,8 @@ ], "scripts": { "build": "yarn workspaces foreach --all --topological --verbose run build", - "build:watch": "yarn workspaces foreach --all --parallel --jobs unlimited --interlaced run build:watch", "build:clean": "yarn workspaces foreach --all --topological --verbose run build:clean", + "build:watch": "yarn workspaces foreach --all --parallel --jobs unlimited --interlaced run build:watch", "doctoc": "doctoc README.md", "format": "prettier --write --ignore-unknown .", "format:check": "prettier --check --ignore-unknown .", diff --git a/packages/plugins/src/husky/husky.ts b/packages/plugins/src/husky/husky.ts index 5c4efb2a..7ddf882a 100644 --- a/packages/plugins/src/husky/husky.ts +++ b/packages/plugins/src/husky/husky.ts @@ -121,8 +121,9 @@ export async function addPreCommitHookCommand({ return; } - await exec("yarn", ["husky", "add", PRE_COMMIT_FILENAME, `"${command}"`], { - cwd: directory, + await setPreCommitHookCommands({ + directory, + commands: [...(await getPreCommitHookCommands({ directory })), command], }); } @@ -139,15 +140,7 @@ export async function removePreCommitHookCommand({ (line) => line !== command, ); - if (newCommands.length === 2) { - /** - * We're left with only these lines: - * - * ``` - * #!/usr/bin/env sh - * . "$(dirname -- "$0")/_/husky.sh" - * ``` - */ + if (newCommands.length === 0) { await removeFile({ path: getPreCommitHookPath({ directory }) }); return; }