pr-checkmate 1.0.19 → 1.0.21
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/README.md +3 -0
- package/cspell.json +5 -1
- package/dist/config/constants.js +35 -0
- package/dist/init.js +49 -22
- package/dist/scripts/copy-configs.js +2 -0
- package/eslint.config.mjs +6 -11
- package/package.json +2 -1
- package/tsconfig.json +17 -0
- package/dist/scripts/copy-configs copy.js +0 -50
package/README.md
CHANGED
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
* ✅ Checks `package.json` / `package-lock.json` for dependency changes.
|
|
11
11
|
* ✅ Spellcheck for code, documentation, and JSON files.
|
|
12
12
|
|
|
13
|
+
<br>
|
|
14
|
+
> ⚠️ **Note:** Currently, PR CheckMate only supports **Node.js projects**.
|
|
15
|
+
|
|
13
16
|
|
|
14
17
|
## 🛠 How It Works
|
|
15
18
|
### 1. Install
|
package/cspell.json
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
"version": "0.2",
|
|
3
3
|
"language": "en",
|
|
4
4
|
"words": [
|
|
5
|
+
"uiautomator",
|
|
6
|
+
"UiAutomator2",
|
|
5
7
|
"checkmate",
|
|
6
8
|
"eslint",
|
|
7
9
|
"prettier",
|
|
@@ -9,7 +11,9 @@
|
|
|
9
11
|
"typescript",
|
|
10
12
|
"execa",
|
|
11
13
|
"playwright",
|
|
12
|
-
"pytest"
|
|
14
|
+
"pytest",
|
|
15
|
+
"creds",
|
|
16
|
+
"UITM"
|
|
13
17
|
],
|
|
14
18
|
"ignorePaths": [
|
|
15
19
|
"**/node_modules/**",
|
package/dist/config/constants.js
CHANGED
|
@@ -17,6 +17,41 @@ exports.IGNORE_PATTERNS = [
|
|
|
17
17
|
'**/.pytest_cache/**',
|
|
18
18
|
'**/.venv/**',
|
|
19
19
|
'**/venv/**',
|
|
20
|
+
'**/allure-report/**',
|
|
21
|
+
'**/allure-results/**',
|
|
22
|
+
'**/reports/**',
|
|
23
|
+
'**/report/**',
|
|
24
|
+
'**/test-reports/**',
|
|
25
|
+
'**/test-report/**',
|
|
26
|
+
'**/test-output/**',
|
|
27
|
+
'**/test-results/**',
|
|
28
|
+
'**/results/**',
|
|
29
|
+
'**/result/**',
|
|
30
|
+
'**/logs/**',
|
|
31
|
+
// Jest
|
|
32
|
+
'**/jest-html-reporters-*/**',
|
|
33
|
+
'**/jest-stare/**',
|
|
34
|
+
// Cypress
|
|
35
|
+
'**/cypress/reports/**',
|
|
36
|
+
'**/cypress/videos/**',
|
|
37
|
+
'**/cypress/screenshots/**',
|
|
38
|
+
// Playwright
|
|
39
|
+
'**/playwright-report/**',
|
|
40
|
+
// WebdriverIO
|
|
41
|
+
'**/.wdio/**',
|
|
42
|
+
'**/wdio-logs/**',
|
|
43
|
+
// Mocha / Jasmine
|
|
44
|
+
'**/mochawesome-report/**',
|
|
45
|
+
'**/mochawesome-reports/**',
|
|
46
|
+
// JUnit / Surefire / Maven
|
|
47
|
+
'**/target/surefire-reports/**',
|
|
48
|
+
'**/target/failsafe-reports/**',
|
|
49
|
+
// Python testing
|
|
50
|
+
'**/.pytest_cache/**',
|
|
51
|
+
'**/htmlcov/**',
|
|
52
|
+
// Misc reports
|
|
53
|
+
'**/lint-report/**',
|
|
54
|
+
'**/audit-report/**',
|
|
20
55
|
];
|
|
21
56
|
/**
|
|
22
57
|
* File extensions to check
|
package/dist/init.js
CHANGED
|
@@ -14,28 +14,55 @@ exports.CONFIG_FILE = path_1.default.resolve(process.cwd(), 'pr-checkmate.json')
|
|
|
14
14
|
* Initialize pr-checkmate configuration file.
|
|
15
15
|
*/
|
|
16
16
|
async function init() {
|
|
17
|
-
if (fs_1.default.existsSync(exports.CONFIG_FILE)) {
|
|
17
|
+
if (!fs_1.default.existsSync(exports.CONFIG_FILE)) {
|
|
18
|
+
const answers = await inquirer_1.default.prompt([
|
|
19
|
+
{
|
|
20
|
+
type: 'list',
|
|
21
|
+
name: 'sourcePath',
|
|
22
|
+
message: 'Where is your project source code?',
|
|
23
|
+
choices: ['src', 'app', 'Enter manually'],
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
type: 'input',
|
|
27
|
+
name: 'manualPath',
|
|
28
|
+
message: 'Enter path:',
|
|
29
|
+
when: (a) => a.sourcePath === 'Enter manually',
|
|
30
|
+
validate: (input) => input.trim().length > 0 || 'Cannot be empty',
|
|
31
|
+
},
|
|
32
|
+
]);
|
|
33
|
+
const config = {
|
|
34
|
+
sourcePath: answers.sourcePath === 'Enter manually' ? answers.manualPath : answers.sourcePath,
|
|
35
|
+
};
|
|
36
|
+
fs_1.default.writeFileSync(exports.CONFIG_FILE, JSON.stringify(config, null, 2));
|
|
37
|
+
utils_1.logger.info('✅ Created pr-checkmate.json');
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
18
40
|
utils_1.logger.info('⚡ pr-checkmate.json already exists.');
|
|
19
|
-
return;
|
|
20
41
|
}
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
const root = process.cwd();
|
|
43
|
+
const tsconfigPath = path_1.default.join(root, 'tsconfig.json');
|
|
44
|
+
if (!fs_1.default.existsSync(tsconfigPath)) {
|
|
45
|
+
const defaultTsConfig = {
|
|
46
|
+
compilerOptions: {
|
|
47
|
+
target: 'ES2020',
|
|
48
|
+
module: 'NodeNext',
|
|
49
|
+
outDir: 'dist',
|
|
50
|
+
strict: true,
|
|
51
|
+
rootDir: 'src',
|
|
52
|
+
moduleResolution: 'NodeNext',
|
|
53
|
+
esModuleInterop: true,
|
|
54
|
+
resolveJsonModule: true,
|
|
55
|
+
forceConsistentCasingInFileNames: true,
|
|
56
|
+
skipLibCheck: true,
|
|
57
|
+
types: ['node'],
|
|
58
|
+
},
|
|
59
|
+
include: ['src/**/*.ts'],
|
|
60
|
+
exclude: ['node_modules', 'dist'],
|
|
61
|
+
};
|
|
62
|
+
fs_1.default.writeFileSync(tsconfigPath, JSON.stringify(defaultTsConfig, null, 2));
|
|
63
|
+
utils_1.logger.info('✅ Created default tsconfig.json');
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
utils_1.logger.info('⚡ tsconfig.json already exists.');
|
|
67
|
+
}
|
|
41
68
|
}
|
|
@@ -10,7 +10,9 @@ const utils_1 = require("../utils");
|
|
|
10
10
|
const configFiles = [
|
|
11
11
|
{ source: 'src/config/eslint.config.mjs', dest: 'eslint.config.mjs' },
|
|
12
12
|
{ source: 'src/config/.prettierrc', dest: '.prettierrc' },
|
|
13
|
+
{ source: 'src/config/.eslintignore', dest: '.eslintignore' },
|
|
13
14
|
{ source: 'src/config/cspell.json', dest: 'cspell.json' },
|
|
15
|
+
{ source: 'tsconfig.json', dest: 'tsconfig.json' },
|
|
14
16
|
];
|
|
15
17
|
function copyConfigs() {
|
|
16
18
|
const root = node_path_1.default.resolve(__dirname, '../..'); // root of package
|
package/eslint.config.mjs
CHANGED
|
@@ -2,19 +2,14 @@ import tsPlugin from '@typescript-eslint/eslint-plugin';
|
|
|
2
2
|
import tsParser from '@typescript-eslint/parser';
|
|
3
3
|
import prettierPlugin from 'eslint-plugin-prettier';
|
|
4
4
|
|
|
5
|
+
import { IGNORE_PATTERNS, SOURCE_EXTENSIONS } from './src/config/constants.js';
|
|
6
|
+
|
|
5
7
|
export default [
|
|
6
8
|
{
|
|
7
|
-
files:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
'**/.git/**',
|
|
12
|
-
'**/build/**',
|
|
13
|
-
'**/coverage/**',
|
|
14
|
-
'**/.next/**',
|
|
15
|
-
'**/.nuxt/**',
|
|
16
|
-
'**/out/**',
|
|
17
|
-
],
|
|
9
|
+
files: SOURCE_EXTENSIONS.all.map(ext => `**/*${ext}`),
|
|
10
|
+
|
|
11
|
+
ignores: IGNORE_PATTERNS,
|
|
12
|
+
|
|
18
13
|
languageOptions: {
|
|
19
14
|
parser: tsParser,
|
|
20
15
|
parserOptions: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pr-checkmate",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.21",
|
|
4
4
|
"description": "Automated PR quality checks: linting, formatting, dependency analysis, and spellcheck",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"github-actions",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"eslint.config.mjs",
|
|
24
24
|
".prettierrc",
|
|
25
25
|
"cspell.json",
|
|
26
|
+
"tsconfig.json",
|
|
26
27
|
"LICENSE"
|
|
27
28
|
],
|
|
28
29
|
"scripts": {
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"outDir": "dist",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"rootDir": "src",
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"moduleResolution": "NodeNext",
|
|
11
|
+
"resolveJsonModule": true,
|
|
12
|
+
"forceConsistentCasingInFileNames": true,
|
|
13
|
+
"types": ["node"]
|
|
14
|
+
},
|
|
15
|
+
"include": ["src/**/*.ts"],
|
|
16
|
+
"exclude": ["node_modules", "dist"]
|
|
17
|
+
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// import fs from 'node:fs';
|
|
3
|
-
// import path from 'node:path';
|
|
4
|
-
// import { logger } from '../utils';
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
// interface ConfigFile {
|
|
7
|
-
// source: string;
|
|
8
|
-
// dest: string;
|
|
9
|
-
// }
|
|
10
|
-
// const configFiles: ConfigFile[] = [
|
|
11
|
-
// {
|
|
12
|
-
// source: 'src/config/eslint.config.mjs',
|
|
13
|
-
// dest: 'eslint.config.mjs',
|
|
14
|
-
// },
|
|
15
|
-
// {
|
|
16
|
-
// source: 'src/config/.prettierrc',
|
|
17
|
-
// dest: '.prettierrc',
|
|
18
|
-
// },
|
|
19
|
-
// {
|
|
20
|
-
// source: 'src/config/cspell.json',
|
|
21
|
-
// dest: 'cspell.json',
|
|
22
|
-
// },
|
|
23
|
-
// ];
|
|
24
|
-
// /**
|
|
25
|
-
// * Copy configuration files from src/config to dist/
|
|
26
|
-
// */
|
|
27
|
-
// function copyConfigs(): void {
|
|
28
|
-
// const projectRoot = path.resolve(__dirname, '../..');
|
|
29
|
-
// const distDir = path.join(projectRoot, 'dist');
|
|
30
|
-
// if (!fs.existsSync(distDir)) {
|
|
31
|
-
// fs.mkdirSync(distDir, { recursive: true });
|
|
32
|
-
// }
|
|
33
|
-
// logger.log('📦 Copying configuration files...\n');
|
|
34
|
-
// configFiles.forEach(({ source, dest }) => {
|
|
35
|
-
// const srcPath = path.join(projectRoot, source);
|
|
36
|
-
// const destPath = path.join(distDir, dest);
|
|
37
|
-
// if (fs.existsSync(srcPath)) {
|
|
38
|
-
// fs.copyFileSync(srcPath, destPath);
|
|
39
|
-
// logger.log(`✅ Copied ${dest}`);
|
|
40
|
-
// } else {
|
|
41
|
-
// logger.warn(`⚠️ File not found: ${source}`);
|
|
42
|
-
// }
|
|
43
|
-
// });
|
|
44
|
-
// logger.info('\n✨ Config files copied successfully!\n');
|
|
45
|
-
// }
|
|
46
|
-
// // Run if called directly
|
|
47
|
-
// if (require.main === module) {
|
|
48
|
-
// copyConfigs();
|
|
49
|
-
// }
|
|
50
|
-
// export { copyConfigs };
|