pr-checkmate 1.0.7 → 1.0.9

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 CHANGED
@@ -1,22 +1,17 @@
1
1
  # 🔍 PR CheckMate
2
-
3
2
  > **PR CheckMate** is an npm package for automating Pull Request checks.
4
3
  > It helps teams maintain code quality by automatically validating linting, formatting, dependencies, and spelling before merging to `main`.
5
4
 
6
- ---
7
5
 
8
6
  ## ⚡ Why PR CheckMate?
9
-
10
7
  * ✅ Automatic checks on every PR without extra setup.
11
8
  * ✅ No need to install ESLint, Prettier, or cspell in your project — all included.
12
9
  * ✅ Enforces a unified code style across repositories.
13
10
  * ✅ Checks `package.json` / `package-lock.json` for dependency changes.
14
11
  * ✅ Spellcheck for code, documentation, and JSON files.
15
12
 
16
- ---
17
13
 
18
14
  ## 🛠 How It Works
19
-
20
15
  ### 1. Install
21
16
 
22
17
  ```bash
@@ -35,7 +30,6 @@ npx pr-checkmate <job>
35
30
  ```
36
31
 
37
32
  #### ⚡ Jobs
38
-
39
33
  | Job | Description |
40
34
  |------------|-------------|
41
35
  | `all` | Run all checks: ESLint, dependency check, Prettier, spellcheck |
@@ -43,9 +37,13 @@ npx pr-checkmate <job>
43
37
  | `prettier` | Format code using Prettier |
44
38
  | `deps` | Check project dependencies |
45
39
  | `spellcheck` | Run spellcheck via cspell |
40
+ <br>
46
41
 
47
42
  ## 📦 Example GitHub Actions Workflow
48
43
 
44
+ ![pipeline](./assets/pipelineex.png)
45
+
46
+
49
47
  ```yaml
50
48
  name: PR CheckMate Quality Checks
51
49
 
@@ -75,7 +73,14 @@ jobs:
75
73
  > Fully automated process: no need to install ESLint, Prettier, or cspell in your repository.
76
74
 
77
75
 
78
- ---
76
+ ## 📌 Benefits
77
+
78
+ * ✅ Self-contained — the package handles all checks internally
79
+ * ✅ Works locally and in CI/CD (GitHub Actions, GitLab CI, etc.)
80
+ * ✅ Enforces a unified code style across repositories
81
+ * ✅ Automatic formatting and commits when needed
82
+ * ✅ Minimal setup — just `init` and `npx pr-checkmate all`
83
+
79
84
 
80
85
  ## 🧰 Tech Stack
81
86
 
@@ -84,17 +89,7 @@ jobs:
84
89
  * **ESLint + @typescript-eslint** — code linting
85
90
  * **Prettier** — auto-formatting
86
91
  * **cspell** — spellchecking
87
- * **execa** — running CLI commands from Node.js
88
-
89
- ---
90
-
91
- ## 📌 Benefits
92
-
93
- * ✅ Self-contained — the package handles all checks internally
94
- * ✅ Works locally and in CI/CD (GitHub Actions, GitLab CI, etc.)
95
- * ✅ Enforces a unified code style across repositories
96
- * ✅ Automatic formatting and commits when needed
97
- * ✅ Minimal setup — just `init` and `npx pr-checkmate all`
92
+ * **execa** — running CLI commands from Node.js
98
93
 
99
94
 
100
95
  ## 📜 License
@@ -5,28 +5,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.runLint = runLint;
7
7
  const execa_1 = require("execa");
8
- const node_fs_1 = __importDefault(require("node:fs"));
9
- const config_1 = require("../config");
8
+ const node_path_1 = __importDefault(require("node:path"));
10
9
  const utils_1 = require("../utils");
10
+ const INTERNAL_ESLINT_CONFIG = node_path_1.default.resolve(__dirname, '../eslint.config.mjs');
11
11
  /**
12
- * Run ESLint on the project.
12
+ * Run ESLint using the internal config.
13
13
  * Ignores node_modules, dist, and .git automatically.
14
- *
15
- * @throws Will throw an error if ESLint detects issues that cannot be fixed automatically.
16
14
  */
17
15
  async function runLint() {
18
16
  utils_1.logger.info('Running ESLint...');
19
- const hasLocalConfig = node_fs_1.default.existsSync('eslint.config.mjs') ||
20
- node_fs_1.default.existsSync('.eslintrc.js') ||
21
- node_fs_1.default.existsSync('.eslintrc.json');
22
- const basePath = hasLocalConfig ? '.' : config_1.SOURCE_PATH;
17
+ const projectPath = node_path_1.default.resolve(process.cwd());
23
18
  const ignorePatterns = ['**/node_modules/**', '**/dist/**', '**/.git/**'];
24
19
  const args = [
25
20
  'eslint',
26
- basePath,
21
+ projectPath,
27
22
  '--ext',
28
23
  '.ts,.tsx',
29
24
  '--fix',
25
+ '--config',
26
+ INTERNAL_ESLINT_CONFIG,
30
27
  ...ignorePatterns.flatMap(p => ['--ignore-pattern', p]),
31
28
  ];
32
29
  try {
@@ -4,29 +4,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.runPrettier = runPrettier;
7
+ // src/scripts/prettier-autoformat.ts
7
8
  const execa_1 = require("execa");
8
- const node_fs_1 = __importDefault(require("node:fs"));
9
- const config_1 = require("../config");
9
+ const node_path_1 = __importDefault(require("node:path"));
10
10
  const utils_1 = require("../utils");
11
+ const INTERNAL_PRETTIER_CONFIG = node_path_1.default.resolve(__dirname, '../.prettierrc');
11
12
  /**
12
- * Run Prettier to auto-format project files.
13
- * Ignores node_modules, dist, and .git folders automatically.
14
- *
15
- * @throws Will throw an error if Prettier fails.
13
+ * Run Prettier using internal config.
14
+ * Ignores node_modules, dist, and .git automatically.
16
15
  */
17
16
  async function runPrettier() {
18
17
  utils_1.logger.info('Running Prettier...');
19
- const hasConfig = node_fs_1.default.existsSync('.prettierrc') ||
20
- node_fs_1.default.existsSync('.prettierrc.json') ||
21
- node_fs_1.default.existsSync('prettier.config.js');
22
- // Run on whole project if config exists, otherwise only SOURCE_PATH
23
- const pattern = hasConfig
24
- ? '**/*.{ts,tsx,js,jsx,json,md}'
25
- : `${config_1.SOURCE_PATH}/**/*.{ts,tsx,js,jsx,json,md}`;
26
- // Prettier ignore patterns
18
+ const projectPath = node_path_1.default.resolve(process.cwd());
27
19
  const ignorePatterns = ['**/node_modules/**', '**/dist/**', '**/.git/**'];
20
+ const args = [
21
+ 'prettier',
22
+ '--write',
23
+ projectPath,
24
+ '--config',
25
+ INTERNAL_PRETTIER_CONFIG,
26
+ ...ignorePatterns.flatMap(p => ['--ignore-path', p]),
27
+ ];
28
28
  try {
29
- await (0, execa_1.execa)('npx', ['prettier', '--write', pattern, ...ignorePatterns.flatMap(p => ['--ignore-path', p])], { stdio: 'inherit' });
29
+ await (0, execa_1.execa)('npx', args, { stdio: 'inherit' });
30
30
  utils_1.logger.info('✅ Prettier completed');
31
31
  }
32
32
  catch (err) {
@@ -1,23 +1,31 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.runSpellcheck = runSpellcheck;
7
+ // src/scripts/spellcheck.ts
4
8
  const execa_1 = require("execa");
5
- const config_1 = require("../config");
9
+ const node_path_1 = __importDefault(require("node:path"));
6
10
  const utils_1 = require("../utils");
11
+ const INTERNAL_CSPELL_CONFIG = node_path_1.default.resolve(__dirname, '../cspell.json');
7
12
  /**
8
- * Run cspell to check spelling in project files.
9
- * Ignores node_modules, dist, and .git folders automatically.
10
- *
11
- * @throws Will throw an error if spelling issues are detected.
13
+ * Run spellcheck using internal cspell config.
14
+ * Ignores node_modules, dist, and .git automatically.
12
15
  */
13
16
  async function runSpellcheck() {
14
17
  utils_1.logger.info('Running spellcheck...');
15
- const pattern = `${config_1.SOURCE_PATH}/**/*`;
18
+ const projectPath = node_path_1.default.resolve(process.cwd());
16
19
  const ignorePatterns = ['**/node_modules/**', '**/dist/**', '**/.git/**'];
20
+ const args = [
21
+ 'cspell',
22
+ projectPath,
23
+ '--config',
24
+ INTERNAL_CSPELL_CONFIG,
25
+ ...ignorePatterns.flatMap(p => ['--exclude', p]),
26
+ ];
17
27
  try {
18
- await (0, execa_1.execa)('npx', ['cspell', pattern, ...ignorePatterns.flatMap(p => ['--ignore', p])], {
19
- stdio: 'inherit',
20
- });
28
+ await (0, execa_1.execa)('npx', args, { stdio: 'inherit' });
21
29
  utils_1.logger.info('✅ Spellcheck passed');
22
30
  }
23
31
  catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pr-checkmate",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Automated PR quality checks: linting, formatting, dependency analysis, and spellcheck",
5
5
  "keywords": [
6
6
  "github-actions",