Skip to content

Commit

Permalink
perf: 优化打包输出目录
Browse files Browse the repository at this point in the history
  • Loading branch information
jsxiaosi committed Dec 7, 2021
1 parent a15026f commit 595170e
Show file tree
Hide file tree
Showing 15 changed files with 33 additions and 33 deletions.
4 changes: 2 additions & 2 deletions build/rollup.config.dts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { terser } from 'rollup-plugin-terser'
import typescript from 'rollup-plugin-typescript2'
import vue from 'rollup-plugin-vue' // 处理vue文件
import { resolve } from 'path'
const input = resolve(__dirname, '../packages') // 入口文件
const output = resolve(__dirname, '../lib') // 输出文件
const input = resolve(__dirname, '../packages/components') // 入口文件
const output = resolve(__dirname, '../lib/components') // 输出文件
const config = [
{
input: `${input}/index.ts`,
Expand Down
6 changes: 3 additions & 3 deletions build/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import typescript from 'rollup-plugin-typescript2'
import vue from 'rollup-plugin-vue' // 处理vue文件
import { readdirSync } from 'fs' // 写文件
import { resolve } from 'path'
const input = resolve(__dirname, '../packages') // 入口文件
const output = resolve(__dirname, '../lib') // 输出文件
const input = resolve(__dirname, '../packages/components') // 入口文件
const output = resolve(__dirname, '../lib/components') // 输出文件
const config = readdirSync(input)
.filter((name) => !['theme-default', 'index.ts', 'types.ts'].includes(name))
.filter((name) => !['theme-default', 'index.ts', 'types.ts'].includes(name)) //过滤当前目录下的目录和文件
.map((name) => ({
input: `${input}/${name}/index.ts`,
external: ['vue'],
Expand Down
2 changes: 1 addition & 1 deletion docs/components/button.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# button 文档

<script setup>
import IButton from '../../packages/button'
import IButton from '../../packages/components/button'

</script>
<IButton/>
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/button/index.js → lib/components/button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
}

script.render = render
script.__file = 'packages/button/src/index.vue'
script.__file = 'packages/components/button/src/index.vue'

script.install = (app) => {
app.component(script.name, script)
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions lib/index.d.ts → lib/components/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ declare const _default: {
unshift(...items: any[]): number
indexOf(searchElement: any, fromIndex?: number | undefined): number
lastIndexOf(searchElement: any, fromIndex?: number | undefined): number
every<S>(
every<S extends any>(
predicate: (value: any, index: number, array: any[]) => value is S,
thisArg?: any
): this is S[]
Expand All @@ -39,7 +39,7 @@ declare const _default: {
callbackfn: (value: any, index: number, array: any[]) => U,
thisArg?: any
): U[]
filter<S_1>(
filter<S_1 extends any>(
predicate: (value: any, index: number, array: any[]) => value is S_1,
thisArg?: any
): S_1[]
Expand Down Expand Up @@ -99,7 +99,7 @@ declare const _default: {
) => U_2,
initialValue: U_2
): U_2
find<S_2>(
find<S_2 extends any>(
predicate: (
this: void,
value: any,
Expand Down
22 changes: 22 additions & 0 deletions lib/components/index.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import {
defineComponent as n,
openBlock as t,
createElementBlock as o,
} from 'vue'
var e = n({ name: 'IButton', props: {}, setup() {} })
;(e.render = function (n, e, a, r, u, s) {
return t(), o('button', null, '这个是一个自定义组件来的')
}),
(e.__file = 'packages/components/button/src/index.vue'),
(e.install = (n) => {
n.component(e.name, e)
})
const a = e,
r = [a]
var u = {
install: function (n) {
r.forEach((t) => n.component(t.name, t))
},
...r,
}
export { a as IButton, u as default }
2 changes: 1 addition & 1 deletion lib/index.js → lib/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
}

script.render = render
script.__file = 'packages/button/src/index.vue'
script.__file = 'packages/components/button/src/index.vue'

script.install = (app) => {
app.component(script.name, script)
Expand Down
File renamed without changes.
22 changes: 0 additions & 22 deletions lib/index.esm.js

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 595170e

Please sign in to comment.