Skip to content

Commit

Permalink
fix: repair windows support, add CI (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith committed May 12, 2019
1 parent 8c77816 commit 2f4e462
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .ci/docker/windows/Dockerfile
@@ -0,0 +1,2 @@
FROM cirrusci/windowsservercore:2019
RUN choco install nodejs --yes --version 10.15.3
7 changes: 7 additions & 0 deletions .cirrus.yml
@@ -1,6 +1,13 @@
container:
image: node:10

windows_task:
windows_container:
dockerfile: .ci/docker/windows/Dockerfile
os_version: 2019
install_script: npm install
test_script: npm test

lint_task:
install_script: npm install
test_script: npm run lint
Expand Down
7 changes: 5 additions & 2 deletions package.json
Expand Up @@ -21,19 +21,22 @@
"dependencies": {
"chalk": "^2.4.2",
"cheerio": "^1.0.0-rc.2",
"ecstatic": "^4.1.2",
"finalhandler": "^1.1.2",
"gaxios": "^2.0.0",
"jsonexport": "^2.4.1",
"meow": "^5.0.0",
"serve-static": "^1.14.1",
"server-destroy": "^1.0.1",
"update-notifier": "^3.0.0"
},
"devDependencies": {
"@types/cheerio": "^0.22.10",
"@types/finalhandler": "^1.1.0",
"@types/meow": "^5.0.0",
"@types/mocha": "^5.2.6",
"@types/nock": "^10.0.0",
"@types/node": "^11.9.4",
"@types/serve-static": "^1.13.2",
"@types/server-destroy": "^1.0.0",
"@types/sinon": "^7.0.6",
"@types/update-notifier": "^2.5.0",
Expand All @@ -42,7 +45,7 @@
"mocha": "^6.1.4",
"nock": "^10.0.6",
"nyc": "^14.0.0",
"semantic-release": "^15.13.12",
"semantic-release": "^15.13.13",
"sinon": "^7.2.3",
"source-map-support": "^0.5.10",
"typescript": "^3.3.3"
Expand Down
11 changes: 7 additions & 4 deletions src/index.ts
Expand Up @@ -5,7 +5,8 @@ import enableDestroy = require('server-destroy');

import { getLinks } from './links';

const ecstatic = require('ecstatic');
const finalhandler = require('finalhandler');
const serveStatic = require('serve-static');

export interface CheckOptions {
port?: number;
Expand Down Expand Up @@ -83,10 +84,12 @@ export class LinkChecker extends EventEmitter {
* @returns Promise that resolves with the instance of the HTTP server
*/
private startWebServer(root: string, port: number): Promise<http.Server> {
return new Promise(resolve => {
return new Promise((resolve, reject) => {
const serve = serveStatic(root);
const server = http
.createServer(ecstatic({ root }))
.listen(port, () => resolve(server));
.createServer((req, res) => serve(req, res, finalhandler(req, res)))
.listen(port, () => resolve(server))
.on('error', reject);
});
}

Expand Down

0 comments on commit 2f4e462

Please sign in to comment.