@huaiyou/hooks-git 2.1.1 → 2.1.2

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,11 @@
1
1
  # @huaiyou/hooks-git
2
2
 
3
+ ## 2.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix init command - move package.json reading before dependency check
8
+
3
9
  ## 2.1.1
4
10
 
5
11
  ### 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.1.1";
17
+ const version = "2.1.2";
18
18
 
19
19
  const logger = {
20
20
  /**
@@ -84,6 +84,8 @@ const init = async () => {
84
84
  }
85
85
  logger.info("Installing dependencies...");
86
86
  const pm = await getPackageManager();
87
+ const pkgPath = node_path.resolve(process.cwd(), "package.json");
88
+ const pkg = await fs__default.readJson(pkgPath);
87
89
  const devDepsNeeded = [];
88
90
  if (!pkg.devDependencies?.husky && !pkg.dependencies?.husky) {
89
91
  devDepsNeeded.push("husky");
@@ -117,8 +119,6 @@ const init = async () => {
117
119
  `;
118
120
  await fs__default.outputFile(preCommitPath, preCommitContent, { mode: 493 });
119
121
  logger.info("Creating configuration files...");
120
- const pkgPath = node_path.resolve(process.cwd(), "package.json");
121
- const pkg = await fs__default.readJson(pkgPath);
122
122
  const isModule = pkg.type === "module";
123
123
  const isTsProject = fs__default.existsSync(node_path.resolve(process.cwd(), "tsconfig.json"));
124
124
  const commitlintFile = isTsProject ? "commitlint.config.ts" : isModule ? "commitlint.config.cjs" : "commitlint.config.js";
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.1.1";
9
+ const version = "2.1.2";
10
10
 
11
11
  const logger = {
12
12
  /**
@@ -76,6 +76,8 @@ const init = async () => {
76
76
  }
77
77
  logger.info("Installing dependencies...");
78
78
  const pm = await getPackageManager();
79
+ const pkgPath = resolve(process.cwd(), "package.json");
80
+ const pkg = await fs.readJson(pkgPath);
79
81
  const devDepsNeeded = [];
80
82
  if (!pkg.devDependencies?.husky && !pkg.dependencies?.husky) {
81
83
  devDepsNeeded.push("husky");
@@ -109,8 +111,6 @@ const init = async () => {
109
111
  `;
110
112
  await fs.outputFile(preCommitPath, preCommitContent, { mode: 493 });
111
113
  logger.info("Creating configuration files...");
112
- const pkgPath = resolve(process.cwd(), "package.json");
113
- const pkg = await fs.readJson(pkgPath);
114
114
  const isModule = pkg.type === "module";
115
115
  const isTsProject = fs.existsSync(resolve(process.cwd(), "tsconfig.json"));
116
116
  const commitlintFile = isTsProject ? "commitlint.config.ts" : isModule ? "commitlint.config.cjs" : "commitlint.config.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huaiyou/hooks-git",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "Git hooks configuration with Husky, Commitlint and Lint-staged",
5
5
  "bin": {
6
6
  "hy-hooks-git": "./dist/cli.mjs"