pr-checkmate 1.0.18 → 1.0.20

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
@@ -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/dist/index.js CHANGED
@@ -1,54 +1,25 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.logger = exports.runSpellcheck = exports.runPrettier = exports.runDependencyCheck = exports.runLint = void 0;
4
+ exports.runAllChecks = runAllChecks;
5
+ exports.runChecks = runChecks;
2
6
  /**
3
7
  * PR CheckMate - Automated PR quality checks
4
8
  *
5
9
  * @module pr-checkmate
6
10
  */
7
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
- if (k2 === undefined) k2 = k;
9
- var desc = Object.getOwnPropertyDescriptor(m, k);
10
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
- desc = { enumerable: true, get: function() { return m[k]; } };
12
- }
13
- Object.defineProperty(o, k2, desc);
14
- }) : (function(o, m, k, k2) {
15
- if (k2 === undefined) k2 = k;
16
- o[k2] = m[k];
17
- }));
18
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
19
- Object.defineProperty(o, "default", { enumerable: true, value: v });
20
- }) : function(o, v) {
21
- o["default"] = v;
22
- });
23
- var __importStar = (this && this.__importStar) || (function () {
24
- var ownKeys = function(o) {
25
- ownKeys = Object.getOwnPropertyNames || function (o) {
26
- var ar = [];
27
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
28
- return ar;
29
- };
30
- return ownKeys(o);
31
- };
32
- return function (mod) {
33
- if (mod && mod.__esModule) return mod;
34
- var result = {};
35
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
36
- __setModuleDefault(result, mod);
37
- return result;
38
- };
39
- })();
40
- Object.defineProperty(exports, "__esModule", { value: true });
41
- exports.logger = exports.runSpellcheck = exports.runPrettier = exports.runDependencyCheck = exports.runLint = void 0;
42
- exports.runAllChecks = runAllChecks;
43
- exports.runChecks = runChecks;
44
- var lint_1 = require("./scripts/lint");
45
- Object.defineProperty(exports, "runLint", { enumerable: true, get: function () { return lint_1.runLint; } });
46
- var dependency_check_1 = require("./scripts/dependency-check");
47
- Object.defineProperty(exports, "runDependencyCheck", { enumerable: true, get: function () { return dependency_check_1.runDependencyCheck; } });
48
- var prettier_autoformat_1 = require("./scripts/prettier-autoformat");
49
- Object.defineProperty(exports, "runPrettier", { enumerable: true, get: function () { return prettier_autoformat_1.runPrettier; } });
50
- var spellcheck_1 = require("./scripts/spellcheck");
51
- Object.defineProperty(exports, "runSpellcheck", { enumerable: true, get: function () { return spellcheck_1.runSpellcheck; } });
11
+ const lint_1 = require("./scripts/lint");
12
+ const dependency_check_1 = require("./scripts/dependency-check");
13
+ const prettier_autoformat_1 = require("./scripts/prettier-autoformat");
14
+ const spellcheck_1 = require("./scripts/spellcheck");
15
+ var lint_2 = require("./scripts/lint");
16
+ Object.defineProperty(exports, "runLint", { enumerable: true, get: function () { return lint_2.runLint; } });
17
+ var dependency_check_2 = require("./scripts/dependency-check");
18
+ Object.defineProperty(exports, "runDependencyCheck", { enumerable: true, get: function () { return dependency_check_2.runDependencyCheck; } });
19
+ var prettier_autoformat_2 = require("./scripts/prettier-autoformat");
20
+ Object.defineProperty(exports, "runPrettier", { enumerable: true, get: function () { return prettier_autoformat_2.runPrettier; } });
21
+ var spellcheck_2 = require("./scripts/spellcheck");
22
+ Object.defineProperty(exports, "runSpellcheck", { enumerable: true, get: function () { return spellcheck_2.runSpellcheck; } });
52
23
  var utils_1 = require("./utils");
53
24
  Object.defineProperty(exports, "logger", { enumerable: true, get: function () { return utils_1.logger; } });
54
25
  /**
@@ -56,29 +27,21 @@ Object.defineProperty(exports, "logger", { enumerable: true, get: function () {
56
27
  * @returns Promise that resolves when all checks complete
57
28
  */
58
29
  async function runAllChecks() {
59
- const { runLint } = await Promise.resolve().then(() => __importStar(require('./scripts/lint')));
60
- const { runDependencyCheck } = await Promise.resolve().then(() => __importStar(require('./scripts/dependency-check')));
61
- const { runPrettier } = await Promise.resolve().then(() => __importStar(require('./scripts/prettier-autoformat')));
62
- const { runSpellcheck } = await Promise.resolve().then(() => __importStar(require('./scripts/spellcheck')));
63
- await runLint();
64
- await runDependencyCheck();
65
- await runSpellcheck();
66
- await runPrettier(); // Last to commit any fixes
30
+ await (0, lint_1.runLint)();
31
+ await (0, dependency_check_1.runDependencyCheck)();
32
+ await (0, spellcheck_1.runSpellcheck)();
33
+ await (0, prettier_autoformat_1.runPrettier)(); // Last to commit any fixes
67
34
  }
68
35
  /**
69
36
  * Run checks based on configuration
70
37
  */
71
38
  async function runChecks(config = {}) {
72
- const { runLint } = await Promise.resolve().then(() => __importStar(require('./scripts/lint')));
73
- const { runDependencyCheck } = await Promise.resolve().then(() => __importStar(require('./scripts/dependency-check')));
74
- const { runPrettier } = await Promise.resolve().then(() => __importStar(require('./scripts/prettier-autoformat')));
75
- const { runSpellcheck } = await Promise.resolve().then(() => __importStar(require('./scripts/spellcheck')));
76
39
  if (!config.skipLint)
77
- await runLint();
40
+ await (0, lint_1.runLint)();
78
41
  if (!config.skipDeps)
79
- await runDependencyCheck();
42
+ await (0, dependency_check_1.runDependencyCheck)();
80
43
  if (!config.skipSpell)
81
- await runSpellcheck();
44
+ await (0, spellcheck_1.runSpellcheck)();
82
45
  if (!config.skipFormat && config.autoCommit)
83
- await runPrettier();
46
+ await (0, prettier_autoformat_1.runPrettier)();
84
47
  }
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 answers = await inquirer_1.default.prompt([
22
- {
23
- type: 'list',
24
- name: 'sourcePath',
25
- message: 'Where is your project source code?',
26
- choices: ['src', 'app', 'Enter manually'],
27
- },
28
- {
29
- type: 'input',
30
- name: 'manualPath',
31
- message: 'Enter path:',
32
- when: (a) => a.sourcePath === 'Enter manually',
33
- validate: (input) => input.trim().length > 0 || 'Cannot be empty',
34
- },
35
- ]);
36
- const config = {
37
- sourcePath: answers.sourcePath === 'Enter manually' ? answers.manualPath : answers.sourcePath,
38
- };
39
- fs_1.default.writeFileSync(exports.CONFIG_FILE, JSON.stringify(config, null, 2));
40
- utils_1.logger.info('✅ Created pr-checkmate.json');
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
  }
@@ -2,6 +2,7 @@
2
2
  // import fs from 'node:fs';
3
3
  // import path from 'node:path';
4
4
  // import { logger } from '../utils';
5
+ Object.defineProperty(exports, "__esModule", { value: true });
5
6
  // interface ConfigFile {
6
7
  // source: string;
7
8
  // dest: string;
@@ -11,6 +11,7 @@ const configFiles = [
11
11
  { source: 'src/config/eslint.config.mjs', dest: 'eslint.config.mjs' },
12
12
  { source: 'src/config/.prettierrc', dest: '.prettierrc' },
13
13
  { source: 'src/config/cspell.json', dest: 'cspell.json' },
14
+ { source: 'tsconfig.json', dest: 'tsconfig.json' },
14
15
  ];
15
16
  function copyConfigs() {
16
17
  const root = node_path_1.default.resolve(__dirname, '../..'); // root of package
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pr-checkmate",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
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": {
@@ -59,15 +60,14 @@
59
60
  "inquirer": "^13.0.1",
60
61
  "prettier": ">=3.0.0",
61
62
  "ts-node": "^10.9.1",
62
- "typescript": "^5.9.3"
63
- },
64
- "devDependencies": {
65
- "@types/inquirer": "^9.0.9",
63
+ "typescript": "^5.9.3",
66
64
  "@typescript-eslint/eslint-plugin": "^8.47.0",
67
65
  "@typescript-eslint/parser": "^8.47.0",
68
66
  "eslint-config-prettier": "^9.1.2",
69
67
  "eslint-plugin-import": "^2.29.0",
70
- "eslint-plugin-prettier": "^5.5.4",
68
+ "eslint-plugin-prettier": "^5.5.4"
69
+ },
70
+ "devDependencies": {
71
71
  "standard-version": "^9.5.0"
72
72
  },
73
73
  "peerDependencies": {
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
+ }