git-coco 0.22.9 → 0.22.10
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/dist/index.esm.mjs +52 -8
- package/dist/index.js +52 -8
- package/package.json +1 -1
package/dist/index.esm.mjs
CHANGED
|
@@ -47,7 +47,7 @@ import { pathToFileURL } from 'url';
|
|
|
47
47
|
/**
|
|
48
48
|
* Current build version from package.json
|
|
49
49
|
*/
|
|
50
|
-
const BUILD_VERSION = "0.22.
|
|
50
|
+
const BUILD_VERSION = "0.22.10";
|
|
51
51
|
|
|
52
52
|
const isInteractive = (config) => {
|
|
53
53
|
return config?.mode === 'interactive' || !!config?.interactive;
|
|
@@ -7840,7 +7840,7 @@ var changelog = {
|
|
|
7840
7840
|
options: options$4,
|
|
7841
7841
|
};
|
|
7842
7842
|
|
|
7843
|
-
const conventionalTypeRegex = /^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\(.+\))
|
|
7843
|
+
const conventionalTypeRegex = /^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\(.+\))?!?:/;
|
|
7844
7844
|
// Regular commit message schema with basic validation
|
|
7845
7845
|
const CommitMessageResponseSchema = objectType({
|
|
7846
7846
|
title: stringType().describe("Title of the commit message"),
|
|
@@ -13025,6 +13025,18 @@ function checkCommitlintAvailability() {
|
|
|
13025
13025
|
try {
|
|
13026
13026
|
// Try to resolve the package from the current working directory
|
|
13027
13027
|
require.resolve(pkg, { paths: [process.cwd(), ...module.paths] });
|
|
13028
|
+
// Additional check: try to actually load the config to catch ES module issues
|
|
13029
|
+
try {
|
|
13030
|
+
require(pkg);
|
|
13031
|
+
}
|
|
13032
|
+
catch (loadError) {
|
|
13033
|
+
const loadErrorMessage = loadError instanceof Error ? loadError.message : String(loadError);
|
|
13034
|
+
// If we can resolve but can't load due to ES module issues, treat as missing
|
|
13035
|
+
if (loadErrorMessage.includes('Directory import') ||
|
|
13036
|
+
loadErrorMessage.includes('is not supported resolving ES modules')) {
|
|
13037
|
+
missingPackages.push(pkg);
|
|
13038
|
+
}
|
|
13039
|
+
}
|
|
13028
13040
|
}
|
|
13029
13041
|
catch (error) {
|
|
13030
13042
|
missingPackages.push(pkg);
|
|
@@ -13039,6 +13051,15 @@ function checkCommitlintAvailability() {
|
|
|
13039
13051
|
missingPackages,
|
|
13040
13052
|
};
|
|
13041
13053
|
}
|
|
13054
|
+
/**
|
|
13055
|
+
* Check if we're in a pnpm environment with ES module issues
|
|
13056
|
+
*/
|
|
13057
|
+
function isPnpmEsModuleIssue(error) {
|
|
13058
|
+
const message = error.message;
|
|
13059
|
+
return (message.includes('Directory import') &&
|
|
13060
|
+
message.includes('is not supported resolving ES modules') &&
|
|
13061
|
+
message.includes('@commitlint/config-conventional'));
|
|
13062
|
+
}
|
|
13042
13063
|
/**
|
|
13043
13064
|
* Load commitlint configuration
|
|
13044
13065
|
*/
|
|
@@ -13085,8 +13106,14 @@ async function loadCommitlintConfig() {
|
|
|
13085
13106
|
});
|
|
13086
13107
|
}
|
|
13087
13108
|
catch (error) {
|
|
13088
|
-
|
|
13089
|
-
|
|
13109
|
+
if (!(error instanceof Error)) {
|
|
13110
|
+
throw error;
|
|
13111
|
+
}
|
|
13112
|
+
// Handle various types of config-conventional loading errors
|
|
13113
|
+
const isConfigConventionalError = error.message.includes('Cannot find module "@commitlint/config-conventional"') ||
|
|
13114
|
+
isPnpmEsModuleIssue(error);
|
|
13115
|
+
if (isConfigConventionalError) {
|
|
13116
|
+
// Return a basic conventional config that matches @commitlint/config-conventional rules
|
|
13090
13117
|
return await load({
|
|
13091
13118
|
rules: {
|
|
13092
13119
|
'header-max-length': [2, 'always', 72],
|
|
@@ -13215,9 +13242,26 @@ async function validateCommitMessage(message, options = {}) {
|
|
|
13215
13242
|
};
|
|
13216
13243
|
}
|
|
13217
13244
|
catch (error) {
|
|
13218
|
-
|
|
13219
|
-
|
|
13220
|
-
|
|
13245
|
+
if (!(error instanceof Error)) {
|
|
13246
|
+
return {
|
|
13247
|
+
valid: false,
|
|
13248
|
+
errors: [String(error)],
|
|
13249
|
+
warnings: [],
|
|
13250
|
+
};
|
|
13251
|
+
}
|
|
13252
|
+
// Check if this is a config-conventional related error (including pnpm ES module issues)
|
|
13253
|
+
const isConfigConventionalError = error.message.includes('Cannot find module "@commitlint/config-conventional"') ||
|
|
13254
|
+
isPnpmEsModuleIssue(error);
|
|
13255
|
+
if (isConfigConventionalError) {
|
|
13256
|
+
// For pnpm ES module issues, we should have already fallen back to built-in rules
|
|
13257
|
+
// during config loading, so this shouldn't happen. But if it does, provide helpful info.
|
|
13258
|
+
if (isPnpmEsModuleIssue(error)) {
|
|
13259
|
+
return {
|
|
13260
|
+
valid: false,
|
|
13261
|
+
errors: ['pnpm ES module compatibility issue with @commitlint/config-conventional'],
|
|
13262
|
+
warnings: ['Try: pnpm add -D @commitlint/config-conventional@latest @commitlint/cli@latest'],
|
|
13263
|
+
};
|
|
13264
|
+
}
|
|
13221
13265
|
return {
|
|
13222
13266
|
valid: false,
|
|
13223
13267
|
errors: ['Commitlint configuration requires @commitlint/config-conventional to be installed'],
|
|
@@ -13227,7 +13271,7 @@ async function validateCommitMessage(message, options = {}) {
|
|
|
13227
13271
|
}
|
|
13228
13272
|
return {
|
|
13229
13273
|
valid: false,
|
|
13230
|
-
errors: [
|
|
13274
|
+
errors: [error.message],
|
|
13231
13275
|
warnings: [],
|
|
13232
13276
|
};
|
|
13233
13277
|
}
|
package/dist/index.js
CHANGED
|
@@ -69,7 +69,7 @@ var readline__namespace = /*#__PURE__*/_interopNamespaceDefault(readline);
|
|
|
69
69
|
/**
|
|
70
70
|
* Current build version from package.json
|
|
71
71
|
*/
|
|
72
|
-
const BUILD_VERSION = "0.22.
|
|
72
|
+
const BUILD_VERSION = "0.22.10";
|
|
73
73
|
|
|
74
74
|
const isInteractive = (config) => {
|
|
75
75
|
return config?.mode === 'interactive' || !!config?.interactive;
|
|
@@ -7862,7 +7862,7 @@ var changelog = {
|
|
|
7862
7862
|
options: options$4,
|
|
7863
7863
|
};
|
|
7864
7864
|
|
|
7865
|
-
const conventionalTypeRegex = /^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\(.+\))
|
|
7865
|
+
const conventionalTypeRegex = /^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\(.+\))?!?:/;
|
|
7866
7866
|
// Regular commit message schema with basic validation
|
|
7867
7867
|
const CommitMessageResponseSchema = objectType({
|
|
7868
7868
|
title: stringType().describe("Title of the commit message"),
|
|
@@ -13047,6 +13047,18 @@ function checkCommitlintAvailability() {
|
|
|
13047
13047
|
try {
|
|
13048
13048
|
// Try to resolve the package from the current working directory
|
|
13049
13049
|
require.resolve(pkg, { paths: [process.cwd(), ...module.paths] });
|
|
13050
|
+
// Additional check: try to actually load the config to catch ES module issues
|
|
13051
|
+
try {
|
|
13052
|
+
require(pkg);
|
|
13053
|
+
}
|
|
13054
|
+
catch (loadError) {
|
|
13055
|
+
const loadErrorMessage = loadError instanceof Error ? loadError.message : String(loadError);
|
|
13056
|
+
// If we can resolve but can't load due to ES module issues, treat as missing
|
|
13057
|
+
if (loadErrorMessage.includes('Directory import') ||
|
|
13058
|
+
loadErrorMessage.includes('is not supported resolving ES modules')) {
|
|
13059
|
+
missingPackages.push(pkg);
|
|
13060
|
+
}
|
|
13061
|
+
}
|
|
13050
13062
|
}
|
|
13051
13063
|
catch (error) {
|
|
13052
13064
|
missingPackages.push(pkg);
|
|
@@ -13061,6 +13073,15 @@ function checkCommitlintAvailability() {
|
|
|
13061
13073
|
missingPackages,
|
|
13062
13074
|
};
|
|
13063
13075
|
}
|
|
13076
|
+
/**
|
|
13077
|
+
* Check if we're in a pnpm environment with ES module issues
|
|
13078
|
+
*/
|
|
13079
|
+
function isPnpmEsModuleIssue(error) {
|
|
13080
|
+
const message = error.message;
|
|
13081
|
+
return (message.includes('Directory import') &&
|
|
13082
|
+
message.includes('is not supported resolving ES modules') &&
|
|
13083
|
+
message.includes('@commitlint/config-conventional'));
|
|
13084
|
+
}
|
|
13064
13085
|
/**
|
|
13065
13086
|
* Load commitlint configuration
|
|
13066
13087
|
*/
|
|
@@ -13107,8 +13128,14 @@ async function loadCommitlintConfig() {
|
|
|
13107
13128
|
});
|
|
13108
13129
|
}
|
|
13109
13130
|
catch (error) {
|
|
13110
|
-
|
|
13111
|
-
|
|
13131
|
+
if (!(error instanceof Error)) {
|
|
13132
|
+
throw error;
|
|
13133
|
+
}
|
|
13134
|
+
// Handle various types of config-conventional loading errors
|
|
13135
|
+
const isConfigConventionalError = error.message.includes('Cannot find module "@commitlint/config-conventional"') ||
|
|
13136
|
+
isPnpmEsModuleIssue(error);
|
|
13137
|
+
if (isConfigConventionalError) {
|
|
13138
|
+
// Return a basic conventional config that matches @commitlint/config-conventional rules
|
|
13112
13139
|
return await load({
|
|
13113
13140
|
rules: {
|
|
13114
13141
|
'header-max-length': [2, 'always', 72],
|
|
@@ -13237,9 +13264,26 @@ async function validateCommitMessage(message, options = {}) {
|
|
|
13237
13264
|
};
|
|
13238
13265
|
}
|
|
13239
13266
|
catch (error) {
|
|
13240
|
-
|
|
13241
|
-
|
|
13242
|
-
|
|
13267
|
+
if (!(error instanceof Error)) {
|
|
13268
|
+
return {
|
|
13269
|
+
valid: false,
|
|
13270
|
+
errors: [String(error)],
|
|
13271
|
+
warnings: [],
|
|
13272
|
+
};
|
|
13273
|
+
}
|
|
13274
|
+
// Check if this is a config-conventional related error (including pnpm ES module issues)
|
|
13275
|
+
const isConfigConventionalError = error.message.includes('Cannot find module "@commitlint/config-conventional"') ||
|
|
13276
|
+
isPnpmEsModuleIssue(error);
|
|
13277
|
+
if (isConfigConventionalError) {
|
|
13278
|
+
// For pnpm ES module issues, we should have already fallen back to built-in rules
|
|
13279
|
+
// during config loading, so this shouldn't happen. But if it does, provide helpful info.
|
|
13280
|
+
if (isPnpmEsModuleIssue(error)) {
|
|
13281
|
+
return {
|
|
13282
|
+
valid: false,
|
|
13283
|
+
errors: ['pnpm ES module compatibility issue with @commitlint/config-conventional'],
|
|
13284
|
+
warnings: ['Try: pnpm add -D @commitlint/config-conventional@latest @commitlint/cli@latest'],
|
|
13285
|
+
};
|
|
13286
|
+
}
|
|
13243
13287
|
return {
|
|
13244
13288
|
valid: false,
|
|
13245
13289
|
errors: ['Commitlint configuration requires @commitlint/config-conventional to be installed'],
|
|
@@ -13249,7 +13293,7 @@ async function validateCommitMessage(message, options = {}) {
|
|
|
13249
13293
|
}
|
|
13250
13294
|
return {
|
|
13251
13295
|
valid: false,
|
|
13252
|
-
errors: [
|
|
13296
|
+
errors: [error.message],
|
|
13253
13297
|
warnings: [],
|
|
13254
13298
|
};
|
|
13255
13299
|
}
|