From 261e7d085792cc72600e4862bc187e1a30f45175 Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Mon, 27 Feb 2023 11:00:19 +0800 Subject: [PATCH] chore: update token error --- antd-tools/generator-types/src/formatter.ts | 2 +- antd-tools/generator-types/src/index.ts | 3 ++- antd-tools/generator-types/src/parser.ts | 2 +- site/src/hooks/useSiteToken.ts | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/antd-tools/generator-types/src/formatter.ts b/antd-tools/generator-types/src/formatter.ts index 722077ecf..581ac46be 100644 --- a/antd-tools/generator-types/src/formatter.ts +++ b/antd-tools/generator-types/src/formatter.ts @@ -91,7 +91,7 @@ export function formatter( !tableTitle.includes('()') ) { const childTag: VueTag = { - name: getComponentName(tableTitle.replaceAll('.', '').replaceAll('/', ''), tagPrefix), + name: getComponentName(tableTitle.replace(/\.|\//g, ''), tagPrefix), slots: [], events: [], attributes: [], diff --git a/antd-tools/generator-types/src/index.ts b/antd-tools/generator-types/src/index.ts index c500b38e1..4b1e3d43f 100644 --- a/antd-tools/generator-types/src/index.ts +++ b/antd-tools/generator-types/src/index.ts @@ -7,6 +7,7 @@ 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> { const mdPaths = await glob(normalizePath(`${options.path}/**/*.md`)); @@ -22,7 +23,7 @@ async function readMarkdown(options: Options): Promise> { }) .filter(item => item) as VueTag[][]; const tags: Map = new Map(); - data.flatMap(item => item).forEach(mergedTag => mergeTag(tags, mergedTag)); + flatMap(data, item => item).forEach(mergedTag => mergeTag(tags, mergedTag)); return tags; } diff --git a/antd-tools/generator-types/src/parser.ts b/antd-tools/generator-types/src/parser.ts index 5a20559e5..59f7d2483 100644 --- a/antd-tools/generator-types/src/parser.ts +++ b/antd-tools/generator-types/src/parser.ts @@ -27,7 +27,7 @@ function readLine(input: string) { function splitTableLine(line: string) { line = line.replace(/\\\|/g, 'JOIN'); - const items = line.split('|').map(item => item.trim().replaceAll('JOIN', '|')); + const items = line.split('|').map(item => item.trim().replace(/JOIN/g, '|')); // remove pipe character on both sides items.pop(); diff --git a/site/src/hooks/useSiteToken.ts b/site/src/hooks/useSiteToken.ts index 5e4990dbf..81e7cd303 100644 --- a/site/src/hooks/useSiteToken.ts +++ b/site/src/hooks/useSiteToken.ts @@ -37,7 +37,7 @@ const useSiteToken = () => { () => { styleDom = styleDom || document.createElement('style'); const tokenValue = mergedToken.value.token; - const demoGridColor = token.colorPrimary; + const demoGridColor = token.value.colorPrimary; styleDom.innerHTML = ` :root { --header-height: ${tokenValue.headerHeight}px;