update dates, deps and travis
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 7
|
||||
- 8
|
||||
- 10
|
||||
- 11
|
||||
- 12
|
||||
|
3
LICENSE
3
LICENSE
@ -1,6 +1,7 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013-18 Lloyd Brookes <75pound@gmail.com>
|
||||
Copyright (c) 2013-19
|
||||
Lloyd Brookes <75pound@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
11
README.md
11
README.md
@ -1,12 +1,12 @@
|
||||
[](https://www.npmjs.org/package/local-web-server)
|
||||
[](https://www.npmjs.org/package/local-web-server)
|
||||
[](https://www.npmjs.org/package/local-web-server)
|
||||
[](https://travis-ci.org/lwsjs/local-web-server)
|
||||
[](https://coveralls.io/github/lwsjs/local-web-server?branch=master)
|
||||
[](https://david-dm.org/lwsjs/local-web-server/master)
|
||||
[](https://david-dm.org/lwsjs/local-web-server)
|
||||
[](https://github.com/feross/standard)
|
||||
[](https://gitter.im/lwsjs/local-web-server?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
**Requires node v7.6 or above. Upgraders, please read the [release notes](https://github.com/lwsjs/local-web-server/releases)**.
|
||||
**Requires node v8 or above. Upgraders, please read the [release notes](https://github.com/lwsjs/local-web-server/releases)**.
|
||||
|
||||
# local-web-server
|
||||
|
||||
@ -155,11 +155,12 @@ See [the tutorials](https://github.com/lwsjs/local-web-server/wiki#tutorials) fo
|
||||
|
||||
## Install
|
||||
|
||||
**Requires node v7.6 or above**. Install the [previous release](https://github.com/lwsjs/local-web-server/tree/v1.x) for node >= v4.0.0.
|
||||
**Requires node v8 or above**. Install the [previous release](https://github.com/lwsjs/local-web-server/tree/v1.x) for node >= v4.0.0.
|
||||
|
||||
```sh
|
||||
$ npm install -g local-web-server
|
||||
```
|
||||
* * *
|
||||
|
||||
© 2013-18 Lloyd Brookes <75pound@gmail.com>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
|
||||
© 2013-19
|
||||
Lloyd Brookes <75pound@gmail.com>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
|
||||
|
@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env node
|
||||
const nodeVersionMatches = require('node-version-matches')
|
||||
|
||||
if (nodeVersionMatches('>=7.6.0')) {
|
||||
if (nodeVersionMatches('>=8.0.0')) {
|
||||
require('../lib/cli-app').run()
|
||||
} else {
|
||||
console.log('Sorry, this app requires node v7.6.0 or above. Please upgrade https://nodejs.org/en/')
|
||||
console.log('Sorry, this app requires node v8.0.0 or above. Please upgrade https://nodejs.org/en/')
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ module.exports = [
|
||||
'lws-conditional-get',
|
||||
'lws-mime',
|
||||
'lws-range',
|
||||
'lws-mock-response',
|
||||
'lws-spa',
|
||||
'lws-static',
|
||||
'lws-index'
|
||||
|
1156
package-lock.json
generated
1156
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
25
package.json
25
package.json
@ -21,12 +21,12 @@
|
||||
"proxy"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=7.6"
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "test-runner test/*.js",
|
||||
"docs": "jsdoc2md -p list index.js lib/*.js > doc/api.md; echo",
|
||||
"cover": "nyc --reporter=text-lcov test-runner test/*.js | coveralls"
|
||||
"cover": "nyc npm test && nyc report --reporter=text-lcov | coveralls"
|
||||
},
|
||||
"repository": "https://github.com/lwsjs/local-web-server",
|
||||
"author": "Lloyd Brookes <75pound@gmail.com>",
|
||||
@ -36,9 +36,9 @@
|
||||
"index.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"lws": "^1.3.0",
|
||||
"lws": "^1.3.2",
|
||||
"lws-basic-auth": "^0.1.1",
|
||||
"lws-blacklist": "^0.3.0",
|
||||
"lws-blacklist": "^1.0.0",
|
||||
"lws-body-parser": "^0.2.4",
|
||||
"lws-compress": "^0.2.1",
|
||||
"lws-conditional-get": "^0.3.4",
|
||||
@ -47,18 +47,17 @@
|
||||
"lws-json": "^0.3.2",
|
||||
"lws-log": "^0.3.2",
|
||||
"lws-mime": "^0.2.2",
|
||||
"lws-mock-response": "^0.5.1",
|
||||
"lws-range": "^1.1.0",
|
||||
"lws-range": "^1.1.1",
|
||||
"lws-request-monitor": "^0.1.5",
|
||||
"lws-rewrite": "^0.4.1",
|
||||
"lws-spa": "^0.3.0",
|
||||
"lws-rewrite": "^1.0.1",
|
||||
"lws-spa": "^1.0.1",
|
||||
"lws-static": "^0.5.0",
|
||||
"node-version-matches": "^1.0.0"
|
||||
"node-version-matches": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"coveralls": "^3.0.2",
|
||||
"jsdoc-to-markdown": "^4.0.1",
|
||||
"req-then": "^0.6.4",
|
||||
"test-runner": "^0.5.0"
|
||||
"coveralls": "^3.0.3",
|
||||
"jsdoc-to-markdown": "^5.0.0",
|
||||
"node-fetch": "^2.6.0",
|
||||
"test-runner": "^0.6.0"
|
||||
}
|
||||
}
|
||||
|
20
test/cli.js
20
test/cli.js
@ -1,22 +1,22 @@
|
||||
const TestRunner = require('test-runner')
|
||||
const Tom = require('test-runner').Tom
|
||||
const a = require('assert')
|
||||
const CliApp = require('../lib/cli-app')
|
||||
const request = require('req-then')
|
||||
const fetch = require('node-fetch')
|
||||
|
||||
const runner = new TestRunner()
|
||||
const tom = module.exports = new Tom('cli')
|
||||
|
||||
runner.test('cli.run', async function () {
|
||||
tom.test('cli.run', async function () {
|
||||
const port = 7500 + this.index
|
||||
const origArgv = process.argv.slice()
|
||||
process.argv = [ 'node', 'something', '--port', `${port}` ]
|
||||
const server = CliApp.run()
|
||||
process.argv = origArgv
|
||||
const response = await request(`http://127.0.0.1:${port}/`)
|
||||
const response = await fetch(`http://127.0.0.1:${port}/`)
|
||||
server.close()
|
||||
a.strictEqual(response.res.statusCode, 200)
|
||||
a.strictEqual(response.status, 200)
|
||||
})
|
||||
|
||||
runner.test('cli.run: bad option', async function () {
|
||||
tom.test('cli.run: bad option', async function () {
|
||||
const origArgv = process.argv.slice()
|
||||
process.argv = [ 'node', 'something', '--should-fail' ]
|
||||
const exitCode = process.exitCode
|
||||
@ -26,21 +26,21 @@ runner.test('cli.run: bad option', async function () {
|
||||
a.strictEqual(server, undefined)
|
||||
})
|
||||
|
||||
runner.test('cli.run: --help', async function () {
|
||||
tom.test('cli.run: --help', async function () {
|
||||
const origArgv = process.argv.slice()
|
||||
process.argv = [ 'node', 'something', '--help' ]
|
||||
CliApp.run()
|
||||
process.argv = origArgv
|
||||
})
|
||||
|
||||
runner.test('cli.run: --version', async function () {
|
||||
tom.test('cli.run: --version', async function () {
|
||||
const origArgv = process.argv.slice()
|
||||
process.argv = [ 'node', 'something', '--version' ]
|
||||
CliApp.run()
|
||||
process.argv = origArgv
|
||||
})
|
||||
|
||||
runner.test('cli.run: middleware-list', async function () {
|
||||
tom.test('cli.run: middleware-list', async function () {
|
||||
const origArgv = process.argv.slice()
|
||||
process.argv = [ 'node', 'something', 'middleware-list' ]
|
||||
CliApp.run()
|
||||
|
13
test/test.js
13
test/test.js
@ -1,18 +1,19 @@
|
||||
const TestRunner = require('test-runner')
|
||||
const request = require('req-then')
|
||||
const Tom = require('test-runner').Tom
|
||||
const fetch = require('node-fetch')
|
||||
const LocalWebServer = require('../')
|
||||
const a = require('assert')
|
||||
|
||||
const runner = new TestRunner()
|
||||
const tom = module.exports = new Tom('test')
|
||||
|
||||
runner.test('basic', async function () {
|
||||
tom.test('basic', async function () {
|
||||
const port = 9000 + this.index
|
||||
const localWebServer = new LocalWebServer()
|
||||
const server = localWebServer.listen({
|
||||
port: port,
|
||||
directory: 'test/fixture'
|
||||
})
|
||||
const response = await request(`http://localhost:${port}/one.txt`)
|
||||
const response = await fetch(`http://localhost:${port}/one.txt`)
|
||||
server.close()
|
||||
a.strictEqual(response.data.toString(), 'one\n')
|
||||
const body = await response.text()
|
||||
a.strictEqual(body, 'one\n')
|
||||
})
|
||||
|
Reference in New Issue
Block a user