mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-01-18 12:34:25 +08:00
site: refactor entry files
This commit is contained in:
parent
5c893ee417
commit
3051421864
@ -10,7 +10,7 @@ const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin')
|
||||
|
||||
const webpackConfig = {
|
||||
mode: 'development',
|
||||
entry: './demo/dev-index',
|
||||
entry: './demo/index.dev',
|
||||
output: {
|
||||
path: path.resolve(process.cwd()),
|
||||
publicPath: '/',
|
||||
|
@ -1,5 +1,5 @@
|
||||
module.exports = Object.assign(
|
||||
{},
|
||||
require('./webpack.dev'),
|
||||
{ entry: './demo/tusimple-dev-index.js' }
|
||||
{ entry: './demo/tusimple-index.dev.js' }
|
||||
)
|
||||
|
@ -8,7 +8,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import modalWrapper from './modalWrapper'
|
||||
import modalWrapper from './modalWrapper.vue'
|
||||
export default {
|
||||
components: {
|
||||
modalWrapper
|
||||
|
@ -3,7 +3,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import modal from './modal'
|
||||
import modal from './modal.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
|
@ -1,15 +1,15 @@
|
||||
|
||||
import { createApp } from 'vue'
|
||||
import { installDemoComponents } from './init'
|
||||
// import debugRouteMixin from './routes/debug-route-mixin'
|
||||
import hljs from './hljs'
|
||||
import DemoRouterView from './DemoRouterView.vue'
|
||||
import naive from '../src/index'
|
||||
import './font'
|
||||
import { routes } from './routes/routes'
|
||||
import { routes, childRoutes } from './routes/routes'
|
||||
import createDemoRouter from './routes/router'
|
||||
|
||||
// debugRouteMixin(routes, childRoutes)
|
||||
import debugRouteMixin from './routes/debug-route-mixin'
|
||||
debugRouteMixin(routes, childRoutes)
|
||||
|
||||
naive.setHljs(hljs)
|
||||
|
||||
const app = createApp(DemoRouterView)
|
@ -1,9 +1,8 @@
|
||||
|
||||
import { createApp } from 'vue'
|
||||
import { installDemoComponents } from './init'
|
||||
import hljs from './hljs'
|
||||
import DemoRouterView from './DemoRouterView.vue'
|
||||
import naive from '../src/index'
|
||||
import naive from '../es/index'
|
||||
import './font'
|
||||
import { routes } from './routes/routes'
|
||||
import createDemoRouter from './routes/router'
|
@ -1,10 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Naive UI</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
</html>
|
@ -1,34 +1,21 @@
|
||||
import routerDebug from '../debug-components/routerDebug'
|
||||
import modalDebug from '../debug-components/modalDebug'
|
||||
import datePickerDebug from '../debug-components/datePickerDebug'
|
||||
import backTopDebug from '../debug-components/backTopDebug'
|
||||
import suffixDebug from '../debug-components/suffixDebug'
|
||||
import cascaderDebug from '../debug-components/cascaderDebug'
|
||||
import verticalAlignDebug from '../debug-components/verticalAlignDebug'
|
||||
import iconTransitionDebug from '../debug-components/iconTransitionDebug'
|
||||
import selectDebug from '../debug-components/selectDebug'
|
||||
import popoverDebug from '../debug-components/popoverDebug'
|
||||
import scrollbarDebug from '../debug-components/scrollbarDebug'
|
||||
import scrollbarDebug2 from '../debug-components/scrollbarDebug2'
|
||||
|
||||
import { withPrefix } from './utils'
|
||||
|
||||
const rootDebugRoutes = [
|
||||
{ path: '/n-popover-debug', component: popoverDebug },
|
||||
{ path: '/n-back-top-debug', component: backTopDebug },
|
||||
{ path: '/n-cascader-debug', component: cascaderDebug }
|
||||
{ path: '/n-popover-debug', component: () => import('../debug-components/popoverDebug.vue') },
|
||||
{ path: '/n-back-top-debug', component: () => import('../debug-components/backTopDebug/index.vue') },
|
||||
{ path: '/n-cascader-debug', component: () => import('../debug-components/cascaderDebug/index.vue') }
|
||||
]
|
||||
|
||||
const childDebugRoutes = [
|
||||
{ path: '/n-scrollbar-debug2', component: scrollbarDebug2 },
|
||||
{ path: '/n-date-picker-debug', component: datePickerDebug },
|
||||
{ path: '/n--debug', component: suffixDebug },
|
||||
{ path: '/n-vertical-align-debug', component: verticalAlignDebug },
|
||||
{ path: '/n-icon-transition-debug', component: iconTransitionDebug },
|
||||
{ path: '/n-select-debug', component: selectDebug },
|
||||
{ path: '/n-router-debug', component: routerDebug },
|
||||
{ path: '/n-modal-debug', component: modalDebug },
|
||||
{ path: '/n-scrollbar-debug', component: scrollbarDebug }
|
||||
{ path: '/n-scrollbar-debug2', component: () => import('../debug-components/scrollbarDebug2/index.vue') },
|
||||
{ path: '/n-date-picker-debug', component: () => import('../debug-components/datePickerDebug/index.vue') },
|
||||
{ path: '/n--debug', component: () => import('../debug-components/suffixDebug/index.vue') },
|
||||
{ path: '/n-vertical-align-debug', component: () => import('../debug-components/verticalAlignDebug.vue') },
|
||||
{ path: '/n-icon-transition-debug', component: () => import('../debug-components/iconTransitionDebug.vue') },
|
||||
{ path: '/n-select-debug', component: () => import('../debug-components/selectDebug.vue') },
|
||||
{ path: '/n-router-debug', component: () => import('../debug-components/routerDebug.vue') },
|
||||
{ path: '/n-modal-debug', component: () => import('../debug-components/modalDebug/index.vue') },
|
||||
{ path: '/n-scrollbar-debug', component: () => import('../debug-components/scrollbarDebug/index.vue') }
|
||||
]
|
||||
|
||||
export default function debugRouteMixin (routes, childRoutes) {
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/demo/dev-index.js"></script>
|
||||
<script type="module" src="__INDEX__"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
15
package.json
15
package.json
@ -8,22 +8,19 @@
|
||||
"start": "npm run dev",
|
||||
"build:fonts": "npm run clean && node build/build-fonts.js",
|
||||
"build:icons": "npm run clean && node build/build-icons.js",
|
||||
"build:js": "npm run generate && npm run clean && rollup -c",
|
||||
"build:package": "npm run generate && npm run clean && node build/build-fonts.js && node build/build-icons.js && rollup -c",
|
||||
"build:demo": "npm run build && npm run demo",
|
||||
"build:doc": "npm run generate && npm run build && rm -rf build-doc/dist && cross-env NODE_ENV=production webpack --config build/webpack.doc.js",
|
||||
"build:js": "npm run generate-version && npm run clean && rollup -c",
|
||||
"build:package": "npm run generate-version && npm run clean && node build/build-fonts.js && node build/build-icons.js && rollup -c",
|
||||
"build:site": "npm run generate-version && npm run build:package && rm -rf dist && cross-env NODE_ENV=production vite build",
|
||||
"build:doc": "npm run generate-version && npm run build && rm -rf build-doc/dist && cross-env NODE_ENV=production webpack --config build/webpack.doc.js",
|
||||
"clean": "rm -rf lib && rm -rf es && rm -rf dist",
|
||||
"demo": "npm run generate && cross-env NODE_ENV=production webpack-dev-server --config build/webpack.demo.js",
|
||||
"dev": "npm run generate && cross-env NODE_ENV=development webpack-dev-server --config build/webpack.dev.js",
|
||||
"dev": "npm run generate-version && cross-env NODE_ENV=development vite",
|
||||
"lint": "eslint --no-error-on-unmatched-pattern --fix \"src/**/*.{js,vue}\" \"test/**/*.{js,vue}\" \"build/**/*.{js,vue}\" \"demo/**/*.{js,vue}\" && stylelint \"src/_styles/**/*.scss\"",
|
||||
"lint:js": "eslint --no-error-on-unmatched-pattern --fix \"src/**/*.{js,vue}\" \"test/**/*.{js,vue}\" \"build/**/*.{js,vue}\" \"demo/**/*.{js,vue}\"",
|
||||
"lint:style": "stylelint \"src/_styles/**/*.scss\"",
|
||||
"release:package": "npm run build && npm publish",
|
||||
"release:package": "npm run build:package && npm publish",
|
||||
"test": "cross-env NODE_ENV=test jest",
|
||||
"init-cssr": "node scripts/create-cssr-scaffold.js",
|
||||
"generate": "npm run generate-version",
|
||||
"generate-version": "node scripts/generate-version",
|
||||
"dev:v3": "vite --https",
|
||||
"tusimple:dev": "npm run generate && cross-env NODE_ENV=development webpack-dev-server --config build/webpack.tusimple-dev.js",
|
||||
"tusimple:build:doc": "npm run generate && npm run build && rm -rf build-doc/dist && cross-env NODE_ENV=production webpack --config build/webpack.tusimple-doc.js",
|
||||
"tusimple:release:doc": "npm run tusimple:build:doc && node build-doc/generate-deploy-sh.js && sudo bash build-doc/deploy-doc.sh",
|
||||
|
@ -24,7 +24,7 @@ module.exports = {
|
||||
},
|
||||
define: {
|
||||
'process.env.NODE_ENV': `'${process.env.NODE_ENV}'`,
|
||||
'__DEV__': process.env !== 'production'
|
||||
'__DEV__': process.env.NODE_ENV !== 'production'
|
||||
},
|
||||
rollupPluginVueOptions: {
|
||||
include: /\.(vue|md|demo.md|demo-entry.md|entry)$/
|
||||
@ -45,5 +45,18 @@ module.exports = {
|
||||
}),
|
||||
rollupMdPlugin()
|
||||
]
|
||||
}
|
||||
},
|
||||
indexHtmlTransforms: [
|
||||
{
|
||||
apply: 'pre',
|
||||
transform ({ code }) {
|
||||
switch (process.env.NODE_ENV) {
|
||||
case 'production':
|
||||
return code.replace(/__INDEX__/, '/demo/index.prod.js')
|
||||
default:
|
||||
return code.replace(/__INDEX__/, '/demo/index.dev.js')
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
10
vue3.md
10
vue3.md
@ -297,7 +297,9 @@ placeable 进行了大调整
|
||||
- delegate with capture
|
||||
- unify composition
|
||||
- remove hollowoutable
|
||||
- vite-build
|
||||
- [ ] icons from `vicons`
|
||||
- [ ] fonts from `vfonts`
|
||||
- [x] vite-build
|
||||
- [x] rollup-build
|
||||
- [ ] wait for new version of rollup-plugin-vue,
|
||||
https://github.com/vuejs/rollup-plugin-vue/issues/408
|
||||
@ -316,3 +318,9 @@ placeable 进行了大调整
|
||||
deprecate
|
||||
`naive-ui/lib/icons` => `vicons`
|
||||
`naive-ui/es/icons` => `vicons`
|
||||
|
||||
- `vueuc`
|
||||
- `vooks`
|
||||
- `vicons`
|
||||
- `vfonts`
|
||||
- `css-render`
|
Loading…
Reference in New Issue
Block a user