[更新] 打包配置
This commit is contained in:
parent
7fb98b058b
commit
3324ac6ddf
53
.helperrc.js
53
.helperrc.js
@ -1,53 +0,0 @@
|
|||||||
const helper = require('components-helper')
|
|
||||||
const { name, version } = require('./package.json')
|
|
||||||
|
|
||||||
helper({
|
|
||||||
name,
|
|
||||||
version,
|
|
||||||
entry: 'docs/docs/en-US/components/*.md',
|
|
||||||
outDir: 'lib',
|
|
||||||
reComponentName,
|
|
||||||
reDocUrl,
|
|
||||||
reAttribute,
|
|
||||||
titleRegExp: '#+\\s+(.*)\n+>\\s*([^(#|\\n)]*)',
|
|
||||||
tableRegExp:
|
|
||||||
'#+\\s+(.*\\s*Props|.*\\s*Events|.*\\s*Slots|.*\\s*Directives)\\s*\\n+(\\|?.+\\|.+)\\n\\|?\\s*:?-+:?\\s*\\|.+((\\n\\|?.+\\|.+)+)',
|
|
||||||
})
|
|
||||||
|
|
||||||
function reComponentName(title) {
|
|
||||||
return 'ele-' + title.replace(/\B([A-Z])/g, '-$1').toLowerCase()
|
|
||||||
}
|
|
||||||
|
|
||||||
function reDocUrl(fileName, header) {
|
|
||||||
// TODO: `zh-CN` -> `en-US`
|
|
||||||
const docs = 'https://gitee.com/Jmysy/layui-vue'
|
|
||||||
const _header = header ? header.replace(/[ ]+/g, '-') : undefined
|
|
||||||
return docs + fileName + (_header ? '#' + header : '')
|
|
||||||
}
|
|
||||||
|
|
||||||
function reAttribute(value, key) {
|
|
||||||
if (key === 'Name' && /^(-|—)$/.test(value)) {
|
|
||||||
return 'default'
|
|
||||||
} else if (key === 'Name' && /v-model:(.+)/.test(value)) {
|
|
||||||
const _value = value.match(/v-model:(.+)/)
|
|
||||||
return _value ? _value[1] : undefined
|
|
||||||
} else if (key === 'Name' && /v-model/.test(value)) {
|
|
||||||
return 'model-value'
|
|
||||||
} else if (key === 'Name') {
|
|
||||||
return value.replace(/\B([A-Z])/g, '-$1').toLowerCase()
|
|
||||||
} else if (key === 'Type') {
|
|
||||||
return value
|
|
||||||
.replace(/\s*\/\s*/g, '|')
|
|
||||||
.replace(/\s*,\s*/g, '|')
|
|
||||||
.replace(/\(.*\)/g, '')
|
|
||||||
.toLowerCase()
|
|
||||||
} else if (value === '' || /^(-|—)$/.test(value)) {
|
|
||||||
return undefined
|
|
||||||
} else if (key === 'Options') {
|
|
||||||
return /\[.+\]\(.+\)/.test(value) || /^\*$/.test(value)
|
|
||||||
? undefined
|
|
||||||
: value.replace(/`/g, '')
|
|
||||||
} else {
|
|
||||||
return value
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
##### 介绍
|
|
||||||
|
|
||||||
<lay-block>
|
|
||||||
layui(谐音:类 UI) 是一套开源的 Web UI 解决方案
|
|
||||||
</lay-block>
|
|
13
package.json
13
package.json
@ -12,12 +12,11 @@
|
|||||||
"./lib/": "./lib/"
|
"./lib/": "./lib/"
|
||||||
},
|
},
|
||||||
"types": "types/index.d.ts",
|
"types": "types/index.d.ts",
|
||||||
"style": "lib/style.css",
|
"style": "lib/layui-vue.css",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vite build --emptyOutDir && npm run build:helper && npm run build:types",
|
"build": "vite build --emptyOutDir && npm run build:types",
|
||||||
"build:types": "rimraf types && tsc -d",
|
"build:types": "rimraf types && tsc -d",
|
||||||
"build:helper": "node .helperrc.js",
|
|
||||||
"build:docs": "vite build docs",
|
"build:docs": "vite build docs",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"lint": "eslint . --fix --ext .ts,.vue,.js --ignore-pattern \"/lib/\" --ignore-pattern \"/types/\"",
|
"lint": "eslint . --fix --ext .ts,.vue,.js --ignore-pattern \"/lib/\" --ignore-pattern \"/types/\"",
|
||||||
@ -32,7 +31,7 @@
|
|||||||
"layui",
|
"layui",
|
||||||
"vue"
|
"vue"
|
||||||
],
|
],
|
||||||
"author": "<就眠仪式 jmys1992@gmail.com>",
|
"author": "就眠儀式",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://gitee.com/Jmysy/layui-vue/issues"
|
"url": "https://gitee.com/Jmysy/layui-vue/issues"
|
||||||
@ -60,7 +59,6 @@
|
|||||||
"@vue/server-renderer": "^3.1.1",
|
"@vue/server-renderer": "^3.1.1",
|
||||||
"@vue/test-utils": "^2.0.0-rc.6",
|
"@vue/test-utils": "^2.0.0-rc.6",
|
||||||
"babel-jest": "^26.6.3",
|
"babel-jest": "^26.6.3",
|
||||||
"components-helper": "^1.0.3",
|
|
||||||
"escape-html": "^1.0.3",
|
"escape-html": "^1.0.3",
|
||||||
"eslint": "^7.25.0",
|
"eslint": "^7.25.0",
|
||||||
"eslint-plugin-prettier": "^3.4.0",
|
"eslint-plugin-prettier": "^3.4.0",
|
||||||
@ -81,11 +79,6 @@
|
|||||||
"vite-plugin-md": "^0.6.3",
|
"vite-plugin-md": "^0.6.3",
|
||||||
"vue-jest": "^5.0.0-alpha.8"
|
"vue-jest": "^5.0.0-alpha.8"
|
||||||
},
|
},
|
||||||
"vetur": {
|
|
||||||
"tags": "lib/tags.json",
|
|
||||||
"attributes": "lib/attributes.json"
|
|
||||||
},
|
|
||||||
"web-types": "lib/web-types.json",
|
|
||||||
"files": [
|
"files": [
|
||||||
"lib",
|
"lib",
|
||||||
"types"
|
"types"
|
||||||
|
@ -10,11 +10,21 @@
|
|||||||
"emitDeclarationOnly": true,
|
"emitDeclarationOnly": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"declarationDir": "types",
|
"declarationDir": "types",
|
||||||
"lib": ["ESNext", "DOM"],
|
"lib": [
|
||||||
|
"ESNext",
|
||||||
|
"DOM"
|
||||||
|
],
|
||||||
"paths": {
|
"paths": {
|
||||||
"/@src/*": ["./src/*"]
|
"/@src/*": [
|
||||||
|
"./src/*"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": ["src/**/*", "shims-vue.d.ts"],
|
"include": [
|
||||||
"exclude": ["node_modules"]
|
"src/**/*",
|
||||||
}
|
"shims-vue.d.ts"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"node_modules"
|
||||||
|
]
|
||||||
|
}
|
@ -3,6 +3,7 @@ import { defineConfig } from 'vite'
|
|||||||
import babel from 'rollup-plugin-babel'
|
import babel from 'rollup-plugin-babel'
|
||||||
import { name } from './package.json'
|
import { name } from './package.json'
|
||||||
import plugins from './docs/src/plugin/common-plugins'
|
import plugins from './docs/src/plugin/common-plugins'
|
||||||
|
import { getSystemErrorMap } from 'util'
|
||||||
|
|
||||||
const camelize = (name: string) =>
|
const camelize = (name: string) =>
|
||||||
name.replace(/(^|-)(\w)/g, (a, b, c) => c.toUpperCase())
|
name.replace(/(^|-)(\w)/g, (a, b, c) => c.toUpperCase())
|
||||||
@ -20,7 +21,7 @@ export default defineConfig({
|
|||||||
lib: {
|
lib: {
|
||||||
entry: path.resolve(__dirname, 'src/index.ts'),
|
entry: path.resolve(__dirname, 'src/index.ts'),
|
||||||
name: camelize(name),
|
name: camelize(name),
|
||||||
},
|
},
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
output: {
|
output: {
|
||||||
exports: 'named',
|
exports: 'named',
|
||||||
@ -28,9 +29,8 @@ export default defineConfig({
|
|||||||
const name = id.replace(/^@/, '').split('/')[0]
|
const name = id.replace(/^@/, '').split('/')[0]
|
||||||
return camelize(name)
|
return camelize(name)
|
||||||
},
|
},
|
||||||
|
assetFileNames: `layui-vue.css`
|
||||||
},
|
},
|
||||||
external: (id: string) =>
|
|
||||||
/^(vue|@vue|element-plus|resize-observer-polyfill)/.test(id),
|
|
||||||
plugins: [
|
plugins: [
|
||||||
babel({
|
babel({
|
||||||
exclude: 'node_modules/**',
|
exclude: 'node_modules/**',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user