Comparing version 0.0.1 to 0.1.0
{ | ||
"name": "qontract", | ||
"version": "0.0.1", | ||
"version": "0.1.0", | ||
"description": "npm wrapper for qontract", | ||
@@ -34,4 +34,5 @@ "main": "src/index.js", | ||
"download": "^8.0.0", | ||
"exec-sh": "^0.3.4" | ||
"exec-sh": "^0.3.4", | ||
"yargs": "^15.4.1" | ||
} | ||
} |
@@ -1,10 +0,6 @@ | ||
### NPM Wrapper for Qontract | ||
[Qontract](https://qontract.run/) is a contract driven development tool that allows us to turn our contracts into executable specification. | ||
## Installation | ||
`npm install qontract` | ||
`npm install qontract` will install the qontract locally to the node project. | ||
will install the qontract locally in node_modules. | ||
## Qontract in stub mode (For consumers) | ||
@@ -20,3 +16,3 @@ | ||
`"qontract-stub": "./node_modules/.bin/start-qontract-stub *.qontract"` | ||
`"qontract-stub": "./node_modules/.bin/qontract-stub --contractPath=*.qontract --host='localhost' --port='8000'"` | ||
@@ -32,6 +28,22 @@ ## Qontract tests (For Providers) | ||
`"qontract-tests": "./node_modules/.bin/run-qontract-tests *.qontract"` | ||
`"qontract-tests": "./node_modules/.bin/qontract-test --contractPath=*.qontract"` | ||
## API | ||
### cli commands | ||
`qontract-stub` run the qontract server in stub mode, used by consumers. | ||
`qontract-test` run the qontract server in test mode, used by providers. | ||
### cli arguments | ||
`contractPath` path of the contract files. Can be aa wild card string. | ||
`host` hostname to be stubbed out. Used in stub mode only. | ||
`port` port to run the stub server. Used in stub mode only. | ||
Check [Documentation](https://qontract.run/documentation.html) for more information | ||
@@ -6,9 +6,11 @@ #!/usr/bin/env node | ||
const path = require('path'); | ||
const jarPath = path.resolve('./node_modules/qontract/qontract.jar'); | ||
const [,,args] = process.argv; | ||
const contractsPath = path.resolve(args); | ||
const { qontractPath } = require('../config'); | ||
const jarPath = path.resolve(qontractPath); | ||
const {argv} = require('yargs') | ||
const contractPath = path.resolve(argv.contractPath); | ||
console.log('running qontract tests') | ||
execSh( | ||
`java -jar ${jarPath} test ${contractsPath}`, | ||
`java -jar ${jarPath} test ${contractPath}`, | ||
{ }, | ||
@@ -15,0 +17,0 @@ err => { |
@@ -6,9 +6,12 @@ #!/usr/bin/env node | ||
const path = require('path'); | ||
const jarPath = path.resolve('./node_modules/qontract/qontract.jar'); | ||
const [,,args] = process.argv; | ||
const contractsPath = path.resolve(args); | ||
const { qontractPath } = require('../config'); | ||
const jarPath = path.resolve(qontractPath); | ||
const {argv} = require('yargs'); | ||
const { contractPath, host, port} = argv; | ||
const contracts = path.resolve(contractPath); | ||
console.log('starting qontract stub server') | ||
execSh( | ||
`java -jar ${jarPath} stub ${contractsPath}`, | ||
`java -jar ${jarPath} stub ${contracts} --host=${host} --port=${port}`, | ||
{ }, | ||
@@ -15,0 +18,0 @@ err => { |
const init = async () => { | ||
const download = require('download'); | ||
const { qontractJarRemotePath } = require('./config'); | ||
console .log('Starting qontract jar download..') | ||
await (async () => { | ||
await download('https://github.com/qontract/qontract/releases/download/0.13.1/qontract.jar', '.'); | ||
await download(qontractJarRemotePath, '.'); | ||
})(); | ||
@@ -8,0 +9,0 @@ console .log('Finished qontract jar download!!') |
5567
7
52
48
3
+ Addedyargs@^15.4.1
+ Addedansi-regex@5.0.1(transitive)
+ Addedansi-styles@4.3.0(transitive)
+ Addedcamelcase@5.3.1(transitive)
+ Addedcliui@6.0.0(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addeddecamelize@1.2.0(transitive)
+ Addedemoji-regex@8.0.0(transitive)
+ Addedfind-up@4.1.0(transitive)
+ Addedget-caller-file@2.0.5(transitive)
+ Addedis-fullwidth-code-point@3.0.0(transitive)
+ Addedlocate-path@5.0.0(transitive)
+ Addedp-limit@2.3.0(transitive)
+ Addedp-locate@4.1.0(transitive)
+ Addedp-try@2.2.0(transitive)
+ Addedpath-exists@4.0.0(transitive)
+ Addedrequire-directory@2.1.1(transitive)
+ Addedrequire-main-filename@2.0.0(transitive)
+ Addedset-blocking@2.0.0(transitive)
+ Addedstring-width@4.2.3(transitive)
+ Addedstrip-ansi@6.0.1(transitive)
+ Addedwhich-module@2.0.1(transitive)
+ Addedwrap-ansi@6.2.0(transitive)
+ Addedy18n@4.0.3(transitive)
+ Addedyargs@15.4.1(transitive)
+ Addedyargs-parser@18.1.3(transitive)