@datreeio/version-compare
Advanced tools
Comparing version 1.0.3 to 1.0.4
17
index.js
@@ -14,2 +14,7 @@ const program = require('commander') | ||
) | ||
.option('-p, --payload <payload>', 'JSON formatted payload of expected and actual code component versions') | ||
.option( | ||
'-f, --file-path <file_path>', | ||
'path to JSON formatted payload of expected and actual code component versions' | ||
) | ||
.option('-u, --pr-url <pull_request_url>', 'pull request url') | ||
@@ -24,3 +29,11 @@ .parse(process.argv) | ||
const versionsPayload = fs.readFileSync(program.filePath, 'utf8') | ||
let versionsPayload | ||
if (program.filePath) { | ||
versionsPayload = fs.readFileSync(program.filePath, 'utf8') | ||
} else if (program.payload) { | ||
versionsPayload = program.payload | ||
} else { | ||
console.log('no payload received') | ||
process.exitCode = 1 | ||
} | ||
@@ -53,6 +66,8 @@ const body = { | ||
console.log('datree policy is running, check github for more information - ', program.prUrl) | ||
process.exitCode = 0 | ||
}) | ||
.catch(err => { | ||
console.log('api failure - ', err.message) | ||
process.exitCode = 1 | ||
}) | ||
} |
{ | ||
"name": "@datreeio/version-compare", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "command line script that runs the datree version compare policy", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
4959
84