@digitoimistodude/code-quality-checks 2.1.3 → 2.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname "$0")/h"
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname "$0")/h"
package/.husky/_/h ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env sh
2
+ [ "$HUSKY" = "2" ] && set -x
3
+ n=$(basename "$0")
4
+ s=$(dirname "$(dirname "$0")")/$n
5
+
6
+ [ ! -f "$s" ] && exit 0
7
+
8
+ if [ -f "$HOME/.huskyrc" ]; then
9
+ echo "husky - '~/.huskyrc' is DEPRECATED, please move your code to ~/.config/husky/init.sh"
10
+ fi
11
+ i="${XDG_CONFIG_HOME:-$HOME/.config}/husky/init.sh"
12
+ [ -f "$i" ] && . "$i"
13
+
14
+ [ "${HUSKY-}" = "0" ] && exit 0
15
+
16
+ export PATH="node_modules/.bin:$PATH"
17
+ sh -e "$s" "$@"
18
+ c=$?
19
+
20
+ [ $c != 0 ] && echo "husky - $n script failed (code $c)"
21
+ [ $c = 127 ] && echo "husky - command not found in PATH=$PATH"
22
+ exit $c
@@ -0,0 +1,9 @@
1
+ echo "husky - DEPRECATED
2
+
3
+ Please remove the following two lines from $0:
4
+
5
+ #!/usr/bin/env sh
6
+ . \"\$(dirname -- \"\$0\")/_/husky.sh\"
7
+
8
+ They WILL FAIL in v10.0.0
9
+ "
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname "$0")/h"
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname "$0")/h"
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname "$0")/h"
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname "$0")/h"
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname "$0")/h"
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname "$0")/h"
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname "$0")/h"
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname "$0")/h"
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname "$0")/h"
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname "$0")/h"
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname "$0")/h"
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname "$0")/h"
package/bin/setup.js ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ const { setup } = require('../index.js');
3
+ setup();
package/index.js CHANGED
@@ -3,18 +3,43 @@
3
3
  *
4
4
  * Exports the path to husky hooks for direct reference.
5
5
  *
6
- * Usage in your project's .husky/pre-commit:
7
- * node_modules/@digitoimistodude/code-quality-checks/.husky/pre-commit
6
+ * Usage in your project's package.json:
7
+ * "prepare": "dude-code-quality-setup"
8
8
  *
9
9
  * Or import the path:
10
10
  * const { huskyPath } = require('@digitoimistodude/code-quality-checks');
11
11
  */
12
12
 
13
13
  const path = require('path');
14
+ const { execSync } = require('child_process');
15
+
16
+ const huskyPath = path.join(__dirname, '.husky');
17
+ const huskyInternalPath = path.join(__dirname, '.husky', '_');
18
+
19
+ /**
20
+ * Setup husky with absolute path to hooks
21
+ * This ensures hooks work from anywhere in the git repository
22
+ */
23
+ function setup() {
24
+ try {
25
+ // Get the git root directory
26
+ const gitRoot = execSync('git rev-parse --show-toplevel', { encoding: 'utf8' }).trim();
27
+
28
+ // Set core.hooksPath to absolute path
29
+ execSync(`git config core.hooksPath "${huskyInternalPath}"`, { cwd: gitRoot });
30
+
31
+ console.log(`✅ Husky hooks configured at: ${huskyInternalPath}`);
32
+ } catch (error) {
33
+ console.error('❌ Failed to setup husky hooks:', error.message);
34
+ process.exit(1);
35
+ }
36
+ }
14
37
 
15
38
  module.exports = {
16
- huskyPath: path.join(__dirname, '.husky'),
39
+ huskyPath,
40
+ huskyInternalPath,
17
41
  preCommitPath: path.join(__dirname, '.husky', 'pre-commit'),
18
42
  preCommitConfigPath: path.join(__dirname, '.husky', 'pre-commit-config'),
19
- commitMsgPath: path.join(__dirname, '.husky', 'commit-msg')
43
+ commitMsgPath: path.join(__dirname, '.husky', 'commit-msg'),
44
+ setup
20
45
  };
package/package.json CHANGED
@@ -1,12 +1,17 @@
1
1
  {
2
2
  "name": "@digitoimistodude/code-quality-checks",
3
- "version": "2.1.3",
3
+ "version": "2.1.5",
4
4
  "description": "Code quality definitions and Husky pre-commit hooks for Dude WordPress projects",
5
5
  "main": "index.js",
6
+ "scripts": {
7
+ "postinstall": "node bin/setup.js"
8
+ },
6
9
  "files": [
7
10
  ".husky/pre-commit",
8
11
  ".husky/pre-commit-config",
9
12
  ".husky/commit-msg",
13
+ ".husky/_",
14
+ "bin",
10
15
  "index.js"
11
16
  ],
12
17
  "repository": {