Browse Source

use package files array.. linting

master
Lloyd Brookes 7 years ago
parent
commit
5df2c4c98d
  1. 8
      index.js
  2. 2
      lib/cli-app.js
  3. 4
      package.json
  4. 1
      test/cli.js

8
lib/local-web-server.js → index.js

@ -17,7 +17,7 @@ const path = require('path')
* // secure, SPA server with listening websocket now ready on port 8050 * // secure, SPA server with listening websocket now ready on port 8050
*/ */
/**
/**
* @alias module:local-web-server * @alias module:local-web-server
*/ */
class LocalWebServer extends Lws { class LocalWebServer extends Lws {
@ -45,12 +45,12 @@ class LocalWebServer extends Lws {
const usage = require('lws/lib/usage') const usage = require('lws/lib/usage')
usage.defaults usage.defaults
.set('an', 'ws') .set('an', 'ws')
.set('av', require('../package').version)
.set('av', require('./package').version)
.set('cd4', 'api') .set('cd4', 'api')
options = Object.assign({ options = Object.assign({
moduleDir: path.resolve(__dirname, `../node_modules`),
moduleDir: path.resolve(__dirname, `./node_modules`),
modulePrefix: 'lws-', modulePrefix: 'lws-',
stack: require('./default-stack')
stack: require('./lib/default-stack')
}, options) }, options)
return super.listen(options) return super.listen(options)

2
lib/cli-app.js

@ -3,7 +3,7 @@ const LwsCliApp = require('lws/lib/cli-app')
class WsCliApp extends LwsCliApp { class WsCliApp extends LwsCliApp {
constructor (options) { constructor (options) {
super (options)
super(options)
/* override default serve command */ /* override default serve command */
this.commands.add(null, require('./command/serve')) this.commands.add(null, require('./command/serve'))
/* add middleware-list command */ /* add middleware-list command */

4
package.json

@ -5,7 +5,6 @@
"bin": { "bin": {
"ws": "./bin/cli.js" "ws": "./bin/cli.js"
}, },
"main": "lib/local-web-server.js",
"license": "MIT", "license": "MIT",
"keywords": [ "keywords": [
"dev", "dev",
@ -31,6 +30,9 @@
}, },
"repository": "https://github.com/lwsjs/local-web-server", "repository": "https://github.com/lwsjs/local-web-server",
"author": "Lloyd Brookes <75pound@gmail.com>", "author": "Lloyd Brookes <75pound@gmail.com>",
"files": [
"bin", "lib", "index.js"
],
"dependencies": { "dependencies": {
"lws": "^1.2.3", "lws": "^1.2.3",
"lws-basic-auth": "^0.1.1", "lws-basic-auth": "^0.1.1",

1
test/cli.js

@ -19,7 +19,6 @@ runner.test('cli.run', async function () {
}) })
runner.test('cli.run: bad option', async function () { runner.test('cli.run: bad option', async function () {
const port = 7500 + this.index
const origArgv = process.argv.slice() const origArgv = process.argv.slice()
process.argv = [ 'node', 'something', '--should-fail' ] process.argv = [ 'node', 'something', '--should-fail' ]
const exitCode = process.exitCode const exitCode = process.exitCode

Loading…
Cancel
Save