From ab759946f7aad0cba84458bcbf3404e09c239dec Mon Sep 17 00:00:00 2001 From: 3y3 <3y3@ya.ru> Date: Tue, 13 Aug 2024 00:30:35 +0300 Subject: [PATCH] fix: Fix bin resolution for metapackage structure --- bin/eslint | 3 ++- bin/husky | 3 ++- bin/lint-staged | 3 ++- bin/prettier | 3 ++- bin/stylelint | 3 ++- bin/svgo | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/bin/eslint b/bin/eslint index 8c77361..136010a 100755 --- a/bin/eslint +++ b/bin/eslint @@ -1,6 +1,7 @@ #!/usr/bin/env bash -BINDIR=$(dirname $(node -pe "require.resolve('eslint/package.json')")) +SRCDIR=$(dirname $(dirname $(node -pe "require('fs').realpathSync('${0//\\//}')"))) +BINDIR=$(dirname $(cd "$SRCDIR"; node -pe "require.resolve('eslint/package.json')")) if [[ -z "$BINDIR" ]]; then echo "Required package 'eslint' not found" diff --git a/bin/husky b/bin/husky index 73ad02f..1e517b3 100755 --- a/bin/husky +++ b/bin/husky @@ -1,6 +1,7 @@ #!/usr/bin/env bash -BINDIR=$(dirname $(node -pe "require.resolve('husky')")) +SRCDIR=$(dirname $(dirname $(node -pe "require('fs').realpathSync('${0//\\//}')"))) +BINDIR=$(dirname $(cd "$SRCDIR"; node -pe "require.resolve('husky')")) if [[ -z "$BINDIR" ]]; then echo "Required package 'husky' not found" diff --git a/bin/lint-staged b/bin/lint-staged index 4d1c5c2..b13d9e7 100755 --- a/bin/lint-staged +++ b/bin/lint-staged @@ -1,6 +1,7 @@ #!/usr/bin/env bash -BINDIR=$(dirname $(node -pe "require.resolve('lint-staged/package.json')")) +SRCDIR=$(dirname $(dirname $(node -pe "require('fs').realpathSync('${0//\\//}')"))) +BINDIR=$(dirname $(cd "$SRCDIR"; node -pe "require.resolve('lint-staged/package.json')")) if [[ -z "$BINDIR" ]]; then echo "Required package 'lint-staged' not found" diff --git a/bin/prettier b/bin/prettier index d8ac0f7..366fb64 100755 --- a/bin/prettier +++ b/bin/prettier @@ -1,6 +1,7 @@ #!/usr/bin/env bash -BINDIR=$(dirname $(node -pe "require.resolve('prettier')")) +SRCDIR=$(dirname $(dirname $(node -pe "require('fs').realpathSync('${0//\\//}')"))) +BINDIR=$(dirname $(cd "$SRCDIR"; node -pe "require.resolve('prettier')")) if [[ -z "$BINDIR" ]]; then echo "Required package 'prettier' not found" diff --git a/bin/stylelint b/bin/stylelint index 261f579..50b4b15 100755 --- a/bin/stylelint +++ b/bin/stylelint @@ -1,6 +1,7 @@ #!/usr/bin/env bash -BINDIR=$(dirname $(node -pe "require.resolve('stylelint/package.json')")) +SRCDIR=$(dirname $(dirname $(node -pe "require('fs').realpathSync('${0//\\//}')"))) +BINDIR=$(dirname $(cd "$SRCDIR"; node -pe "require.resolve('stylelint/package.json')")) if [[ -z "$BINDIR" ]]; then echo "Required package 'stylelint' not found" diff --git a/bin/svgo b/bin/svgo index faa5eec..279b1d4 100755 --- a/bin/svgo +++ b/bin/svgo @@ -1,6 +1,7 @@ #!/usr/bin/env bash -BINDIR=$(dirname $(node -pe "require.resolve('svgo/package.json')")) +SRCDIR=$(dirname $(dirname $(node -pe "require('fs').realpathSync('${0//\\//}')"))) +BINDIR=$(dirname $(cd "$SRCDIR"; node -pe "require.resolve('svgo/package.json')")) if [[ -z "$BINDIR" ]]; then echo "Required package 'svgo' not found"