@huaiyou/hooks-git
Advanced tools
+6
-0
| # @huaiyou/hooks-git | ||
| ## 2.2.1 | ||
| ### Patch Changes | ||
| - Fix build issue with function naming conflicts | ||
| ## 2.2.0 | ||
@@ -4,0 +10,0 @@ |
+13
-4
@@ -17,3 +17,3 @@ #!/usr/bin/env node | ||
| const version = "2.2.0"; | ||
| const version = "2.2.1"; | ||
@@ -79,2 +79,11 @@ const logger = { | ||
| function checkComplexTsConfig() { | ||
| try { | ||
| const tsconfigPath = node_path.resolve(process.cwd(), "tsconfig.json"); | ||
| const tsconfig = fs__default.readJsonSync(tsconfigPath); | ||
| return tsconfig.files === "" || Array.isArray(tsconfig.files) && tsconfig.files.length === 0 && tsconfig.references; | ||
| } catch { | ||
| return false; | ||
| } | ||
| } | ||
| const init = async () => { | ||
@@ -110,3 +119,3 @@ logger.box("Initializing @huaiyou/hooks-git"); | ||
| await runCommand(pm === "yarn" ? "npx" : pm, ["husky", "install"]); | ||
| } catch (e) { | ||
| } catch { | ||
| logger.error("Failed to initialize husky."); | ||
@@ -127,6 +136,6 @@ } | ||
| const isTsProject = fs__default.existsSync(node_path.resolve(process.cwd(), "tsconfig.json")); | ||
| const isComplexTsConfig2 = isTsProject && isComplexTsConfig2(); | ||
| const hasComplexTsConfig = isTsProject && checkComplexTsConfig(); | ||
| let commitlintFile; | ||
| let lintStagedFile; | ||
| if (isComplexTsConfig2) { | ||
| if (hasComplexTsConfig) { | ||
| commitlintFile = "commitlint.config.cjs"; | ||
@@ -133,0 +142,0 @@ lintStagedFile = "lint-staged.config.cjs"; |
+13
-4
@@ -9,3 +9,3 @@ #!/usr/bin/env node | ||
| const version = "2.2.0"; | ||
| const version = "2.2.1"; | ||
@@ -71,2 +71,11 @@ const logger = { | ||
| function checkComplexTsConfig() { | ||
| try { | ||
| const tsconfigPath = resolve(process.cwd(), "tsconfig.json"); | ||
| const tsconfig = fs.readJsonSync(tsconfigPath); | ||
| return tsconfig.files === "" || Array.isArray(tsconfig.files) && tsconfig.files.length === 0 && tsconfig.references; | ||
| } catch { | ||
| return false; | ||
| } | ||
| } | ||
| const init = async () => { | ||
@@ -102,3 +111,3 @@ logger.box("Initializing @huaiyou/hooks-git"); | ||
| await runCommand(pm === "yarn" ? "npx" : pm, ["husky", "install"]); | ||
| } catch (e) { | ||
| } catch { | ||
| logger.error("Failed to initialize husky."); | ||
@@ -119,6 +128,6 @@ } | ||
| const isTsProject = fs.existsSync(resolve(process.cwd(), "tsconfig.json")); | ||
| const isComplexTsConfig2 = isTsProject && isComplexTsConfig2(); | ||
| const hasComplexTsConfig = isTsProject && checkComplexTsConfig(); | ||
| let commitlintFile; | ||
| let lintStagedFile; | ||
| if (isComplexTsConfig2) { | ||
| if (hasComplexTsConfig) { | ||
| commitlintFile = "commitlint.config.cjs"; | ||
@@ -125,0 +134,0 @@ lintStagedFile = "lint-staged.config.cjs"; |
+25
-23
@@ -43,13 +43,14 @@ #!/usr/bin/env node | ||
| } catch (error) { | ||
| if (error.stdout) { | ||
| const translated = translateError$1(error.stdout); | ||
| console.error(translated); | ||
| const err = error; | ||
| if (err.stdout) { | ||
| const translated = translateError$1(err.stdout); | ||
| process.stderr.write(translated + "\n"); | ||
| } | ||
| if (error.stderr) { | ||
| const translated = translateError$1(error.stderr); | ||
| console.error(translated); | ||
| if (err.stderr) { | ||
| const translated = translateError$1(err.stderr); | ||
| process.stderr.write(translated + "\n"); | ||
| } | ||
| if (error.message) { | ||
| const translated = translateError$1(error.message); | ||
| console.error(translated); | ||
| if (err.message) { | ||
| const translated = translateError$1(err.message); | ||
| process.stderr.write(translated + "\n"); | ||
| } | ||
@@ -61,3 +62,3 @@ process.exit(1); | ||
| const errorMessages = { | ||
| // ���置相关 | ||
| // 配置相关 | ||
| "Failed to read config from file": "\u65E0\u6CD5\u8BFB\u53D6\u914D\u7F6E\u6587\u4EF6", | ||
@@ -77,6 +78,6 @@ "could not find any valid configuration": "\u627E\u4E0D\u5230\u6709\u6548\u7684\u914D\u7F6E", | ||
| "Command failed": "\u547D\u4EE4\u6267\u884C\u5931\u8D25", | ||
| "Task": "\u4EFB\u52A1", | ||
| "failed": "\u5931\u8D25", | ||
| "passed": "\u901A\u8FC7", | ||
| "skipped": "\u8DF3\u8FC7" | ||
| Task: "\u4EFB\u52A1", | ||
| failed: "\u5931\u8D25", | ||
| passed: "\u901A\u8FC7", | ||
| skipped: "\u8DF3\u8FC7" | ||
| }; | ||
@@ -91,3 +92,3 @@ function translateError(message) { | ||
| function translateLine(line) { | ||
| if (!line.trim() || /^[\s\─│┌┐└┘]+$/g.test(line)) { | ||
| if (!line.trim() || /^[\s─│┌┐└┘]+$/g.test(line)) { | ||
| return line; | ||
@@ -105,3 +106,3 @@ } | ||
| lines.forEach((line) => { | ||
| console.log(translateLine(line)); | ||
| process.stdout.write(translateLine(line) + "\n"); | ||
| }); | ||
@@ -112,16 +113,17 @@ } | ||
| lines.forEach((line) => { | ||
| console.error(translateLine(line)); | ||
| process.stderr.write(translateLine(line) + "\n"); | ||
| }); | ||
| } | ||
| } catch (error) { | ||
| if (error.stdout) { | ||
| const lines = error.stdout.split("\n"); | ||
| const err = error; | ||
| if (err.stdout) { | ||
| const lines = err.stdout.split("\n"); | ||
| lines.forEach((line) => { | ||
| console.log(translateLine(line)); | ||
| process.stdout.write(translateLine(line) + "\n"); | ||
| }); | ||
| } | ||
| if (error.stderr) { | ||
| const lines = error.stderr.split("\n"); | ||
| if (err.stderr) { | ||
| const lines = err.stderr.split("\n"); | ||
| lines.forEach((line) => { | ||
| console.error(translateLine(line)); | ||
| process.stderr.write(translateLine(line) + "\n"); | ||
| }); | ||
@@ -128,0 +130,0 @@ } |
+25
-23
@@ -37,13 +37,14 @@ #!/usr/bin/env node | ||
| } catch (error) { | ||
| if (error.stdout) { | ||
| const translated = translateError$1(error.stdout); | ||
| console.error(translated); | ||
| const err = error; | ||
| if (err.stdout) { | ||
| const translated = translateError$1(err.stdout); | ||
| process.stderr.write(translated + "\n"); | ||
| } | ||
| if (error.stderr) { | ||
| const translated = translateError$1(error.stderr); | ||
| console.error(translated); | ||
| if (err.stderr) { | ||
| const translated = translateError$1(err.stderr); | ||
| process.stderr.write(translated + "\n"); | ||
| } | ||
| if (error.message) { | ||
| const translated = translateError$1(error.message); | ||
| console.error(translated); | ||
| if (err.message) { | ||
| const translated = translateError$1(err.message); | ||
| process.stderr.write(translated + "\n"); | ||
| } | ||
@@ -55,3 +56,3 @@ process.exit(1); | ||
| const errorMessages = { | ||
| // ���置相关 | ||
| // 配置相关 | ||
| "Failed to read config from file": "\u65E0\u6CD5\u8BFB\u53D6\u914D\u7F6E\u6587\u4EF6", | ||
@@ -71,6 +72,6 @@ "could not find any valid configuration": "\u627E\u4E0D\u5230\u6709\u6548\u7684\u914D\u7F6E", | ||
| "Command failed": "\u547D\u4EE4\u6267\u884C\u5931\u8D25", | ||
| "Task": "\u4EFB\u52A1", | ||
| "failed": "\u5931\u8D25", | ||
| "passed": "\u901A\u8FC7", | ||
| "skipped": "\u8DF3\u8FC7" | ||
| Task: "\u4EFB\u52A1", | ||
| failed: "\u5931\u8D25", | ||
| passed: "\u901A\u8FC7", | ||
| skipped: "\u8DF3\u8FC7" | ||
| }; | ||
@@ -85,3 +86,3 @@ function translateError(message) { | ||
| function translateLine(line) { | ||
| if (!line.trim() || /^[\s\─│┌┐└┘]+$/g.test(line)) { | ||
| if (!line.trim() || /^[\s─│┌┐└┘]+$/g.test(line)) { | ||
| return line; | ||
@@ -99,3 +100,3 @@ } | ||
| lines.forEach((line) => { | ||
| console.log(translateLine(line)); | ||
| process.stdout.write(translateLine(line) + "\n"); | ||
| }); | ||
@@ -106,16 +107,17 @@ } | ||
| lines.forEach((line) => { | ||
| console.error(translateLine(line)); | ||
| process.stderr.write(translateLine(line) + "\n"); | ||
| }); | ||
| } | ||
| } catch (error) { | ||
| if (error.stdout) { | ||
| const lines = error.stdout.split("\n"); | ||
| const err = error; | ||
| if (err.stdout) { | ||
| const lines = err.stdout.split("\n"); | ||
| lines.forEach((line) => { | ||
| console.log(translateLine(line)); | ||
| process.stdout.write(translateLine(line) + "\n"); | ||
| }); | ||
| } | ||
| if (error.stderr) { | ||
| const lines = error.stderr.split("\n"); | ||
| if (err.stderr) { | ||
| const lines = err.stderr.split("\n"); | ||
| lines.forEach((line) => { | ||
| console.error(translateLine(line)); | ||
| process.stderr.write(translateLine(line) + "\n"); | ||
| }); | ||
@@ -122,0 +124,0 @@ } |
+1
-1
| { | ||
| "name": "@huaiyou/hooks-git", | ||
| "version": "2.2.0", | ||
| "version": "2.2.1", | ||
| "description": "Git hooks configuration with Husky, Commitlint and Lint-staged", | ||
@@ -5,0 +5,0 @@ "bin": { |
52745
1.84%1255
1.78%