Skip to content

Commit

Permalink
Merge branch 'main' into fix/bubble-ts
Browse files Browse the repository at this point in the history
  • Loading branch information
YumoImer authored Jan 7, 2025
2 parents 6e371f1 + 06ddc22 commit bf011dd
Show file tree
Hide file tree
Showing 16 changed files with 58 additions and 54 deletions.
2 changes: 2 additions & 0 deletions .dumi/theme/common/PeterCat.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Assistant } from '@petercatai/assistant';
import React from 'react';

import '@petercatai/assistant/style';

const PeterCat: React.FC = () => {
return (
<Assistant
Expand Down
5 changes: 2 additions & 3 deletions .dumi/theme/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { createHash } from 'crypto';
import fs from 'fs';
import path from 'path';
import createEmotionServer from '@emotion/server/create-instance';
import chalk from 'chalk';
import type { IApi, IRoute } from 'dumi';
import ReactTechStack from 'dumi/dist/techStacks/react';
import sylvanas from 'sylvanas';
Expand Down Expand Up @@ -126,9 +125,9 @@ class AntdReactTechStack extends ReactTechStack {

const resolve = (p: string): string => require.resolve(p);

const RoutesPlugin = (api: IApi) => {
const RoutesPlugin = async (api: IApi) => {
// const ssrCssFileName = `ssr-${Date.now()}.css`;

const chalk = await import('chalk').then((m) => m.default);
const writeCSSFile = (key: string, hashKey: string, cssString: string) => {
const fileName = `style-${key}.${getHash(hashKey)}.css`;

Expand Down
Binary file modified bun.lockb
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,7 @@ exports[`renders components/attachments/demo/overflow.tsx extend context correct
class="ant-segmented-item ant-segmented-item-selected"
>
<input
checked=""
class="ant-segmented-item-input"
type="radio"
/>
Expand Down
4 changes: 2 additions & 2 deletions components/attachments/demo/overflow.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## zh-CN

修改占位信息
控制附件超出区域长度时的展示方式

## en-US

Modify placeholder information.
Controls the layout of attachments when they exceed the area.
1 change: 0 additions & 1 deletion components/bubble/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ Often used when chatting.
<code src="./demo/list.tsx">Bubble List</code>
<code src="./demo/bubble-custom.tsx">Semantic Custom</code>
<code src="./demo/list-custom.tsx">Custom List Content</code>
<code src="./demo/gpt-vis.tsx">Using GPT-Vis to render charts</code>

## API

Expand Down
1 change: 0 additions & 1 deletion components/bubble/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ demo:
<code src="./demo/list.tsx">气泡列表</code>
<code src="./demo/bubble-custom.tsx">语义化自定义</code>
<code src="./demo/list-custom.tsx">自定义列表内容</code>
<code src="./demo/gpt-vis.tsx">使用 GPT-Vis 渲染图表</code>

## API

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1421,6 +1421,7 @@ exports[`renders components/thought-chain/demo/size.tsx extend context correctly
class="ant-radio-button ant-radio-button-checked"
>
<input
checked=""
class="ant-radio-button-input"
type="radio"
value="middle"
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"start": "tsx ./scripts/set-node-options.ts cross-env PORT=8001 dumi dev",
"pretest": "npm run version",
"test": "jest --config .jest.js --no-cache --collect-coverage",
"test:dekko": "node ./tests/dekko/index.test.js",
"test:dekko": "tsx ./tests/dekko/index.test.ts",
"test:image": "jest --config .jest.image.js --no-cache -i -u --forceExit",
"test:node": "npm run version && jest --config .jest.node.js --no-cache",
"test:package-diff": "antd-tools run package-diff",
Expand Down Expand Up @@ -111,7 +111,7 @@
"@microflash/rehype-figure": "^2.1.1",
"@npmcli/run-script": "^9.0.1",
"@octokit/rest": "^21.0.2",
"@petercatai/assistant": "^2.0.10",
"@petercatai/assistant": "^2.0.13",
"@qixian.cs/github-contributors-list": "^2.0.2",
"@rc-component/father-plugin": "1.2.0-alpha.0",
"@rc-component/trigger": "^2.2.3",
Expand Down Expand Up @@ -164,7 +164,7 @@
"axios": "^1.7.7",
"browserslist": "^4.23.3",
"browserslist-to-esbuild": "^2.1.1",
"chalk": "^4.1.2",
"chalk": "^5.4.1",
"cheerio": "^1.0.0",
"circular-dependency-plugin": "^5.2.2",
"cli-progress": "^3.12.0",
Expand All @@ -181,6 +181,7 @@
"father": "4.5.1-beta.4",
"fetch-jsonp": "^1.3.0",
"fs-extra": "^11.2.0",
"react-intl": "7.0.4",
"gh-pages": "^6.1.1",
"glob": "^11.0.0",
"happy-dom": "^16.0.0",
Expand Down Expand Up @@ -282,4 +283,4 @@
"limit": "350 KiB"
}
]
}
}
4 changes: 2 additions & 2 deletions tests/dekko/dist.test.js → tests/dekko/dist.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const $ = require('dekko');
const chalk = require('chalk');
import chalk from 'chalk';
import $ from 'dekko';

$('dist').isDirectory().hasFile('antdx.js').hasFile('antdx.min.js').hasFile('antdx.min.js.map');

Expand Down
4 changes: 0 additions & 4 deletions tests/dekko/index.test.js

This file was deleted.

4 changes: 4 additions & 0 deletions tests/dekko/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './dist.test';
import './lib.test';
// Not applied yet
// import './use-client.test';
8 changes: 4 additions & 4 deletions tests/dekko/lib.test.js → tests/dekko/lib.test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
const $ = require('dekko');
const chalk = require('chalk');
import chalk from 'chalk';
import $ from 'dekko';

$('lib').isDirectory().hasFile('index.js').hasFile('index.d.ts');

$('lib/*')
.filter(
(filename) =>
(filename: string) =>
!filename.endsWith('index.js') &&
!filename.endsWith('index.d.ts') &&
!filename.endsWith('.map'),
)
.isDirectory()
.filter(
(filename) =>
(filename: string) =>
!filename.endsWith('style') &&
!filename.endsWith('_util') &&
!filename.endsWith('locale') &&
Expand Down
33 changes: 0 additions & 33 deletions tests/dekko/use-client.test.js

This file was deleted.

33 changes: 33 additions & 0 deletions tests/dekko/use-client.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import fs from 'node:fs';
import chalk from 'chalk';
import $ from 'dekko';

const includeUseClient = (filename: string) =>
fs.readFileSync(filename).toString().includes('"use client"');

if (process.env.LIB_DIR === 'dist') {
$('dist/*')
.isFile()
.assert("doesn't contain use client", (filename: string) => !includeUseClient(filename));
} else {
$('{es,lib}/index.js')
.isFile()
.assert('contain use client', (filename: string) => includeUseClient(filename));

$('{es,lib}/*/index.js')
.isFile()
.assert('contain use client', (filename: string) => includeUseClient(filename));

// check tsx files
$('{es,lib}/typography/*.js')
.isFile()
.assert('contain use client', (filename: string) => includeUseClient(filename));

$('{es,lib}/typography/Base/*.js')
.isFile()
.filter((filename: string) => !filename.endsWith('/util.js'))
.assert('contain use client', (filename: string) => includeUseClient(filename));
}

// eslint-disable-next-line no-console
console.log(chalk.green('✨ use client passed!'));
2 changes: 2 additions & 0 deletions typings/custom-typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ declare module '@npmcli/run-script' {
}

declare module '@microflash/rehype-figure';

declare module 'dekko';

0 comments on commit bf011dd

Please sign in to comment.