pr-checkmate 1.20.7 â 1.21.0
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/init.js +1 -1
- package/dist/scripts/circular-deps.js +5 -2
- package/dist/scripts/copy-configs.js +1 -1
- package/dist/scripts/dependency-check.js +1 -1
- package/dist/scripts/license-check.js +1 -1
- package/dist/scripts/lint.js +3 -3
- package/dist/scripts/npm-audit.js +1 -1
- package/dist/scripts/outdated-deps.js +2 -2
- package/dist/scripts/pr-size-check.js +3 -3
- package/dist/scripts/pr-title-lint.js +3 -3
- package/dist/scripts/prettier-autoformat.js +4 -4
- package/dist/scripts/security.js +3 -3
- package/dist/scripts/spellcheck.js +3 -3
- package/package.json +1 -1
package/dist/init.js
CHANGED
|
@@ -72,7 +72,7 @@ async function init() {
|
|
|
72
72
|
}
|
|
73
73
|
fs_1.default.copyFileSync(workflowSource, workflowDest);
|
|
74
74
|
utils_1.logger.info('[init]: â
Created .github/workflows/pr-checkmate.yml');
|
|
75
|
-
utils_1.logger.info('[init]:
|
|
75
|
+
utils_1.logger.info('[init]: GitHub Actions workflow is ready for your PRs!');
|
|
76
76
|
}
|
|
77
77
|
else {
|
|
78
78
|
utils_1.logger.warn('[init]: â ī¸ Workflow template not found, skipping workflow setup');
|
|
@@ -9,7 +9,7 @@ const utils_1 = require("../utils");
|
|
|
9
9
|
const config_1 = require("../config");
|
|
10
10
|
const node_path_1 = __importDefault(require("node:path"));
|
|
11
11
|
async function runCircularDeps() {
|
|
12
|
-
utils_1.logger.info('[runCircularDeps]:
|
|
12
|
+
utils_1.logger.info('[runCircularDeps]: Checking for circular dependencies...');
|
|
13
13
|
const sourcePath = (0, config_1.getSourcePath)();
|
|
14
14
|
const pattern = node_path_1.default.join(process.cwd(), sourcePath, '**/*.{ts,tsx,js,jsx}');
|
|
15
15
|
try {
|
|
@@ -17,7 +17,10 @@ async function runCircularDeps() {
|
|
|
17
17
|
reject: false,
|
|
18
18
|
});
|
|
19
19
|
const output = (result.stdout + result.stderr).trim();
|
|
20
|
-
|
|
20
|
+
// dpdm success message also contains "circular" â match only its error patterns:
|
|
21
|
+
// "Circular Dependencies:" header or numbered entry "[1] src/a.ts -> src/b.ts"
|
|
22
|
+
const hasCircular = /circular dependencies:/i.test(output) || /^\s*\[\d+\]/m.test(output);
|
|
23
|
+
if (hasCircular) {
|
|
21
24
|
utils_1.logger.error('[runCircularDeps]: â Circular dependencies detected:');
|
|
22
25
|
utils_1.logger.error(output);
|
|
23
26
|
throw new Error('Circular dependencies found');
|
|
@@ -18,7 +18,7 @@ const configFiles = [
|
|
|
18
18
|
];
|
|
19
19
|
function copyConfigs() {
|
|
20
20
|
const root = node_path_1.default.resolve(__dirname, '../..');
|
|
21
|
-
utils_1.logger.log('[copyConfigs]:
|
|
21
|
+
utils_1.logger.log('[copyConfigs]: Copying config files to package root...\n');
|
|
22
22
|
configFiles.forEach(({ source, dest }) => {
|
|
23
23
|
const srcPath = node_path_1.default.join(root, source);
|
|
24
24
|
const destPath = node_path_1.default.join(root, dest);
|
|
@@ -9,7 +9,7 @@ const utils_1 = require("../utils");
|
|
|
9
9
|
const node_path_1 = __importDefault(require("node:path"));
|
|
10
10
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
11
11
|
async function runDependencyCheck() {
|
|
12
|
-
utils_1.logger.info('[runDependencyCheck]:
|
|
12
|
+
utils_1.logger.info('[runDependencyCheck]: Checking dependencies...');
|
|
13
13
|
const projectRoot = process.cwd();
|
|
14
14
|
if (!node_fs_1.default.existsSync(node_path_1.default.join(projectRoot, 'package.json'))) {
|
|
15
15
|
utils_1.logger.warn('[runDependencyCheck]: â ī¸ No package.json found, skipping');
|
|
@@ -10,7 +10,7 @@ const node_path_1 = __importDefault(require("node:path"));
|
|
|
10
10
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
11
11
|
const FORBIDDEN_LICENSES = ['GPL-2.0', 'GPL-3.0', 'AGPL-3.0', 'LGPL-2.0', 'LGPL-2.1', 'LGPL-3.0'];
|
|
12
12
|
async function runLicenseCheck() {
|
|
13
|
-
utils_1.logger.info('[runLicenseCheck]:
|
|
13
|
+
utils_1.logger.info('[runLicenseCheck]: Checking dependency licenses...');
|
|
14
14
|
if (!node_fs_1.default.existsSync(node_path_1.default.join(process.cwd(), 'package.json'))) {
|
|
15
15
|
utils_1.logger.warn('[runLicenseCheck]: â ī¸ No package.json found, skipping');
|
|
16
16
|
return;
|
package/dist/scripts/lint.js
CHANGED
|
@@ -38,16 +38,16 @@ async function runLint() {
|
|
|
38
38
|
]);
|
|
39
39
|
let args;
|
|
40
40
|
if (hasLocal) {
|
|
41
|
-
utils_1.logger.info(`[runLint]:
|
|
41
|
+
utils_1.logger.info(`[runLint]: Using local ESLint config (checking: ${sourcePath})`);
|
|
42
42
|
args = ['eslint', ...targets, '--ext', '.ts,.tsx,.js,.jsx', '--fix'];
|
|
43
43
|
}
|
|
44
44
|
else {
|
|
45
|
-
utils_1.logger.info(`[runLint]:
|
|
45
|
+
utils_1.logger.info(`[runLint]: Using pr-checkmate ESLint config (checking: ${sourcePath})`);
|
|
46
46
|
// Detect ESLint version and choose appropriate config
|
|
47
47
|
const eslintVersion = await getESLintMajorVersion();
|
|
48
48
|
const configFile = eslintVersion >= 9 ? 'eslint.config.mjs' : '.eslintrc.js';
|
|
49
49
|
const configPath = (0, config_1.getPackageConfigPath)(configFile);
|
|
50
|
-
utils_1.logger.info(`[runLint]:
|
|
50
|
+
utils_1.logger.info(`[runLint]: Detected ESLint v${eslintVersion}, using ${configFile}`);
|
|
51
51
|
args = ['eslint', ...targets, '--ext', '.ts,.tsx,.js,.jsx', '--fix', '--config', configPath];
|
|
52
52
|
}
|
|
53
53
|
config_1.IGNORE_PATTERNS.forEach(p => args.push('--ignore-pattern', p));
|
|
@@ -12,7 +12,7 @@ const execa_1 = require("execa");
|
|
|
12
12
|
* Run npm audit on the current project
|
|
13
13
|
*/
|
|
14
14
|
async function runNpmAudit() {
|
|
15
|
-
utils_1.logger.info('
|
|
15
|
+
utils_1.logger.info('Running npm audit...');
|
|
16
16
|
const projectRoot = process.cwd();
|
|
17
17
|
const packageJsonPath = node_path_1.default.join(projectRoot, 'package.json');
|
|
18
18
|
if (!node_fs_1.default.existsSync(packageJsonPath)) {
|
|
@@ -9,7 +9,7 @@ const utils_1 = require("../utils");
|
|
|
9
9
|
const node_path_1 = __importDefault(require("node:path"));
|
|
10
10
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
11
11
|
async function runOutdatedDeps() {
|
|
12
|
-
utils_1.logger.info('[runOutdatedDeps]:
|
|
12
|
+
utils_1.logger.info('[runOutdatedDeps]: Checking for outdated dependencies...');
|
|
13
13
|
if (!node_fs_1.default.existsSync(node_path_1.default.join(process.cwd(), 'package.json'))) {
|
|
14
14
|
utils_1.logger.warn('[runOutdatedDeps]: â ī¸ No package.json found, skipping');
|
|
15
15
|
return;
|
|
@@ -46,7 +46,7 @@ async function runOutdatedDeps() {
|
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
if (minorBehind > 0) {
|
|
49
|
-
utils_1.logger.info(`[runOutdatedDeps]:
|
|
49
|
+
utils_1.logger.info(`[runOutdatedDeps]: ${minorBehind} package(s) have minor/patch updates available`);
|
|
50
50
|
}
|
|
51
51
|
// informational only â never throws
|
|
52
52
|
}
|
|
@@ -24,10 +24,10 @@ function readBaseSha() {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
async function runPrSizeCheck() {
|
|
27
|
-
utils_1.logger.info('[runPrSizeCheck]:
|
|
27
|
+
utils_1.logger.info('[runPrSizeCheck]: Checking PR size...');
|
|
28
28
|
const baseSha = readBaseSha();
|
|
29
29
|
if (!baseSha) {
|
|
30
|
-
utils_1.logger.info('[runPrSizeCheck]:
|
|
30
|
+
utils_1.logger.info('[runPrSizeCheck]: Not in GitHub PR context, skipping');
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
try {
|
|
@@ -38,7 +38,7 @@ async function runPrSizeCheck() {
|
|
|
38
38
|
const deletions = stdout.match(/(\d+) deletion/);
|
|
39
39
|
const fileCount = filesMatch ? parseInt(filesMatch[1]) : 0;
|
|
40
40
|
const lines = (insertions ? parseInt(insertions[1]) : 0) + (deletions ? parseInt(deletions[1]) : 0);
|
|
41
|
-
utils_1.logger.info(`[runPrSizeCheck]:
|
|
41
|
+
utils_1.logger.info(`[runPrSizeCheck]: ${fileCount} files changed, ${lines} lines`);
|
|
42
42
|
if (fileCount > WARN_FILES) {
|
|
43
43
|
utils_1.logger.warn(`[runPrSizeCheck]: â ī¸ Large PR: ${fileCount} files changed (recommended < ${WARN_FILES})`);
|
|
44
44
|
}
|
|
@@ -8,10 +8,10 @@ const utils_1 = require("../utils");
|
|
|
8
8
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
9
|
const CONVENTIONAL_PREFIX = /^(feat|fix|docs|style|refactor|test|chore|perf|ci|build|revert)(\(.+\))?!?: .+/;
|
|
10
10
|
async function runPrTitleLint() {
|
|
11
|
-
utils_1.logger.info('[runPrTitleLint]:
|
|
11
|
+
utils_1.logger.info('[runPrTitleLint]: Checking PR title...');
|
|
12
12
|
const eventPath = process.env.GITHUB_EVENT_PATH;
|
|
13
13
|
if (!eventPath || !node_fs_1.default.existsSync(eventPath)) {
|
|
14
|
-
utils_1.logger.info('[runPrTitleLint]:
|
|
14
|
+
utils_1.logger.info('[runPrTitleLint]: Not in GitHub CI, skipping');
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
17
|
let event;
|
|
@@ -24,7 +24,7 @@ async function runPrTitleLint() {
|
|
|
24
24
|
}
|
|
25
25
|
const pr = event.pull_request;
|
|
26
26
|
if (!pr?.title) {
|
|
27
|
-
utils_1.logger.info('[runPrTitleLint]:
|
|
27
|
+
utils_1.logger.info('[runPrTitleLint]: No PR title found, skipping');
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
30
|
const title = pr.title;
|
|
@@ -42,7 +42,7 @@ function createTempPrettierConfig() {
|
|
|
42
42
|
// Log customizations
|
|
43
43
|
const customRulesCount = Object.keys(userConfig).length;
|
|
44
44
|
if (customRulesCount > 0) {
|
|
45
|
-
utils_1.logger.info(`[createTempPrettierConfig]:
|
|
45
|
+
utils_1.logger.info(`[createTempPrettierConfig]: Applied ${customRulesCount}
|
|
46
46
|
custom Prettier rules from pr-checkmate.json`);
|
|
47
47
|
utils_1.logger.debug(`[createTempPrettierConfig]: Custom rules: ${JSON.stringify(userConfig)}`);
|
|
48
48
|
}
|
|
@@ -60,7 +60,7 @@ function createTempIgnoreFile() {
|
|
|
60
60
|
return file;
|
|
61
61
|
}
|
|
62
62
|
async function runPrettier() {
|
|
63
|
-
utils_1.logger.info('[runPrettier]:
|
|
63
|
+
utils_1.logger.info('[runPrettier]: Running Prettier...');
|
|
64
64
|
const root = process.cwd();
|
|
65
65
|
const sourcePath = (0, config_1.getSourcePath)();
|
|
66
66
|
const changedFiles = await (0, delta_1.getChangedFiles)(['.ts', '.tsx', '.js', '.jsx', '.json', '.md']);
|
|
@@ -88,11 +88,11 @@ async function runPrettier() {
|
|
|
88
88
|
let args;
|
|
89
89
|
let tempConfig = null;
|
|
90
90
|
if (hasLocal) {
|
|
91
|
-
utils_1.logger.info(`[runPrettier]:
|
|
91
|
+
utils_1.logger.info(`[runPrettier]: Using local Prettier config (checking: ${sourcePath})`);
|
|
92
92
|
args = ['prettier', '--write', ...targets, '--ignore-path', ignorePath];
|
|
93
93
|
}
|
|
94
94
|
else {
|
|
95
|
-
utils_1.logger.info(`[runPrettier]:
|
|
95
|
+
utils_1.logger.info(`[runPrettier]: Using pr-checkmate Prettier config (checking: ${sourcePath})`);
|
|
96
96
|
// Create temporary config with merged settings
|
|
97
97
|
tempConfig = createTempPrettierConfig();
|
|
98
98
|
args = ['prettier', '--write', ...targets, '--config', tempConfig, '--ignore-path', ignorePath];
|
package/dist/scripts/security.js
CHANGED
|
@@ -32,7 +32,7 @@ async function getBaseSha() {
|
|
|
32
32
|
const event = JSON.parse(node_fs_1.default.readFileSync(eventPath, 'utf-8'));
|
|
33
33
|
const baseSha = event?.pull_request?.base?.sha;
|
|
34
34
|
if (baseSha) {
|
|
35
|
-
utils_1.logger.info(`[getBaseSha]:
|
|
35
|
+
utils_1.logger.info(`[getBaseSha]: Using PR base SHA: ${baseSha}`);
|
|
36
36
|
return baseSha;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -55,10 +55,10 @@ async function getBaseSha() {
|
|
|
55
55
|
function getGitleaksCommand() {
|
|
56
56
|
const localPath = node_path_1.default.join(process.cwd(), 'node_modules', '.bin', 'gitleaks-secret-scanner');
|
|
57
57
|
if (node_fs_1.default.existsSync(localPath)) {
|
|
58
|
-
utils_1.logger.info('[getGitleaksCommand]:
|
|
58
|
+
utils_1.logger.info('[getGitleaksCommand]: Using local gitleaks-secret-scanner');
|
|
59
59
|
return localPath;
|
|
60
60
|
}
|
|
61
|
-
utils_1.logger.info('[getGitleaksCommand]:
|
|
61
|
+
utils_1.logger.info('[getGitleaksCommand]: Using npx gitleaks-secret-scanner');
|
|
62
62
|
return 'npx';
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
@@ -45,7 +45,7 @@ function createTempCspellConfig() {
|
|
|
45
45
|
const customWordsCount = (userConfig.words || []).length;
|
|
46
46
|
const customIgnoresCount = (userConfig.ignorePaths || []).length;
|
|
47
47
|
if (customWordsCount > 0) {
|
|
48
|
-
utils_1.logger.info(`[createTempCspellConfig]:
|
|
48
|
+
utils_1.logger.info(`[createTempCspellConfig]: Added ${customWordsCount} custom words from pr-checkmate.json`);
|
|
49
49
|
}
|
|
50
50
|
if (customIgnoresCount > 0) {
|
|
51
51
|
utils_1.logger.info(`[createTempCspellConfig]: đĢ Added ${customIgnoresCount}
|
|
@@ -65,7 +65,7 @@ function buildSpellcheckPatterns(projectRoot, sourcePath) {
|
|
|
65
65
|
return [base, ...excludes];
|
|
66
66
|
}
|
|
67
67
|
async function runSpellcheck() {
|
|
68
|
-
utils_1.logger.info('[runSpellcheck]:
|
|
68
|
+
utils_1.logger.info('[runSpellcheck]: Running Spellcheck...');
|
|
69
69
|
const projectRoot = process.cwd();
|
|
70
70
|
const sourcePath = (0, config_1.getSourcePath)();
|
|
71
71
|
const changedFiles = await (0, delta_1.getChangedFiles)([
|
|
@@ -86,7 +86,7 @@ async function runSpellcheck() {
|
|
|
86
86
|
args = ['cspell', ...patterns, '--no-progress'];
|
|
87
87
|
}
|
|
88
88
|
else {
|
|
89
|
-
utils_1.logger.info(`[runSpellcheck]:
|
|
89
|
+
utils_1.logger.info(`[runSpellcheck]: Using pr-checkmate cspell config (checking: ${sourcePath})`);
|
|
90
90
|
// Create temporary config with merged settings
|
|
91
91
|
tempConfigPath = createTempCspellConfig();
|
|
92
92
|
args = ['cspell', ...patterns, '--config', tempConfigPath, '--no-progress'];
|