upgrade command-line-args
This commit is contained in:
@ -3,6 +3,7 @@
|
|||||||
const localWebServer = require('../')
|
const localWebServer = require('../')
|
||||||
const cliOptions = require('../lib/cli-options')
|
const cliOptions = require('../lib/cli-options')
|
||||||
const commandLineArgs = require('command-line-args')
|
const commandLineArgs = require('command-line-args')
|
||||||
|
const commandLineUsage = require('command-line-usage')
|
||||||
const ansi = require('ansi-escape-sequences')
|
const ansi = require('ansi-escape-sequences')
|
||||||
const loadConfig = require('config-master')
|
const loadConfig = require('config-master')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
@ -11,9 +12,9 @@ const arrayify = require('array-back')
|
|||||||
const t = require('typical')
|
const t = require('typical')
|
||||||
const flatten = require('reduce-flatten')
|
const flatten = require('reduce-flatten')
|
||||||
|
|
||||||
const cli = commandLineArgs(cliOptions.definitions)
|
const usage = commandLineUsage(cliOptions.usageData)
|
||||||
const usage = cli.getUsage(cliOptions.usageData)
|
|
||||||
const stored = loadConfig('local-web-server')
|
const stored = loadConfig('local-web-server')
|
||||||
|
|
||||||
let options
|
let options
|
||||||
let isHttps = false
|
let isHttps = false
|
||||||
|
|
||||||
@ -129,7 +130,7 @@ function collectOptions () {
|
|||||||
let options = {}
|
let options = {}
|
||||||
|
|
||||||
/* parse command line args */
|
/* parse command line args */
|
||||||
options = cli.parse()
|
options = commandLineArgs(cliOptions.definitions)
|
||||||
|
|
||||||
const builtIn = {
|
const builtIn = {
|
||||||
port: 8000,
|
port: 8000,
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
module.exports = {
|
exports.definitions = [
|
||||||
definitions: [
|
|
||||||
{
|
{
|
||||||
name: 'port', alias: 'p', type: Number, defaultOption: true,
|
name: 'port', alias: 'p', type: Number, defaultOption: true,
|
||||||
description: 'Web server port.', group: 'server'
|
description: 'Web server port.', group: 'server'
|
||||||
@ -56,19 +55,32 @@ module.exports = {
|
|||||||
name: 'config', type: Boolean,
|
name: 'config', type: Boolean,
|
||||||
description: 'Print the stored config.', group: 'misc'
|
description: 'Print the stored config.', group: 'misc'
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
usageData: {
|
|
||||||
title: 'local-web-server',
|
exports.usageData = [
|
||||||
description: 'A simple web-server for productive front-end development.',
|
{
|
||||||
footer: 'Project home: [underline]{https://github.com/75lb/local-web-server}',
|
header: 'local-web-server',
|
||||||
synopsis: [
|
content: 'A simple web-server for productive front-end development.'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
header: 'Synopsis',
|
||||||
|
content: [
|
||||||
'$ ws [<server options>]',
|
'$ ws [<server options>]',
|
||||||
'$ ws --config',
|
'$ ws --config',
|
||||||
'$ ws --help'
|
'$ ws --help'
|
||||||
],
|
]
|
||||||
groups: {
|
},
|
||||||
server: 'Server',
|
{
|
||||||
misc: 'Misc'
|
header: 'Server options',
|
||||||
|
optionList: exports.definitions,
|
||||||
|
group: 'server'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
header: 'Misc options',
|
||||||
|
optionList: exports.definitions,
|
||||||
|
group: 'misc'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
content: 'Project home: [underline]{https://github.com/75lb/local-web-server}'
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
}
|
|
||||||
|
15
package.json
15
package.json
@ -31,27 +31,28 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ansi-escape-sequences": "^2.2.2",
|
"ansi-escape-sequences": "^2.2.2",
|
||||||
"array-back": "^1.0.3",
|
"array-back": "^1.0.3",
|
||||||
"command-line-args": "^2.1.6",
|
"command-line-args": "^3.0.0",
|
||||||
|
"command-line-usage": "^3.0.1",
|
||||||
"config-master": "^2.0.2",
|
"config-master": "^2.0.2",
|
||||||
"debug": "^2.2.0",
|
"debug": "^2.2.0",
|
||||||
"http-proxy": "^1.13.2",
|
"http-proxy": "^1.13.3",
|
||||||
"kcors": "^1.2.0",
|
"kcors": "^1.2.1",
|
||||||
"koa": "^2.0.0",
|
"koa": "^2.0.0",
|
||||||
"koa-bodyparser": "^3.0.0",
|
"koa-bodyparser": "^3.0.0",
|
||||||
"koa-compose": "^3.1.0",
|
"koa-compose": "^3.1.0",
|
||||||
"koa-compress": "^1.0.9",
|
"koa-compress": "^1.0.9",
|
||||||
"koa-conditional-get": "^1.0.3",
|
"koa-conditional-get": "^1.0.3",
|
||||||
"koa-connect-history-api-fallback": "^0.3.0",
|
"koa-connect-history-api-fallback": "~0.3.0",
|
||||||
"koa-convert": "^1.2.0",
|
"koa-convert": "^1.2.0",
|
||||||
"koa-etag": "^2.1.1",
|
"koa-etag": "^2.1.1",
|
||||||
"koa-json": "^1.1.3",
|
"koa-json": "^1.1.3",
|
||||||
"koa-morgan": "^1.0.1",
|
"koa-morgan": "^1.0.1",
|
||||||
"koa-rewrite": "^2.1.0",
|
"koa-rewrite": "^2.1.0",
|
||||||
"koa-route": "^3",
|
"koa-route": "^3.0.0",
|
||||||
"koa-send": "^3.2.0",
|
"koa-send": "^3.2.0",
|
||||||
"koa-serve-index": "^1.1.1",
|
"koa-serve-index": "^1.1.1",
|
||||||
"koa-static": "^2.0.0",
|
"koa-static": "^2.0.0",
|
||||||
"path-to-regexp": "^1.2.1",
|
"path-to-regexp": "^1.5.0",
|
||||||
"reduce-flatten": "^1.0.0",
|
"reduce-flatten": "^1.0.0",
|
||||||
"stream-log-stats": "^1.1.3",
|
"stream-log-stats": "^1.1.3",
|
||||||
"string-tools": "^1.0.0",
|
"string-tools": "^1.0.0",
|
||||||
@ -60,7 +61,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"jsdoc-to-markdown": "^1.3.6",
|
"jsdoc-to-markdown": "^1.3.6",
|
||||||
"req-then": "^0.2.4",
|
"req-then": "~0.2.4",
|
||||||
"tape": "^4.5.1"
|
"tape": "^4.5.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user