Add typescript config

pull/282/head
amio 2019-05-13 16:56:06 +08:00
rodzic 5a226cc8f2
commit d6ca0afc5f
3 zmienionych plików z 24 dodań i 5 usunięć

Wyświetl plik

@ -1,6 +1,6 @@
const fs = require('fs')
const path = require('path')
const http = require('http')
import fs from 'fs'
import path from 'path'
import http from 'http'
const serve404 = require('../libs/serve-404.js')
@ -9,7 +9,7 @@ const badgeHandlers = fs.readdirSync(__dirname)
.map(name => name.replace(/\.js$/, ''))
module.exports = http.createServer((req, res) => {
const handler = badgeHandlers.find(h => req.url.startsWith(`/${h}`))
const handler = badgeHandlers.find(h => req.url!.startsWith(`/${h}`))
if (handler) {
return require(path.join(__dirname, handler))(req, res)

Wyświetl plik

@ -49,6 +49,8 @@
"react-dom": "^16.8.6",
"standard": "^12.0.1",
"supertest": "^4.0.2",
"tap": "^12.7.0"
"tap": "^12.7.0",
"ts-node": "^8.1.0",
"typescript": "^3.4.5"
}
}

17
tsconfig.json 100644
Wyświetl plik

@ -0,0 +1,17 @@
{
"compilerOptions": {
"strict": true,
"target": "esnext",
"module": "commonjs",
"moduleResolution": "node",
"esModuleInterop": true,
"sourceMap": true,
"outDir": "dist",
"baseUrl": ".",
"lib": ["esnext"]
},
"include": [
"./src",
"./types"
]
}