Comparing version 5.1.2 to 5.2.0
@@ -248,16 +248,9 @@ #!/usr/bin/env node | ||
async function handleConfig(configString) { | ||
console.log(); | ||
async function lint(config) { | ||
let config; | ||
try { | ||
config = JSON.parse(configString); | ||
} catch (e) { | ||
return logAndExit('Error: Could not parse configuration file', e); | ||
} | ||
let errorCount = 0; | ||
let warningCount = 0; | ||
console.log(); | ||
for (let i = 0; i < cli.input.length; i++) { | ||
@@ -295,15 +288,32 @@ let results = await lintDiagram(cli.input[i], config); | ||
const { config } = cli.flags; | ||
async function run() { | ||
const configPath = config || '.bpmnlintrc'; | ||
const configOverridePath = cli.flags.config; | ||
readFile(configPath, 'utf-8').then(handleConfig, (error) => { | ||
const configPath = configOverridePath || '.bpmnlintrc'; | ||
const message = ( | ||
config | ||
? `Error: Could not read ${ config }` | ||
: 'Error: Could not locate configuration' | ||
); | ||
let configString, config; | ||
logAndExit(message, error); | ||
}).catch(logAndExit); | ||
try { | ||
configString = await readFile(configPath, 'utf-8'); | ||
} catch (error) { | ||
const message = ( | ||
configOverridePath | ||
? `Error: Could not read ${ configOverridePath }` | ||
: 'Error: Could not locate local .bpmnlintrc file, please create one: https://github.com/bpmn-io/bpmnlint#configuration' | ||
); | ||
return logAndExit(message); | ||
} | ||
try { | ||
config = JSON.parse(configString); | ||
} catch (err) { | ||
return logAndExit('Error: Could not parse ' + configPath + ': ' + err.message); | ||
} | ||
return lint(config); | ||
} | ||
run().catch(logAndExit); |
@@ -9,2 +9,6 @@ # Changelog | ||
## 5.2.0 | ||
* `FEAT`: provide help on missing `.bpmnlintrc` | ||
## 5.1.2 | ||
@@ -11,0 +15,0 @@ |
{ | ||
"name": "bpmnlint", | ||
"description": "Validate your BPMN diagrams based on configurable lint rules", | ||
"version": "5.1.2", | ||
"version": "5.2.0", | ||
"main": "lib/index.js", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41091
1257