Skip to content

Commit

Permalink
Merge branch 'next' into feat/vue-editable-sheet-next
Browse files Browse the repository at this point in the history
  • Loading branch information
wjgogogo authored Nov 20, 2024
2 parents eb31744 + 535c2aa commit 66a65c3
Show file tree
Hide file tree
Showing 720 changed files with 47,395 additions and 29,867 deletions.
7 changes: 6 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ module.exports = {
tabWidth: 2,
trailingComma: 'all',
printWidth: 80,
arrowParens: 'always',
proseWrap: 'never',
htmlWhitespaceSensitivity: 'css',
embeddedLanguageFormatting: 'auto',
singleAttributePerLine: false,
bracketSpacing: true,
overrides: [
{ files: '.eslintrc', options: { parser: 'json' } },
{ files: '.prettierrc', options: { parser: 'json' } },
Expand All @@ -57,7 +62,7 @@ module.exports = {
],
'import/no-duplicates': [2, { considerQueryString: true }],
'import/no-deprecated': 1,
'import/no-cycle': 1,
'import/no-cycle': 2,
'import/order': [
2,
{
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ jobs:
- name: Install dependencies
run: pnpm bootstrap:ci

- name: Build doctor
run: pnpm build:doctor

- name: Build
run: pnpm build

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/compressed-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ jobs:
- uses: preactjs/compressed-size-action@v2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
pattern: "./packages/{s2-core,s2-react,s2-vue}/dist/**/*.{js,css}"
build-script: "build:umd"
pattern: "./packages/{s2-core,s2-react,s2-react-components,s2-vue}/dist/**/*.{js,css}"
build-script: "build"
clean-script: "clean"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ packages/s2-*/dist/
packages/s2-*/temp/
packages/s2-*/coverage/
packages/s2-*/stats.html
packages/**/*.css

.swc
6 changes: 5 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@

"我代码水平不行", "会不会受到鄙视?", "会不会不太好?", 放心,不存在的!

我们欢迎任何形式的贡献,不管是一个**错别字的修改**,还是**一次友好的建议**,不管是通过提交 [Issue](https://github.com/antvis/S2/issues/new/choose), 还是一个帅气 [pull request](https://github.com/antvis/S2/pulls), 亦或是一次钉钉群的讨论,参与 [discussions](https://github.com/antvis/S2/discussions) 的讨论,期待在 [贡献者列表](https://github.com/antvis/S2/graphs/contributors) 里看见你的头像。
我们欢迎任何形式的贡献,不管是一个**错别字的修改**,还是**一次友好的建议**,不管是通过提交 [Issue](https://github.com/antvis/S2/issues/new/choose), 还是一个帅气 [pull request](https://github.com/antvis/S2/pulls), 亦或是参与 [discussions](https://github.com/antvis/S2/discussions) 的讨论。

这是一个开源项目,我们也有繁忙的业务要做,是用自己的业余时间在维护,为爱发电,精力有限,所以有时候 issue 响应速度不是那么及时。

如果你遇到了问题,或者对 Issues 和 Discussions 列表的问题感兴趣,可以直接认领并尝试修复,帮助 S2 变得更好,期待在 [贡献者列表](https://github.com/antvis/S2/graphs/contributors) 里看见你的头像。

## 分支管理

Expand Down
20 changes: 11 additions & 9 deletions README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ A practical visualization library for tabular analysis.

<p>
<a href="https://www.npmjs.com/package/@antv/s2" target="_blank">
<img src="https://img.badgesize.io/https:/unpkg.com/@antv/s2@next/dist/index.min.js?label=gzip%20size&compression=gzip" alt="npm bundle size" />
<img src="https://img.badgesize.io/https:/unpkg.com/@antv/s2/dist/s2.min.js?label=gzip%20size&compression=gzip" alt="npm bundle size" />
</a>
<a href="https://github.com/antvis/S2/discussions" target="_blank">
<img src="https://img.shields.io/badge/discussions-on%20github-blue" alt="GitHub discussions"/>
Expand Down Expand Up @@ -77,9 +77,9 @@ demo components and expansion capabilities, it allows developers to use it quick
## 📦 Installation

```bash
$ npm install @antv/s2@next --save
# yarn add @antv/s2@next
# pnpm add @antv/s2@next
$ npm install @antv/s2 --save
# yarn add @antv/s2
# pnpm add @antv/s2
```

## 🔨 Getting Started
Expand Down Expand Up @@ -208,11 +208,13 @@ bootstrap()

### 📦 Packages

| Package | Latest | Beta | Alpha | Next | Size | Download |
| - | - | - | - | - | - | - |
| [@antv/s2](https://github.com/antvis/S2/tree/next/packages/s2-core) | ![latest](https://img.shields.io/npm/v/@antv/s2/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2/next.svg) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2.svg) |
| [@antv/s2-react](https://github.com/antvis/S2/tree/next/packages/s2-react) | ![latest](https://img.shields.io/npm/v/@antv/s2-react/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2-react/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2-react/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2-react/next.svg)| ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-react@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-react.svg) |
| [@antv/s2-vue](https://github.com/antvis/S2/tree/next/packages/s2-vue) | ![latest](https://img.shields.io/npm/v/@antv/s2-vue/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2-vue/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2-vue/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2-vue/next.svg) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-vue@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-vue.svg) |
| Package | Latest | Next | Size | Download |
| - | - | - | - | - |
| -------- | ------ | --------- | ---------- | ------ |
| [@antv/s2](https://github.com/antvis/S2/tree/next/packages/s2-core) | ![latest](https://img.shields.io/npm/v/@antv/s2/latest.svg?logo=npm) | ![next](https://img.shields.io/npm/v/@antv/s2/next.svg?logo=npm) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2.svg?logo=npm) |
| [@antv/s2-react](https://github.com/antvis/S2/tree/next/packages/s2-react) | ![latest](https://img.shields.io/npm/v/@antv/s2-react/latest.svg?logo=npm) | ![next](https://img.shields.io/npm/v/@antv/s2-react/next.svg?logo=npm)| ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-react@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-react.svg?logo=npm) |
| [@antv/s2-react-components](https://github.com/antvis/S2/tree/next/packages/s2-react-components) | ![latest](https://img.shields.io/npm/v/@antv/s2-react-components/latest.svg?logo=npm) | ![next](https://img.shields.io/npm/v/@antv/s2-react-components/next.svg?logo=npm)| ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-react-components@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-react-components.svg?logo=npm) |
| [@antv/s2-vue](https://github.com/antvis/S2/tree/next/packages/s2-vue) | ![latest](https://img.shields.io/npm/v/@antv/s2-vue/latest.svg?logo=npm) | ![next](https://img.shields.io/npm/v/@antv/s2-vue/next.svg?logo=npm) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-vue@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-vue.svg?logo=npm) |

### 🖥️ Browser Compatibility

Expand Down
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

<p>
<a href="https://www.npmjs.com/package/@antv/s2" target="_blank">
<img src="https://img.badgesize.io/https:/unpkg.com/@antv/s2@next/dist/index.min.js?label=gzip%20size&compression=gzip" alt="npm bundle size" />
<img src="https://img.badgesize.io/https:/unpkg.com/@antv/s2/dist/s2.min.js?label=gzip%20size&compression=gzip" alt="npm bundle size" />
</a>
<a href="https://github.com/antvis/S2/discussions" target="_blank">
<img src="https://img.shields.io/badge/discussions-on%20github-blue" alt="GitHub discussions"/>
Expand Down Expand Up @@ -73,9 +73,9 @@ S2 是 AntV 在多维交叉分析表格领域的解决方案,完全基于数
## 📦 安装

```bash
$ npm install @antv/s2@next --save
# yarn add @antv/s2@next
# pnpm add @antv/s2@next
$ npm install @antv/s2 --save
# yarn add @antv/s2
# pnpm add @antv/s2
```

## 🔨 使用
Expand Down Expand Up @@ -204,11 +204,13 @@ bootstrap()

### 📦 版本

| Package | Latest | Beta | Alpha | Next | Size | Download |
| - | - | - | - | - | - | - |
| [@antv/s2](https://github.com/antvis/S2/tree/next/packages/s2-core) | ![latest](https://img.shields.io/npm/v/@antv/s2/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2/next.svg) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2.svg) |
| [@antv/s2-react](https://github.com/antvis/S2/tree/next/packages/s2-react) | ![latest](https://img.shields.io/npm/v/@antv/s2-react/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2-react/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2-react/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2-react/next.svg)| ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-react@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-react.svg) |
| [@antv/s2-vue](https://github.com/antvis/S2/tree/next/packages/s2-vue) | ![latest](https://img.shields.io/npm/v/@antv/s2-vue/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2-vue/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2-vue/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2-vue/next.svg) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-vue@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-vue.svg) |
| Package | Latest | Next | Size | Download |
| - | - | - | - | - |
| -------- | ------ | --------- | ---------- | ------ |
| [@antv/s2](https://github.com/antvis/S2/tree/next/packages/s2-core) | ![latest](https://img.shields.io/npm/v/@antv/s2/latest.svg?logo=npm) | ![next](https://img.shields.io/npm/v/@antv/s2/next.svg?logo=npm) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2.svg?logo=npm) |
| [@antv/s2-react](https://github.com/antvis/S2/tree/next/packages/s2-react) | ![latest](https://img.shields.io/npm/v/@antv/s2-react/latest.svg?logo=npm) | ![next](https://img.shields.io/npm/v/@antv/s2-react/next.svg?logo=npm)| ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-react@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-react.svg?logo=npm) |
| [@antv/s2-react-components](https://github.com/antvis/S2/tree/next/packages/s2-react-components) | ![latest](https://img.shields.io/npm/v/@antv/s2-react-components/latest.svg?logo=npm) | ![next](https://img.shields.io/npm/v/@antv/s2-react-components/next.svg?logo=npm)| ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-react-components@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-react-components.svg?logo=npm) |
| [@antv/s2-vue](https://github.com/antvis/S2/tree/next/packages/s2-vue) | ![latest](https://img.shields.io/npm/v/@antv/s2-vue/latest.svg?logo=npm) | ![next](https://img.shields.io/npm/v/@antv/s2-vue/next.svg?logo=npm) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-vue@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-vue.svg?logo=npm) |

### 🖥️ 兼容环境

Expand Down
163 changes: 163 additions & 0 deletions build.config.base.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
/* 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 = ({
aliasReact = false,
aliasReactComponents = false,
} = {}) => {
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'),
},
{
find: /^@antv\/s2\/extends$/,
replacement: path.join(__dirname, './packages/s2-core/src/extends'),
},
aliasReact && {
find: /^@antv\/s2-react$/,
replacement: path.join(__dirname, './packages/s2-react/src'),
},
aliasReactComponents && {
find: /^@antv\/s2-react-components$/,
replacement: path.join(
__dirname,
'./packages/s2-react-components/src',
),
},
].filter(Boolean),
);
}

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,
};
};
5 changes: 3 additions & 2 deletions jest.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,17 @@ module.exports = {
'\\.svg$': 'jest-raw-loader',
},
moduleNameMapper: {
'\\.svg$': '<rootDir>/__tests__/__mocks__/svg.ts',
'^@/(.*)': '<rootDir>/src/$1',
'^tests/(.*)': '<rootDir>/__tests__/$1',
'^@antv/s2$': path.join(__dirname, 'packages/s2-core/src'),
'^@antv/s2-shared$': path.join(__dirname, 'packages/s2-shared/src'),
'^@antv/s2/esm/(.*)$': path.join(__dirname, 'packages/s2-core/src/$1'),
'^@antv/s2/extends$': path.join(__dirname, 'packages/s2-core/src/extends'),
'^@antv/s2-react$': path.join(__dirname, 'packages/s2-react/src'),
'^@antv/s2-react-components$': path.join(
__dirname,
'packages/s2-react-components/src',
),
'\\.svg$': '<rootDir>/__tests__/__mocks__/svg.ts',
/* ignore module query: foo.less?a=1 -> foo.less */
'(.+)\\.(.+)\\?(.*)$': '$1.$2',
},
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"url": "https://github.com/antvis/S2.git"
},
"license": "MIT",
"files": [],
"scripts": {
"preinstall": "npx only-allow pnpm",
"bootstrap": "pnpm install",
Expand All @@ -32,6 +33,7 @@
"core:start": "pnpm --filter @antv/s2 start",
"core:watch": " pnpm --filter @antv/s2 watch",
"core:build": "pnpm --filter @antv/s2 build",
"core:build-esm": "pnpm --filter @antv/s2 build:esm",
"core:test": "pnpm --filter @antv/s2 test",
"core:test-coverage": "pnpm --filter @antv/s2 test:coverage",
"core:sync-event": "pnpm --filter @antv/s2 sync-event",
Expand All @@ -55,7 +57,7 @@
"build:umd": "pnpm -r --filter './packages/*' --stream build:umd",
"build:size-limit": "pnpm -r --filter './packages/*' --stream build:size-limit",
"build:size-limit-json": "pnpm -r --filter './packages/*' --stream build:size-limit-json",
"release": "pnpm -r --filter !@antv/s2-shared --filter !@antv/s2-site --filter !@antv/s2-react-components --workspace-concurrency=1 exec npx --no-install semantic-release",
"release": "pnpm -r --filter !@antv/s2-site --workspace-concurrency=1 exec npx --no-install semantic-release",
"release:preview": "pnpm release --dry-run --no-ci",
"release:bump-version": "node ./scripts/bump-version.js",
"test": "pnpm -r --filter './packages/*' --stream test",
Expand All @@ -77,7 +79,6 @@
"site:build": "NODE_OPTIONS='--max-old-space-size=4096' pnpm --filter @antv/s2-site build",
"site:preview": "pnpm --filter @antv/s2-site preview",
"site:deploy": "pnpm --filter @antv/s2-site deploy",
"share:test": "pnpm --filter @antv/s2-shared test",
"format": "prettier . --write"
},
"commitlint": {
Expand Down Expand Up @@ -162,7 +163,7 @@
"jest-url-loader": "^0.1.0",
"less": "^4.2.0",
"lint-staged": "^15.2.5",
"lodash-es": "^4.17.21",
"lodash": "^4.17.21",
"markdownlint-cli": "^0.41.0",
"npm-run-all": "^4.1.5",
"ora": "^8.0.1",
Expand Down
Loading

0 comments on commit 66a65c3

Please sign in to comment.