@huaiyou/hooks-git 2.2.1 → 2.2.3

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @huaiyou/hooks-git
2
2
 
3
+ ## 2.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix lint-staged empty config error when no linting tools installed
8
+
9
+ ## 2.2.2
10
+
11
+ ### Patch Changes
12
+
13
+ - Fix hook scripts to use correct bin commands
14
+
3
15
  ## 2.2.1
4
16
 
5
17
  ### Patch Changes
package/dist/cli.cjs CHANGED
@@ -14,7 +14,7 @@ const cac__default = /*#__PURE__*/_interopDefaultCompat(cac);
14
14
  const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
15
15
  const picocolors__default = /*#__PURE__*/_interopDefaultCompat(picocolors);
16
16
 
17
- const version = "2.2.1";
17
+ const version = "2.2.3";
18
18
 
19
19
  const logger = {
20
20
  /**
@@ -120,11 +120,11 @@ const init = async () => {
120
120
  logger.info("Adding hooks...");
121
121
  const huskyDir = node_path.resolve(process.cwd(), ".husky");
122
122
  const commitMsgPath = node_path.resolve(huskyDir, "commit-msg");
123
- const commitMsgContent = `npx --no -- @huaiyou/hooks-git/wrappers commitlint --edit \${1}
123
+ const commitMsgContent = `npx --no -- hy-hooks-commitlint commitlint --edit \${1}
124
124
  `;
125
125
  await fs__default.outputFile(commitMsgPath, commitMsgContent, { mode: 493 });
126
126
  const preCommitPath = node_path.resolve(huskyDir, "pre-commit");
127
- const preCommitContent = `npx --no -- @huaiyou/hooks-git/wrappers lint-staged
127
+ const preCommitContent = `npx --no -- hy-hooks-lint-staged lint-staged
128
128
  `;
129
129
  await fs__default.outputFile(preCommitPath, preCommitContent, { mode: 493 });
130
130
  logger.info("Creating configuration files...");
package/dist/cli.mjs CHANGED
@@ -6,7 +6,7 @@ import { consola } from 'consola';
6
6
  import { execa } from 'execa';
7
7
  import picocolors from 'picocolors';
8
8
 
9
- const version = "2.2.1";
9
+ const version = "2.2.3";
10
10
 
11
11
  const logger = {
12
12
  /**
@@ -112,11 +112,11 @@ const init = async () => {
112
112
  logger.info("Adding hooks...");
113
113
  const huskyDir = resolve(process.cwd(), ".husky");
114
114
  const commitMsgPath = resolve(huskyDir, "commit-msg");
115
- const commitMsgContent = `npx --no -- @huaiyou/hooks-git/wrappers commitlint --edit \${1}
115
+ const commitMsgContent = `npx --no -- hy-hooks-commitlint commitlint --edit \${1}
116
116
  `;
117
117
  await fs.outputFile(commitMsgPath, commitMsgContent, { mode: 493 });
118
118
  const preCommitPath = resolve(huskyDir, "pre-commit");
119
- const preCommitContent = `npx --no -- @huaiyou/hooks-git/wrappers lint-staged
119
+ const preCommitContent = `npx --no -- hy-hooks-lint-staged lint-staged
120
120
  `;
121
121
  await fs.outputFile(preCommitPath, preCommitContent, { mode: 493 });
122
122
  logger.info("Creating configuration files...");
@@ -38,7 +38,12 @@ const createLintStagedConfig = () => {
38
38
  config["*.{css,scss,less}"] = styleScripts;
39
39
  }
40
40
  if (hasPrettier) {
41
- config["*.{html,json,md,yml,yaml}"] = ["prettier --write"];
41
+ config["*.{json,md,yml,yaml}"] = ["prettier --write"];
42
+ }
43
+ if (Object.keys(config).length === 0) {
44
+ return {
45
+ "*": ["git add"]
46
+ };
42
47
  }
43
48
  return config;
44
49
  };
@@ -34,7 +34,12 @@ const createLintStagedConfig = () => {
34
34
  config["*.{css,scss,less}"] = styleScripts;
35
35
  }
36
36
  if (hasPrettier) {
37
- config["*.{html,json,md,yml,yaml}"] = ["prettier --write"];
37
+ config["*.{json,md,yml,yaml}"] = ["prettier --write"];
38
+ }
39
+ if (Object.keys(config).length === 0) {
40
+ return {
41
+ "*": ["git add"]
42
+ };
38
43
  }
39
44
  return config;
40
45
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huaiyou/hooks-git",
3
- "version": "2.2.1",
3
+ "version": "2.2.3",
4
4
  "description": "Git hooks configuration with Husky, Commitlint and Lint-staged",
5
5
  "bin": {
6
6
  "hy-hooks-git": "./dist/cli.mjs",