-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: s2-react 移除 antd 的依赖和部分基础组件, 相关分析组件迁移到 s2-react-components 中 (#…
…2887) * build: esm 模块按目录打包, 使用 bundless 的方式支持 tree shaking * build: 修复打包尺寸校验失败 * build: 自动打开分析工具 * refactor: 解决所有循环依赖问题 * build: 使用 bundless * docs: 新增变更文档 * chore: 修复 size-limit 错误 * chore: 移除别名配置 * build: 预编译 s2-shared, 解决 bundless 的问题 * build: 修复 react-components 和 vue 打包失败 * feat: s2-react 移除 antd 的依赖, 相关分析组件迁移到 s2-react-components 中 只保留 drill-down, pagination, tooltip 三个基础能力组件 BREAKING CHANGE: 移除 header props 参数 (不再内置行列切换, 导出, 高级排序), 移除 antd ConfigProvider 包裹 * feat: 移除 header * feat: 移除 SheetComponent 中的 Spin 组件 * feat: 移除分页组件 * docs: 更新文档 * feat: 解耦操作栏 Menu 组件 * feat: 移除编辑表的 Input 依赖 * feat: 迁移下钻组件 * docs: 更新文档 * docs: 完善分页文档 * docs: 完善导出文档 * docs: 调整目录结构 * refactor: 优化分页组件的使用方式 * docs: 完善导出和维度切换组件文档 * test: 迁移并修复 s2-react 中的分析组件单测 * test: 完善 s2-react-components 中高级排序/下钻/导出 单测 * feat: 完善 switcher 功能和单测 * feat: 统一入口文件风格 * test: 更新单测 * feat: 移除 s2-react 的 antd peerDependencies * chore: 更新 lock * docs: 更新文档 * docs: 完善文档和示例 * feat: 优化目录结构和文档合理性 * fix: 修复类型问题 * test: 调整单测路径 * feat: shared 包移动到 s2-core 中, 优化打包方式 * chore: 移除 s2-react-components 中的 shared 依赖 * chore: 移除 s2-vue 中的 shared 依赖 * test: 迁移 shared 单测 * docs: 完善文档 * fix: 修复布局错误 * build: 修复 umd 打包失败 * chore: 调整 size-limit * docs: 完善文档 * build: 使用 tsc 打包 * test: 修复单测 * build: 移除 father * build: 移除 father * chore: 修复 ci * test: 更新 jest 别名 * test: 修复 svg mock 不生效 * docs: 优化文档 * test: 修复单测 * test: 更新快照 * docs: 优化文档跳转效果和迁移文档 * docs: 优化 2.0-next => 2.0 迁移文档 * docs: 更新贡献指南 * chore: 移除无用开发依赖 * chore: 更新 lock * chore(ci): 尝试解决 CI 单测进程挂起的问题 * chore(ci): 尝试解决 CI 单测进程挂起的问题 --------- Co-authored-by: Wenjun Xu <[email protected]> Co-authored-by: 卿珂 <[email protected]>
- Loading branch information
1 parent
07357c1
commit 64e3882
Showing
499 changed files
with
7,161 additions
and
6,146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,5 +24,6 @@ packages/s2-*/dist/ | |
packages/s2-*/temp/ | ||
packages/s2-*/coverage/ | ||
packages/s2-*/stats.html | ||
packages/**/*.css | ||
|
||
.swc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
/* eslint-disable max-lines-per-function */ | ||
/* eslint-disable import/order */ | ||
import { viteCommonjs } from '@originjs/vite-plugin-commonjs'; | ||
import { toLower } from 'lodash'; | ||
import path from 'path'; | ||
import peerDepsExternal from 'rollup-plugin-peer-deps-external'; | ||
import { visualizer } from 'rollup-plugin-visualizer'; | ||
|
||
export const getBaseConfig = () => { | ||
const entry = './src/index.ts'; | ||
|
||
const OUT_DIR_NAME_MAP = { | ||
es: 'esm', | ||
cjs: 'lib', | ||
umd: 'dist', | ||
}; | ||
|
||
const format = process.env.FORMAT; | ||
const isAnalysisMode = process.env.ANALYSIS; | ||
const isDevMode = process.env.PLAYGROUND; | ||
const outDir = OUT_DIR_NAME_MAP[format]; | ||
const isUMD = format === 'umd'; | ||
const isESM = format === 'es'; | ||
|
||
const define = { | ||
'process.env.NODE_ENV': JSON.stringify( | ||
isDevMode ? 'development' : 'production', | ||
), | ||
}; | ||
|
||
const resolve = { | ||
mainFields: ['src', 'module', 'main'], | ||
alias: [], | ||
}; | ||
|
||
if (isDevMode) { | ||
// 防止开发模式下直接加载 s2-core 中的主题 less | ||
resolve.alias.push( | ||
...[ | ||
{ | ||
find: /^(.*)\/theme\/(.*)\.less$/, | ||
replacement: '$1/theme/$2.less?inline', | ||
}, | ||
{ | ||
find: /^@antv\/s2$/, | ||
replacement: path.join(__dirname, './packages/s2-core/src'), | ||
}, | ||
], | ||
); | ||
} | ||
|
||
const getViteConfig = ( | ||
{ port, name, libName, plugins } = { | ||
port: 3001, | ||
plugins: [], | ||
}, | ||
) => { | ||
const filename = isUMD ? `${toLower(name || libName)}.min` : '[name]'; | ||
|
||
return { | ||
server: { | ||
port, | ||
hmr: true, | ||
}, | ||
|
||
resolve, | ||
|
||
define: { | ||
'process.env.NODE_ENV': JSON.stringify( | ||
isDevMode ? 'development' : 'production', | ||
), | ||
}, | ||
|
||
plugins: [ | ||
peerDepsExternal(), | ||
!isDevMode && viteCommonjs(), | ||
isAnalysisMode && | ||
visualizer({ | ||
open: true, | ||
gzipSize: true, | ||
brotliSize: true, | ||
}), | ||
...plugins, | ||
].filter(Boolean), | ||
|
||
css: { | ||
preprocessorOptions: { | ||
less: { | ||
javascriptEnabled: true, | ||
}, | ||
}, | ||
modules: { | ||
/** | ||
* 样式小驼峰转化 | ||
* css: goods-list => tsx: goodsList | ||
*/ | ||
localsConvention: 'camelCase', | ||
}, | ||
}, | ||
|
||
build: { | ||
target: 'es2015', | ||
minify: isUMD ? 'esbuild' : false, | ||
sourcemap: true, | ||
lib: { | ||
name: libName, | ||
entry, | ||
formats: [format], | ||
}, | ||
outDir, | ||
rollupOptions: { | ||
output: { | ||
dir: outDir, | ||
entryFileNames: `${filename}.js`, | ||
assetFileNames: `${filename}.[ext]`, | ||
globals: { | ||
vue: 'Vue', | ||
react: 'React', | ||
'react-dom': 'ReactDOM', | ||
'@antv/s2': 'S2', | ||
'@antv/s2-react': 'S2React', | ||
lodash: '_', | ||
antd: 'antd', | ||
'ant-design-vue': 'antd', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
}; | ||
|
||
return { | ||
entry, | ||
getViteConfig, | ||
define, | ||
format, | ||
resolve, | ||
isAnalysisMode, | ||
outDir, | ||
OUT_DIR_NAME_MAP, | ||
isDevMode, | ||
isUMD, | ||
isESM, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.