Skip to content

Commit

Permalink
chore: example dir rename to dev-server
Browse files Browse the repository at this point in the history
  • Loading branch information
qmhc committed Jul 26, 2022
1 parent d0e7d76 commit 0edfc40
Show file tree
Hide file tree
Showing 16 changed files with 32 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ module.exports = {
}
},
{
files: ['example/**'],
files: ['dev-server/**'],
globals: {
__DEMOS__: 'readonly',
__TARGET__: 'readonly',
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ pnpm run build:common

### Developing for Component

We use a vite project in `example` for development.
We use a vite project in `dev-server` for development.

Using the following command you can start development server for specify component:
Using the following command you can start development server for specify component:

```sh
pnpm run serve [component]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion example/index.html → dev-server/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<link rel="icon" href="/favicon.ico" />
<title>example | Vexip UI</title>
<title>dev | Vexip UI</title>
</head>
<body>
<div id="app"></div>
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion example/package.json → dev-server/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@vexip-ui/example",
"name": "@vexip-ui/dev-server",
"private": true,
"scripts": {
"serve": "vite"
Expand Down
File renamed without changes.
18 changes: 18 additions & 0 deletions dev-server/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"types": [
"vite/client"
],
"paths": {
"@/*": ["../*"],
"vexip-ui/es/*": ["../components/*"],
"vexip-ui": ["../components"]
}
},
"include": [
"*.vue",
"*.ts",
"global.d.ts"
]
}
File renamed without changes.
37 changes: 0 additions & 37 deletions example/tsconfig.json

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
"clean": "rimraf node_modules/.cache && rimraf node_modules/.vite && rimraf node_modules/.rts2_cache",
"commit": "git-cz",
"create": "ts-node scripts/create.ts",
"lint": "eslint --fix --ext .js,.ts,.tsx,.vue common/*/src/** components/** playground/** example/**",
"lint": "eslint --fix --ext .js,.ts,.tsx,.vue common/*/src/** components/** playground/** dev-server/**",
"lint:script": "eslint --fix --ext .js,.ts scripts/**",
"lint:style": "stylelint **/*.{vue,scss} --fix",
"postpublish": "pinst --enable",
Expand Down
2 changes: 1 addition & 1 deletion pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
packages:
- common/*
- dev-server
- docs
- example
- playground
10 changes: 7 additions & 3 deletions scripts/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const theme = args.theme || args.t

const langs = ['zh-CN']

const devDir = resolve(__dirname, '../dev-server')

main().catch(error => {
logger.error(error)
process.exit(1)
Expand Down Expand Up @@ -41,6 +43,8 @@ async function serveComponent() {
const router = `
import { createRouter, createWebHashHistory } from 'vue-router'
document.title = '${target} | Vexip UI'
export const router = createRouter({
history: createWebHashHistory('/'),
routes: [
Expand All @@ -64,13 +68,13 @@ async function serveComponent() {
`

writeFileSync(
resolve(__dirname, '../example/router.ts'),
resolve(devDir, 'router.ts'),
format(router, { ...(await resolveConfig(resolve('.prettierrc.js'))), parser: 'typescript' }),
'utf-8'
)

await run('vite', ['serve'], {
cwd: resolve(__dirname, '../example'),
cwd: devDir,
stdio: 'inherit',
env: {
NODE_ENV: prodMode ? 'production' : 'development',
Expand All @@ -85,7 +89,7 @@ async function serveComponent() {

async function serveTheme() {
await run('vite', ['serve'], {
cwd: resolve(__dirname, '../example'),
cwd: devDir,
stdio: 'inherit',
env: {
NODE_ENV: prodMode ? 'production' : 'development',
Expand Down

0 comments on commit 0edfc40

Please sign in to comment.