pr-checkmate 1.9.5 → 1.9.7

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
@@ -9,6 +9,8 @@
9
9
  * ✅ Enforces a unified code style across repositories.
10
10
  * ✅ Checks `package.json` / `package-lock.json` for dependency changes.
11
11
  * ✅ Spellcheck for code, documentation, and JSON files.
12
+ * ✅ Package Vulnerabilities Check
13
+ * ✅ Scans for secrets using
12
14
 
13
15
  <br>
14
16
  > ⚠️ **Note:** Currently, PR CheckMate only supports **Node.js projects**.
@@ -39,8 +41,9 @@ npx pr-checkmate <job>
39
41
  | `lint` | Lint code using ESLint |
40
42
  | `prettier` | Format code using Prettier |
41
43
  | `deps` | Check project dependencies |
42
- | `spellcheck` | Run spellcheck via cspell |
43
44
  | `security` | Run security scan for secrets |
45
+ | `spellcheck` | Run spellcheck via cspell |
46
+ | `audit` | Run `npm audit --audit-level=moderate` to check for vulnerable packages |
44
47
 
45
48
  <br>
46
49
 
@@ -77,6 +77,7 @@ exports.DEFAULT_COMMANDS = {
77
77
  'npx pr-checkmate lint': 'Lint code using ESLint',
78
78
  'npx pr-checkmate prettier': 'Format code using Prettier',
79
79
  'npx pr-checkmate deps': 'Check project dependencies',
80
+ 'npx pr-checkmate npm-audit': 'Run package vulnerabilities check',
80
81
  'npx pr-checkmate security': 'Security scan',
81
82
  'npx pr-checkmate spellcheck': 'Run spellcheck via cspell',
82
83
  };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.runSecurityScan = exports.runSpellcheck = exports.runPrettier = exports.runDependencyCheck = exports.runLint = exports.hasLocalConfig = exports.getPackageConfigPath = exports.getSourcePath = void 0;
3
+ exports.runNpmAudit = exports.runSecurityScan = exports.runSpellcheck = exports.runPrettier = exports.runDependencyCheck = exports.runLint = exports.hasLocalConfig = exports.getPackageConfigPath = exports.getSourcePath = void 0;
4
4
  exports.runAllChecks = runAllChecks;
5
5
  exports.runChecks = runChecks;
6
6
  /**
@@ -12,6 +12,8 @@ const lint_1 = require("./scripts/lint");
12
12
  const dependency_check_1 = require("./scripts/dependency-check");
13
13
  const prettier_autoformat_1 = require("./scripts/prettier-autoformat");
14
14
  const spellcheck_1 = require("./scripts/spellcheck");
15
+ const security_1 = require("./scripts/security");
16
+ const npm_audit_1 = require("./scripts/npm-audit");
15
17
  var config_1 = require("./config");
16
18
  Object.defineProperty(exports, "getSourcePath", { enumerable: true, get: function () { return config_1.getSourcePath; } });
17
19
  Object.defineProperty(exports, "getPackageConfigPath", { enumerable: true, get: function () { return config_1.getPackageConfigPath; } });
@@ -24,8 +26,10 @@ var prettier_autoformat_2 = require("./scripts/prettier-autoformat");
24
26
  Object.defineProperty(exports, "runPrettier", { enumerable: true, get: function () { return prettier_autoformat_2.runPrettier; } });
25
27
  var spellcheck_2 = require("./scripts/spellcheck");
26
28
  Object.defineProperty(exports, "runSpellcheck", { enumerable: true, get: function () { return spellcheck_2.runSpellcheck; } });
27
- var security_1 = require("./scripts/security");
28
- Object.defineProperty(exports, "runSecurityScan", { enumerable: true, get: function () { return security_1.runSecurityScan; } });
29
+ var security_2 = require("./scripts/security");
30
+ Object.defineProperty(exports, "runSecurityScan", { enumerable: true, get: function () { return security_2.runSecurityScan; } });
31
+ var npm_audit_2 = require("./scripts/npm-audit");
32
+ Object.defineProperty(exports, "runNpmAudit", { enumerable: true, get: function () { return npm_audit_2.runNpmAudit; } });
29
33
  /**
30
34
  * Run all checks sequentially
31
35
  * @returns Promise that resolves when all checks complete
@@ -33,7 +37,9 @@ Object.defineProperty(exports, "runSecurityScan", { enumerable: true, get: funct
33
37
  async function runAllChecks() {
34
38
  await (0, lint_1.runLint)();
35
39
  await (0, dependency_check_1.runDependencyCheck)();
40
+ await (0, npm_audit_1.runNpmAudit)();
36
41
  await (0, spellcheck_1.runSpellcheck)();
42
+ await (0, security_1.runSecurityScan)();
37
43
  await (0, prettier_autoformat_1.runPrettier)(); // Last to commit any fixes
38
44
  }
39
45
  /**
@@ -19,6 +19,7 @@ const dependency_check_1 = require("./dependency-check");
19
19
  const prettier_autoformat_1 = require("./prettier-autoformat");
20
20
  const spellcheck_1 = require("./spellcheck");
21
21
  const security_1 = require("./security");
22
+ const npm_audit_1 = require("./npm-audit");
22
23
  const utils_1 = require("../utils");
23
24
  const lint_1 = require("./lint");
24
25
  __exportStar(require("./dependency-check"), exports);
@@ -33,6 +34,7 @@ async function runJob(jobName) {
33
34
  case 'all':
34
35
  await (0, lint_1.runLint)();
35
36
  await (0, dependency_check_1.runDependencyCheck)();
37
+ await (0, security_1.runSecurityScan)();
36
38
  try {
37
39
  await (0, prettier_autoformat_1.runPrettier)();
38
40
  }
@@ -52,6 +54,9 @@ async function runJob(jobName) {
52
54
  case 'deps':
53
55
  await (0, dependency_check_1.runDependencyCheck)();
54
56
  break;
57
+ case 'npm-audit':
58
+ await (0, npm_audit_1.runNpmAudit)();
59
+ break;
55
60
  case 'prettier':
56
61
  await (0, prettier_autoformat_1.runPrettier)();
57
62
  break;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.runNpmAudit = runNpmAudit;
7
+ const utils_1 = require("../utils");
8
+ const node_path_1 = __importDefault(require("node:path"));
9
+ const node_fs_1 = __importDefault(require("node:fs"));
10
+ const node_child_process_1 = require("node:child_process");
11
+ const node_util_1 = require("node:util");
12
+ const execAsync = (0, node_util_1.promisify)(node_child_process_1.exec);
13
+ /**
14
+ * Run npm audit on the current project
15
+ */
16
+ async function runNpmAudit() {
17
+ utils_1.logger.info('🛡️ Running npm audit...');
18
+ const projectRoot = process.cwd();
19
+ const packageJsonPath = node_path_1.default.join(projectRoot, 'package.json');
20
+ if (!node_fs_1.default.existsSync(packageJsonPath)) {
21
+ utils_1.logger.warn('[runNpmAudit]: ⚠️ No package.json found in project root — skipping npm audit');
22
+ return;
23
+ }
24
+ try {
25
+ const { stdout, stderr } = await execAsync('npm audit --audit-level=moderate', {
26
+ cwd: projectRoot,
27
+ });
28
+ if (stdout) {
29
+ utils_1.logger.info(stdout);
30
+ }
31
+ if (stderr) {
32
+ utils_1.logger.warn(stderr);
33
+ }
34
+ utils_1.logger.info('[runNpmAudit]: ✅ NPM audit finished successfully');
35
+ }
36
+ catch (error) {
37
+ const err = error;
38
+ utils_1.logger.error('[runNpmAudit]: ❌ NPM audit found issues');
39
+ if (err.stdout)
40
+ utils_1.logger.error(err.stdout);
41
+ if (err.stderr)
42
+ utils_1.logger.warn(err.stderr);
43
+ if (!err.stdout && !err.stderr)
44
+ utils_1.logger.error(err.message);
45
+ }
46
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pr-checkmate",
3
- "version": "1.9.5",
3
+ "version": "1.9.7",
4
4
  "description": "Automated PR quality checks: linting, formatting, dependency analysis, and spellcheck",
5
5
  "keywords": [
6
6
  "github-actions",