From 5df2c4c98d746db6b3a6f591279dcfd54eabf200 Mon Sep 17 00:00:00 2001 From: Lloyd Brookes Date: Thu, 28 Jun 2018 23:52:21 +0100 Subject: [PATCH] use package files array.. linting --- lib/local-web-server.js => index.js | 8 ++++---- lib/cli-app.js | 2 +- package.json | 4 +++- test/cli.js | 1 - 4 files changed, 8 insertions(+), 7 deletions(-) rename lib/local-web-server.js => index.js (94%) diff --git a/lib/local-web-server.js b/index.js similarity index 94% rename from lib/local-web-server.js rename to index.js index fe7198d..73a0d31 100644 --- a/lib/local-web-server.js +++ b/index.js @@ -17,7 +17,7 @@ const path = require('path') * // secure, SPA server with listening websocket now ready on port 8050 */ - /** +/** * @alias module:local-web-server */ class LocalWebServer extends Lws { @@ -45,12 +45,12 @@ class LocalWebServer extends Lws { const usage = require('lws/lib/usage') usage.defaults .set('an', 'ws') - .set('av', require('../package').version) + .set('av', require('./package').version) .set('cd4', 'api') options = Object.assign({ - moduleDir: path.resolve(__dirname, `../node_modules`), + moduleDir: path.resolve(__dirname, `./node_modules`), modulePrefix: 'lws-', - stack: require('./default-stack') + stack: require('./lib/default-stack') }, options) return super.listen(options) diff --git a/lib/cli-app.js b/lib/cli-app.js index 33a17fd..8c1fcfa 100644 --- a/lib/cli-app.js +++ b/lib/cli-app.js @@ -3,7 +3,7 @@ const LwsCliApp = require('lws/lib/cli-app') class WsCliApp extends LwsCliApp { constructor (options) { - super (options) + super(options) /* override default serve command */ this.commands.add(null, require('./command/serve')) /* add middleware-list command */ diff --git a/package.json b/package.json index f8cd84d..286e740 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,6 @@ "bin": { "ws": "./bin/cli.js" }, - "main": "lib/local-web-server.js", "license": "MIT", "keywords": [ "dev", @@ -31,6 +30,9 @@ }, "repository": "https://github.com/lwsjs/local-web-server", "author": "Lloyd Brookes <75pound@gmail.com>", + "files": [ + "bin", "lib", "index.js" + ], "dependencies": { "lws": "^1.2.3", "lws-basic-auth": "^0.1.1", diff --git a/test/cli.js b/test/cli.js index 50478bd..a33ea80 100644 --- a/test/cli.js +++ b/test/cli.js @@ -19,7 +19,6 @@ runner.test('cli.run', async function () { }) runner.test('cli.run: bad option', async function () { - const port = 7500 + this.index const origArgv = process.argv.slice() process.argv = [ 'node', 'something', '--should-fail' ] const exitCode = process.exitCode