From 1eeeb18c818051dc4e4f0699fef68a5d3fd43c39 Mon Sep 17 00:00:00 2001 From: Xc <124118265@qq.com> Date: Fri, 18 Nov 2022 10:40:52 +0800 Subject: [PATCH] chore: update gen script (#10641) Co-authored-by: zz <2418184580@qq.com> --- scripts/gc.sh | 59 +++++++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 25 deletions(-) diff --git a/scripts/gc.sh b/scripts/gc.sh index 9d5ddd5c4f..b9c86deb85 100755 --- a/scripts/gc.sh +++ b/scripts/gc.sh @@ -30,50 +30,59 @@ mkdir -p "$DIRNAME" mkdir -p "$DIRNAME/src" mkdir -p "$DIRNAME/__tests__" -cat > $DIRNAME/src/index.vue < $DIRNAME/src/$INPUT_NAME.vue <
- +
- - +EOF + +cat > $DIRNAME/src/$INPUT_NAME.ts < +export type ${NAME}Instance = InstanceType EOF cat <"$DIRNAME/index.ts" -import { App } from 'vue' -import ${NAME} from './src/index.vue' +import { withInstall } from '@element-plus/utils' +import $NAME from './src/$INPUT_NAME.vue' -${NAME}.install = (app: App): void => { - app.component(${NAME}.name, ${NAME}) -} +export const El$NAME = withInstall($NAME) +export default El$NAME -export default ${NAME} +export * from './src/$INPUT_NAME' EOF -cat > $DIRNAME/__tests__/$INPUT_NAME.spec.ts < $DIRNAME/__tests__/$INPUT_NAME.test.tsx < { test('render test', () => { - const wrapper = mount($NAME, { - slots: { - default: AXIOM, - }, - }) + const wrapper = mount(() => <$NAME>{AXIOM}) + expect(wrapper.text()).toEqual(AXIOM) }) })