pr-checkmate 1.0.2 → 1.0.3

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/cli.js ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ import { runJob } from './scripts/index.js';
3
+ import { init } from './init.js';
4
+ const cmd = process.argv[2];
5
+ (async () => {
6
+ try {
7
+ if (cmd === 'init') {
8
+ await init();
9
+ process.exit(0);
10
+ }
11
+ await runJob(cmd || 'all');
12
+ }
13
+ catch (err) {
14
+ console.error('❌ CLI failed:', err);
15
+ process.exit(1);
16
+ }
17
+ })();
package/dist/init.js CHANGED
@@ -1,32 +1,31 @@
1
- #!/usr/bin/env node
2
1
  import fs from 'fs';
2
+ import path from 'path';
3
3
  import inquirer from 'inquirer';
4
4
  import { logger } from './utils';
5
- import { CONFIG_FILE } from './config';
6
- async function init() {
5
+ export const CONFIG_FILE = path.resolve(process.cwd(), 'pr-checkmate.json');
6
+ export async function init() {
7
7
  if (fs.existsSync(CONFIG_FILE)) {
8
- logger.log('⚡ CheckMate config already exists.');
8
+ logger.info('⚡ pr-checkmate.json already exists.');
9
9
  return;
10
10
  }
11
11
  const answers = await inquirer.prompt([
12
12
  {
13
13
  type: 'list',
14
14
  name: 'sourcePath',
15
- message: 'Where is your project source code located?',
15
+ message: 'Where is your project source code?',
16
16
  choices: ['src', 'app', 'Enter manually'],
17
17
  },
18
18
  {
19
19
  type: 'input',
20
20
  name: 'manualPath',
21
- message: 'Enter the relative path to your source folder:',
22
- when: answers => answers.sourcePath === 'Enter manually',
23
- validate: input => input.length > 0 || 'Path cannot be empty',
21
+ message: 'Enter path:',
22
+ when: a => a.sourcePath === 'Enter manually',
23
+ validate: input => input.trim().length > 0 || 'Cannot be empty',
24
24
  },
25
25
  ]);
26
26
  const config = {
27
27
  sourcePath: answers.sourcePath === 'Enter manually' ? answers.manualPath : answers.sourcePath,
28
28
  };
29
29
  fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2));
30
- logger.info(`✅ CheckMate config created at ${CONFIG_FILE}`);
30
+ logger.info('✅ Created checkmatec.json');
31
31
  }
32
- init();
@@ -17,7 +17,7 @@ import { logger } from '../utils';
17
17
  * spellcheck - Run cspell spellcheck
18
18
  */
19
19
  const job = process.argv[2];
20
- async function runJob(jobName) {
20
+ export async function runJob(jobName) {
21
21
  switch (jobName) {
22
22
  case 'all':
23
23
  await runLint();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pr-checkmate",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Automated PR quality checks: linting, formatting, dependency analysis, and spellcheck",
5
5
  "keywords": [
6
6
  "github-actions",
@@ -11,10 +11,10 @@
11
11
  "code-quality",
12
12
  "automation"
13
13
  ],
14
- "main": "dist/index.js",
14
+ "main": "./dist/cli.js",
15
15
  "types": "dist/index.d.ts",
16
16
  "bin": {
17
- "pr-checkmate": "./dist/scripts/index.js"
17
+ "pr-checkmate": "./dist/cli.js"
18
18
  },
19
19
  "files": [
20
20
  "dist",