Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: mono repo move src to packages/components #3402

Merged
merged 8 commits into from
Mar 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ script/test/cypress
_site
temp*
static/
src/_common
packages/common
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ cypress-coverage
instrumented
cy-report
.history
src/**/_example-js/
packages/components/**/_example-js/
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "src/_common"]
path = src/_common
[submodule "packages/common"]
path = packages/common
url = https://github.com/Tencent/tdesign-common.git
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ npm run start

## 子仓库 tdesign-common

TDesign 的项目都会以子仓库的形式引入 `tdesign-common` 公共仓库,对应 `src/\_common` 文件夹,
TDesign 的项目都会以子仓库的形式引入 `tdesign-common` 公共仓库,对应 `packages/common` 文件夹,
公共仓库中包含

- 部分组件的一些框架无关的公共的工具函数
Expand All @@ -101,15 +101,15 @@ TDesign 的项目都会以子仓库的形式引入 `tdesign-common` 公共仓库
- 如开发部分提到的,初次克隆代码后需要初始化子仓库: `git submodule init && git submodule update`
- git submodule update 之后子仓库不指向任何分支,只是一个指向某一个提交的游离状态


### 涉及子仓库的开发

1. Fork 并克隆子仓库 https://github.com/Tencent/tdesign-common
2. 新建分支,并进行开发
3. 提交子仓库的 PR,等待代码合入
4. 如果仅涉及子仓库改动,项目维护方会通过评论触发 CI,自动更新主仓库的子仓库指向;

如果需要配合子仓库改动,需要在步骤 3 完成后,在主仓库的开发过程中,将子仓库的指向改为合并后的主干的 commit id,主仓库代码开发完后正常提交发起PR即可

如果需要配合子仓库改动,需要在步骤 3 完成后,在主仓库的开发过程中,将子仓库的指向改为合并后的主干的 commit id,主仓库代码开发完后正常提交发起 PR 即可

```bash
git submodule update --init --remote
```
Expand Down
6 changes: 3 additions & 3 deletions DEVELOP_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ tdesign-react 包含 web-react 代码和一个子仓库,子仓库指向 [tdesi

## 公共子仓库 tdesign-common

本项目以子仓库的形式引入 tdesign-common 公共仓库,对应 src/\_common 文件夹
本项目以子仓库的形式引入 tdesign-common 公共仓库,对应 packages/common 文件夹
公共仓库中包含

- 一些公共的工具函数
Expand Down Expand Up @@ -50,7 +50,7 @@ UI 开发规范参考子仓库 README [子仓库 README](https://github.com/Tenc

### API 规范

[API](./src/_common/api.md)
[API](./packages/common/api.md)

### 前缀

Expand Down Expand Up @@ -157,7 +157,7 @@ npm run init button

### 组件 Demo 演示配置

为了保证与 vue 等其他仓库演示文档内容统一,目前将公共基础演示 demo 与说明归档在 `src/_common/docs/web/api/[组件].md` 中,其中需要各个技术栈的组件提供文档里面所要求的基础 demo 文件否则会编译警告。
为了保证与 vue 等其他仓库演示文档内容统一,目前将公共基础演示 demo 与说明归档在 `packages/common/docs/web/api/[组件].md` 中,其中需要各个技术栈的组件提供文档里面所要求的基础 demo 文件否则会编译警告。

例如 `tooltip` 组件则需要 `_expample` 文件夹中包含有 `arrow.jsx`、 `noArrow.jsx` 文件

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@
"site:preview": "npm run build:jsx-demo && cd site && vite build --mode preview",
"postsite:preview": "cp _site/index.html _site/404.html",
"lint": "npm run lint:tsc && eslint --ext .ts,.tsx ./ --max-warnings 0",
"lint:fix": "eslint --ext .ts,.tsx ./src --ignore-pattern src/__tests__ --max-warnings 0 --fix",
"lint:fix": "eslint --ext .ts,.tsx ./packages/components --ignore-pattern packages/components/__tests__ --max-warnings 0 --fix",
"lint:tsc": "tsc -p ./tsconfig.dev.json ",
"generate:usage": "node script/generate-usage/index.js",
"generate:coverage-badge": "npm run test:coverage && node script/generate-coverage.js",
"generate:jsx-demo": "npx babel src/**/_example --extensions '.tsx' --config-file ./babel.config.demo.js --relative --out-dir ../_example-js --out-file-extension=.jsx",
"format:jsx-demo": "npx eslint src/**/_example-js/*.jsx --fix && npx prettier --write src/**/_example-js/*.jsx",
"generate:jsx-demo": "npx babel packages/components/**/_example --extensions '.tsx' --config-file ./babel.config.demo.js --relative --out-dir ../_example-js --out-file-extension=.jsx",
"format:jsx-demo": "npx eslint packages/components/**/_example-js/*.jsx --fix && npx prettier --write packages/components/**/_example-js/*.jsx",
"test": "vitest run && npm run test:snap",
"test:ui": "vitest --ui",
"test:snap": "cross-env NODE_ENV=test-snap vitest run",
Expand Down
1 change: 1 addition & 0 deletions packages/common
Submodule common added at f15c0c
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { ReactElement, ReactNode } from 'react';
import { isFunction } from 'lodash-es';
import { TNode } from '../common';
import log from '../_common/js/log';
import log from '../../common/js/log';

// 解析 TNode 数据结构
export default function parseTNode(
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions packages/components/affix/style/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '../../../common/style/web/components/affix/_index.less';
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions packages/components/alert/style/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '../../../common/style/web/components/alert/_index.less';
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions packages/components/anchor/style/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '../../../common/style/web/components/anchor/_index.less';
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useMemo, useState, useRef, MouseEvent, useEffect, useImperativeH
import classNames from 'classnames';
import { isFunction , escapeRegExp } from 'lodash-es';
import useConfig from '../hooks/useConfig';
import log from '../_common/js/log';
import log from '../../common/js/log';
import { CommonClassNameType } from '../hooks/useCommonClassName';
import { AutoCompleteOptionObj, TdAutoCompleteProps } from './type';
import HighlightOption from './HighlightOption';
Expand Down
1 change: 1 addition & 0 deletions packages/components/auto-complete/style/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '../../../common/style/web/components/auto-complete/_index.less';
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions packages/components/avatar/style/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '../../../common/style/web/components/avatar/_index.less';
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions packages/components/back-top/style/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '../../../common/style/web/components/back-top/_index.less';
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions packages/components/badge/style/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '../../../common/style/web/components/badge/_index.less';
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions packages/components/breadcrumb/style/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '../../../common/style/web/components/breadcrumb/_index.less';
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions packages/components/button/style/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '../../../common/style/web/components/button/_index.less';
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions packages/components/calendar/style/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '../../../common/style/web/components/calendar/_index.less';
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions packages/components/card/style/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '../../../common/style/web/components/card/_index.less';
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useState, useEffect, useMemo, useRef } from 'react';

import { isEqual, isFunction } from 'lodash-es';

import TreeStore from '../_common/js/tree-v1/tree-store';
import TreeStore from '../../common/js/tree-v1/tree-store';
import { getTreeValue, getCascaderValue, isEmptyValues, isValueInvalid } from './core/helper';
import { treeNodesEffect, treeStoreExpendEffect } from './core/effect';

Expand All @@ -17,7 +17,7 @@ import type {
CascaderValue,
} from './interface';

import type { TypeTreeNodeData } from '../_common/js/tree-v1/types';
import type { TypeTreeNodeData } from '../../common/js/tree-v1/types';
import { TreeOptionData } from '../common';

export const useCascaderContext = (props: TdCascaderProps) => {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { TdCascaderProps, CascaderValue, CascaderChangeSource } from './type';
import { TdSelectInputProps } from '../select-input/type';
import TreeStore from '../_common/js/tree-v1/tree-store';
import TreeNode from '../_common/js/tree-v1/tree-node';
import { TreeNodeModel, TreeNodeValue } from '../_common/js/tree-v1/types';
import TreeStore from '../../common/js/tree-v1/tree-store';
import TreeNode from '../../common/js/tree-v1/tree-node';
import { TreeNodeModel, TreeNodeValue } from '../../common/js/tree-v1/types';

export * from './type';
export interface CascaderContextType
Expand Down Expand Up @@ -34,9 +34,9 @@ export interface CascaderContextType
setExpend: (val: TreeNodeValue[]) => void;
}

export { TreeNode } from '../_common/js/tree-v1/tree-node';
export type { TreeNodeValue } from '../_common/js/tree-v1/types';
export type { TreeOptionData } from '../_common/js/common';
export { TreeNode } from '../../common/js/tree-v1/tree-node';
export type { TreeNodeValue } from '../../common/js/tree-v1/types';
export type { TreeOptionData } from '../../common/js/common';
export type { TreeNodeModel } from '../tree';
export type { TdSelectInputProps } from '../select-input/type';

Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions packages/components/cascader/style/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '../../../common/style/web/components/cascader/_index.less';
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading