json-parser-yaml-converter
Version:
Enhanced JSON Parser with verbose error messages and JSON to YAML conversion
25 lines (20 loc) • 721 B
JavaScript
/**
* This module contains the executable checkJson that checks if a JSON file is valid.
*
* @module checkJson
*/
;
import { program } from 'commander';
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
const { version } = require('../package.json');
import { jsonLogger } from '../src/loggers.js';
program
.name('checkjson')
.description('Checks if a JSON file is valid and if not it returns the error')
.version(version, '-v, --version', 'Output the version number')
.helpOption('-h, --help', 'Display help')
.argument('<jsonFile>', 'JSON file to check')
.action(jsonLogger);
program.parse(process.argv);