Skip to content
This repository has been archived by the owner on Oct 2, 2020. It is now read-only.

Commit

Permalink
fix: restore dev.ts to dev.js for solving node_modules problem
Browse files Browse the repository at this point in the history
  • Loading branch information
lbwa committed Aug 7, 2018
1 parent fce7b7e commit a4c9c8c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -2,7 +2,7 @@
"name": "docs-server",
"version": "1.3.0",
"description": "A server which is used to build one of microservices for docs system",
"main": "dist/src/index.js",
"main": "dist/index.js",
"files": [
"dist",
"src"
Expand All @@ -16,8 +16,8 @@
"private": false,
"scripts": {
"ts": "npx tsc",
"server": "node dist/sample/dev",
"dev": "yarn run ts && yarn run server",
"server": "node sample/dev",
"dev": "yarn clean && yarn run ts && yarn run server",
"commit": "git add . && git-cz",
"clean": "rm -vrf dist/*",
"test": "yarn ts && cross-env NODE_ENV=test npx mocha test/app.spec.js",
Expand Down
10 changes: 4 additions & 6 deletions sample/dev.ts → sample/dev.js
@@ -1,20 +1,18 @@
import Koa = require('koa')

const DocsServer = require('../src/index')
const DocsServer = require('../dist/index')

module.exports = new DocsServer({
customHeaders: {
headers: {
'Access-Control-Allow-Origin': 'https://set.sh'
},
threshold: 1,
filter: (origin: string) => {
filter: (origin) => {
const removeExtension = origin.replace(/\.md$/, '')
return `writings/${removeExtension}`
},
extra: [
{
route: '/test',
middleware: async (ctx: Koa.Context, next: Function) => {
middleware: async (ctx, next) => {
ctx.status = 200
ctx.body = JSON.stringify({
errno: 0,
Expand Down
2 changes: 1 addition & 1 deletion test/app.spec.js
@@ -1,6 +1,6 @@
const request = require('supertest')
const resolve = require('path').resolve
const App = require('../dist/src/index')
const App = require('../dist/index')

describe('TEST: Application, including routes filter\n', () => {
let app
Expand Down
3 changes: 1 addition & 2 deletions tsconfig.json
Expand Up @@ -15,8 +15,7 @@
"removeComments": true
},
"include": [
"src/**/*",
"sample/**/*"
"src/**/*"
],
"exclude": [
"node_modules"
Expand Down

0 comments on commit a4c9c8c

Please sign in to comment.