Browse Source

构建

master
1549469775 3 years ago
parent
commit
cbc44bbce9
  1. 7
      packages/build/buildAll.ts
  2. 7
      packages/build/buildComponent.ts
  3. 6
      packages/components/button/index.ts
  4. 25
      packages/components/button/index.vue
  5. 2
      packages/components/components.ts
  6. 1
      packages/playground/components.d.ts
  7. 3
      packages/playground/src/App.vue
  8. 3
      packages/theme-chalk/src/base.scss
  9. 9
      pnpm-lock.yaml

7
packages/build/buildAll.ts

@ -15,6 +15,10 @@ export default function (name: string) {
from: "@princess-ui/components", from: "@princess-ui/components",
to: "../", to: "../",
}, },
// {
// from: /\@princess\-ui\/theme-chalk\/src\/(.*?)\.scss/i,
// to: "princess-ui/theme-chalk/$1.css"
// }
], ],
}), }),
vue({ isProduction: true }), vue({ isProduction: true }),
@ -42,6 +46,9 @@ export default function (name: string) {
if (/^vue/.test(id)) { if (/^vue/.test(id)) {
return true return true
} }
if (/^princess-ui/.test(id)) {
return true
}
return false return false
}, },
output: [ output: [

7
packages/build/buildComponent.ts

@ -26,6 +26,11 @@ export default function (prefix: string, component: string, name: string, opts?:
from: "@princess-ui/components", from: "@princess-ui/components",
to: "princess-ui/lib", to: "princess-ui/lib",
}, },
// 考虑使用gulp进行替换,做成element类似的结构
// {
// from: /\@princess\-ui\/theme-chalk\/src\/(.*?)\.scss/i,
// to: "princess-ui/theme-chalk/$1.css"
// }
], ],
}), }),
// libInjectCss(), // libInjectCss(),
@ -67,7 +72,7 @@ export default function (prefix: string, component: string, name: string, opts?:
if (/^vue/.test(id)) { if (/^vue/.test(id)) {
return "Vue" return "Vue"
} }
if (new RegExp(/^princess-ui/).test(id)) { if (new RegExp(/^princess-ui\/lib/).test(id)) {
let str = id.replace(/^princess\-ui\/lib\//, prefix) let str = id.replace(/^princess\-ui\/lib\//, prefix)
str = str.slice(0, 2) + str.slice(2)[0].toUpperCase() + str.slice(3) str = str.slice(0, 2) + str.slice(2)[0].toUpperCase() + str.slice(3)
return str return str

6
packages/components/button/index.ts

@ -0,0 +1,6 @@
import PsButton from "./index.vue"
export {
PsButton
}
export default PsButton

25
packages/components/button/index.vue

@ -0,0 +1,25 @@
<template>
<div>ffffffffffff</div>
</template>
<script lang="ts">
export default defineComponent({
name: "ps-button"
})
</script>
<script lang="ts" setup>
import { defineComponent, onBeforeUnmount, ref } from "vue"
// const props = withDefaults(
// defineProps<{
// }>(),
// {
// },
// )
// const emits = defineEmits<{
// }>()
</script>

2
packages/components/components.ts

@ -1,5 +1,7 @@
// 该文件为自动生成,请勿修改!!! // 该文件为自动生成,请勿修改!!!
import PsButton from "./button"
import PsCaptcha from "./captcha" import PsCaptcha from "./captcha"
export { export {
PsButton,
PsCaptcha PsCaptcha
} }

1
packages/playground/components.d.ts

@ -6,6 +6,7 @@ import '@vue/runtime-core'
declare module '@vue/runtime-core' { declare module '@vue/runtime-core' {
export interface GlobalComponents { export interface GlobalComponents {
Panel: typeof import('./src/components/Panel.vue')['default'] Panel: typeof import('./src/components/Panel.vue')['default']
PsButton: typeof import('@princess-ui/components/button')['PsButton']
PsCaptcha: typeof import('@princess-ui/components/captcha')['PsCaptcha'] PsCaptcha: typeof import('@princess-ui/components/captcha')['PsCaptcha']
} }
} }

3
packages/playground/src/App.vue

@ -20,6 +20,9 @@ function send(start: () => void, done: (isDone: boolean) => void) {
<ps-captcha @send="send" border :duration="5">sada</ps-captcha> <ps-captcha @send="send" border :duration="5">sada</ps-captcha>
</div> </div>
</Panel> </Panel>
<Panel name="按钮">
<ps-button></ps-button>
</Panel>
</template> </template>
<style> <style>

3
packages/theme-chalk/src/base.scss

@ -0,0 +1,3 @@
*{
color: gainsboro;
}

9
pnpm-lock.yaml

@ -7,6 +7,7 @@ importers:
'@princess-ui/build': workspace:* '@princess-ui/build': workspace:*
'@princess-ui/components': workspace:* '@princess-ui/components': workspace:*
'@princess-ui/docs': workspace:* '@princess-ui/docs': workspace:*
'@princess-ui/hooks': workspace:*
'@princess-ui/playground': workspace:* '@princess-ui/playground': workspace:*
'@princess-ui/share': workspace:* '@princess-ui/share': workspace:*
'@princess-ui/theme-chalk': workspace:* '@princess-ui/theme-chalk': workspace:*
@ -22,6 +23,7 @@ importers:
'@princess-ui/build': link:packages/build '@princess-ui/build': link:packages/build
'@princess-ui/components': link:packages/components '@princess-ui/components': link:packages/components
'@princess-ui/docs': link:docs '@princess-ui/docs': link:docs
'@princess-ui/hooks': link:packages/hooks
'@princess-ui/playground': link:packages/playground '@princess-ui/playground': link:packages/playground
'@princess-ui/share': link:packages/share '@princess-ui/share': link:packages/share
'@princess-ui/theme-chalk': link:packages/theme-chalk '@princess-ui/theme-chalk': link:packages/theme-chalk
@ -67,6 +69,9 @@ importers:
packages/components: packages/components:
specifiers: {} specifiers: {}
packages/hooks:
specifiers: {}
packages/playground: packages/playground:
specifiers: specifiers:
'@types/lodash': ^4.14.182 '@types/lodash': ^4.14.182
@ -1199,6 +1204,7 @@ packages:
/commander/2.20.3: /commander/2.20.3:
resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==}
requiresBuild: true
dev: true dev: true
optional: true optional: true
@ -2261,7 +2267,7 @@ packages:
dev: false dev: false
/image-size/0.5.5: /image-size/0.5.5:
resolution: {integrity: sha1-Cd/Uq50g4p6xw+gLiZA3jfnjy5w=} resolution: {integrity: sha512-6TDAlDPZxUFCv+fuOkIoXT/V/f3Qbq8e37p+YOiYrUv3v9cc3/6x78VdfPgFVaB9dZYeLUfKgHRebpkm/oP2VQ==}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
hasBin: true hasBin: true
requiresBuild: true requiresBuild: true
@ -4315,6 +4321,7 @@ packages:
rollup: 2.74.1 rollup: 2.74.1
optionalDependencies: optionalDependencies:
fsevents: 2.3.2 fsevents: 2.3.2
dev: true
/vite/2.9.9_wcpnhpi5xopjmdpkm2r2ee7ige: /vite/2.9.9_wcpnhpi5xopjmdpkm2r2ee7ige:
resolution: {integrity: sha512-ffaam+NgHfbEmfw/Vuh6BHKKlI/XIAhxE5QSS7gFLIngxg171mg1P3a4LSRME0z2ZU1ScxoKzphkipcYwSD5Ew==} resolution: {integrity: sha512-ffaam+NgHfbEmfw/Vuh6BHKKlI/XIAhxE5QSS7gFLIngxg171mg1P3a4LSRME0z2ZU1ScxoKzphkipcYwSD5Ew==}

Loading…
Cancel
Save