Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use @penx/swagger-node-runner fork (#4)
* use @penx/swagger-node-runner fork * readme
- Loading branch information
Showing
6 changed files
with
63 additions
and
399 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,25 @@ | ||
#!/usr/bin/env node | ||
|
||
var program = require('commander'); | ||
var path = require('path'); | ||
var {version} = require('./package.json'); | ||
var app = require('./app.js'); | ||
|
||
function resolvePath(relativePath) { | ||
console.log(path.join(process.cwd(), relativePath)) | ||
return path.join(process.cwd(), relativePath); | ||
} | ||
|
||
program | ||
.version(version) | ||
.usage('[options] <spec>') | ||
.option('-m, --mock <dir>', 'Mock directory') | ||
.option('-c, --config <file>', 'Config file') | ||
.option('-p, --port <n>', 'Port', parseInt); | ||
.option('-m, --mock <dir>', 'path to mock directory', resolvePath) | ||
.option('-c, --config <file>', 'path to config file', resolvePath) | ||
.option('-p, --port <n>', 'port to start the mock server on', parseInt); | ||
|
||
program.parse(process.argv); | ||
|
||
const spec = program.args[0]; | ||
const spec = program.args[0] ? resolvePath(program.args[0]) : undefined; | ||
const {mock, config, port} = program; | ||
|
||
app({spec, mock, config, port}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.