From 48a3ceb92158a3c9a6212e700f8c6d71b7cc90d8 Mon Sep 17 00:00:00 2001 From: extclp <2842417407@qq.com> Date: Mon, 22 Apr 2024 15:27:58 +0800 Subject: [PATCH] chore: remove vetur type generator (#7517) --- antd-tools/generator-types/src/index.ts | 8 ------- antd-tools/generator-types/src/type.ts | 19 ---------------- antd-tools/generator-types/src/vetur.ts | 30 ------------------------- 3 files changed, 57 deletions(-) delete mode 100644 antd-tools/generator-types/src/vetur.ts diff --git a/antd-tools/generator-types/src/index.ts b/antd-tools/generator-types/src/index.ts index 4b1e3d43f..12d2bc98b 100644 --- a/antd-tools/generator-types/src/index.ts +++ b/antd-tools/generator-types/src/index.ts @@ -6,7 +6,6 @@ import { genWebTypes } from './web-types'; import { outputFileSync, readFileSync } from 'fs-extra'; import type { Options, VueTag } from './type'; import { getComponentName, normalizePath, toKebabCase } from './utils'; -import { genVeturAttributes, genVeturTags } from './vetur'; import { flatMap } from 'lodash'; async function readMarkdown(options: Options): Promise> { @@ -78,13 +77,6 @@ export async function parseAndWrite(options: Options): Promise { const tagsFromTypings = await readTypings(options); const tags = mergeTags([tagsFromMarkdown, tagsFromTypings]); const webTypes = genWebTypes(tags, options); - const veturTags = genVeturTags(tags); - const veturAttributes = genVeturAttributes(tags); - outputFileSync(join(options.outputDir, 'tags.json'), JSON.stringify(veturTags, null, 2)); - outputFileSync( - join(options.outputDir, 'attributes.json'), - JSON.stringify(veturAttributes, null, 2), - ); outputFileSync(join(options.outputDir, 'web-types.json'), JSON.stringify(webTypes, null, 2)); return tags.length; } diff --git a/antd-tools/generator-types/src/type.ts b/antd-tools/generator-types/src/type.ts index faf2ed939..6be1c0ba5 100644 --- a/antd-tools/generator-types/src/type.ts +++ b/antd-tools/generator-types/src/type.ts @@ -34,25 +34,6 @@ export type VueTag = { description?: string; }; -export type VeturTag = { - description?: string; - attributes: string[]; -}; - -export type VeturTags = Record; - -export type VeturAttribute = { - type: string; - description: string; -}; - -export type VeturAttributes = Record; - -export type VeturResult = { - tags: VeturTags; - attributes: VeturAttributes; -}; - export type Options = { name: string; path: PathLike; diff --git a/antd-tools/generator-types/src/vetur.ts b/antd-tools/generator-types/src/vetur.ts deleted file mode 100644 index da3445823..000000000 --- a/antd-tools/generator-types/src/vetur.ts +++ /dev/null @@ -1,30 +0,0 @@ -import type { VueTag, VeturTags, VeturAttributes } from './type'; - -export function genVeturTags(tags: VueTag[]) { - const veturTags: VeturTags = {}; - - tags.forEach(tag => { - veturTags[tag.name] = { - attributes: tag.attributes ? tag.attributes.map(item => item.name) : [], - }; - }); - - return veturTags; -} - -export function genVeturAttributes(tags: VueTag[]) { - const veturAttributes: VeturAttributes = {}; - - tags.forEach(tag => { - if (tag.attributes) { - tag.attributes.forEach(attr => { - veturAttributes[`${tag.name}/${attr.name}`] = { - type: attr.value.type, - description: `${attr.description}, Default: ${attr.default}`, - }; - }); - } - }); - - return veturAttributes; -}