Skip to content

Commit

Permalink
Fix VSCode warning
Browse files Browse the repository at this point in the history
  • Loading branch information
octoape committed Aug 21, 2024
1 parent 935c1e5 commit cf5bcdc
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 27 deletions.
6 changes: 3 additions & 3 deletions example/test-vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineConfig } from 'vite'
import { defineConfig, Plugin } from 'vite'
import vue from '@vitejs/plugin-vue'
import bodyParser from 'body-parser'
import cookieParser from 'cookie-parser'
Expand All @@ -19,7 +19,7 @@ export default defineConfig({
bodyParser.text(),
bodyParser.raw()
]
}),
}) as Plugin,
{
name: `vite-plugin-stop`,
apply: 'serve',
Expand All @@ -37,7 +37,7 @@ export default defineConfig({
if(responseText !== 'Hello world!/api/test1/1' || userId !== "octoape")
throw new Error('wrong mock response')
else
console.log('\x1b[32m ✓ correct mock response \x1b[0m');
console.log('\x1b[32m ✓ correct mock response \x1b[0m');

setTimeout(process.exit, 1e3)
}
Expand Down
4 changes: 2 additions & 2 deletions example/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineConfig } from 'vite'
import { defineConfig, Plugin } from 'vite'
import vue from '@vitejs/plugin-vue'
import bodyParser from 'body-parser'
import cookieParser from 'cookie-parser'
Expand All @@ -17,6 +17,6 @@ export default defineConfig({
bodyParser.text(),
bodyParser.raw()
]
})
}) as Plugin
]
})
3 changes: 1 addition & 2 deletions example2/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"],
"references": [{ "path": "./tsconfig.node.json" }]
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"]
}
10 changes: 0 additions & 10 deletions example2/tsconfig.node.json

This file was deleted.

17 changes: 8 additions & 9 deletions example2/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
import { ConfigEnv, defineConfig, Plugin, UserConfigExport } from 'vite'
import { ConfigEnv, Plugin, UserConfigExport } from 'vite'
import vue from '@vitejs/plugin-vue'
import fetch from 'node-fetch'
//import mockServer from 'vite-plugin-mock-server'
//import mockServer from '../dist'
import mockServer from '../src'

const port = 8000
export default ({ command, mode }: ConfigEnv): UserConfigExport => {

if(mode !== 'test')
if(mode !== 'test') {
return {
plugins: [
vue(),
mockServer()
mockServer() as Plugin
]}
else
} else {
// auto close after 5 secounds, to the runtime
return {
server: {
port,
},
plugins: [
vue(),
mockServer(),
mockServer() as Plugin,
{
name: `vite-plugin-stop`,
apply: 'serve',
Expand All @@ -41,5 +38,7 @@ export default ({ command, mode }: ConfigEnv): UserConfigExport => {
, 5000)
}
}
]}
]
}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vite-plugin-mock-server",
"version": "1.3.0",
"version": "1.3.1",
"description": "Vite mock server plugin",
"main": "dist/index.js",
"scripts": {
Expand Down

0 comments on commit cf5bcdc

Please sign in to comment.