From e6908d58bf371d845305ed2eeffecf2264eff689 Mon Sep 17 00:00:00 2001 From: Aaron Date: Fri, 20 Sep 2024 17:29:22 +0800 Subject: [PATCH] chore: update build target and version (#6355) * chore: setup build target to es6 * chore: update version * docs: update site docs --------- Co-authored-by: antv --- packages/cli/CHANGELOG.md | 7 +++++ packages/cli/package.json | 2 +- packages/cli/template-extension/tsconfig.json | 2 +- packages/g6-extension-3d/package.json | 2 +- packages/g6-extension-react/package.json | 2 +- packages/g6/CHANGELOG.md | 6 +++++ packages/g6/package.json | 2 +- packages/g6/src/version.ts | 2 +- .../docs/manual/feature-common/webpack4.md | 27 +++++++++++++++++++ .../docs/manual/further-reading/bundle.en.md | 17 +++++++++--- .../docs/manual/further-reading/bundle.zh.md | 17 +++++++++--- tsconfig.json | 2 +- 12 files changed, 75 insertions(+), 13 deletions(-) create mode 100644 packages/cli/CHANGELOG.md create mode 100644 packages/site/docs/manual/feature-common/webpack4.md diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md new file mode 100644 index 00000000000..98cf0cbcccb --- /dev/null +++ b/packages/cli/CHANGELOG.md @@ -0,0 +1,7 @@ +# @antv/g6-cli + +## 0.0.2 + +### Patch Changes + +- chore, feat, bugfix diff --git a/packages/cli/package.json b/packages/cli/package.json index c2a18fb5926..aa3b032c886 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g6-cli", - "version": "0.0.1", + "version": "0.0.2", "description": "Scaffolding Your Extension for G6", "keywords": [ "antv", diff --git a/packages/cli/template-extension/tsconfig.json b/packages/cli/template-extension/tsconfig.json index 23e764ebcfb..5b97f87b8aa 100644 --- a/packages/cli/template-extension/tsconfig.json +++ b/packages/cli/template-extension/tsconfig.json @@ -17,7 +17,7 @@ "sourceMap": true, "sourceRoot": "src", "strict": true, - "target": "esnext", + "target": "ES6", "types": ["@types/jest", "node"], "paths": { "@/*": ["./*"], diff --git a/packages/g6-extension-3d/package.json b/packages/g6-extension-3d/package.json index 915d4d81364..0a89eee963b 100644 --- a/packages/g6-extension-3d/package.json +++ b/packages/g6-extension-3d/package.json @@ -49,7 +49,7 @@ "peerDependencies": { "@antv/g": "^6.0.13", "@antv/g-canvas": "^2.0.4", - "@antv/g6": "^5.0.22" + "@antv/g6": "^5.0.23" }, "publishConfig": { "access": "public", diff --git a/packages/g6-extension-react/package.json b/packages/g6-extension-react/package.json index e0b5892c56e..3a972b7f221 100644 --- a/packages/g6-extension-react/package.json +++ b/packages/g6-extension-react/package.json @@ -51,7 +51,7 @@ "styled-components": "^6.1.13" }, "peerDependencies": { - "@antv/g6": "^5.0.22", + "@antv/g6": "^5.0.23", "react": ">=16.8", "react-dom": ">=16.8" }, diff --git a/packages/g6/CHANGELOG.md b/packages/g6/CHANGELOG.md index fa16c60e620..f46e312a630 100644 --- a/packages/g6/CHANGELOG.md +++ b/packages/g6/CHANGELOG.md @@ -1,5 +1,11 @@ # @antv/g6 +## 5.0.23 + +### Patch Changes + +- chore, feat, bugfix + ## 5.0.22 ### Patch Changes diff --git a/packages/g6/package.json b/packages/g6/package.json index 30b6285669f..6555758bd03 100644 --- a/packages/g6/package.json +++ b/packages/g6/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g6", - "version": "5.0.22", + "version": "5.0.23", "description": "A Graph Visualization Framework in JavaScript", "keywords": [ "antv", diff --git a/packages/g6/src/version.ts b/packages/g6/src/version.ts index 9e4e1694162..68731ce0129 100644 --- a/packages/g6/src/version.ts +++ b/packages/g6/src/version.ts @@ -1 +1 @@ -export const version = '5.0.22'; +export const version = '5.0.23'; diff --git a/packages/site/docs/manual/feature-common/webpack4.md b/packages/site/docs/manual/feature-common/webpack4.md new file mode 100644 index 00000000000..b8fa966d4d0 --- /dev/null +++ b/packages/site/docs/manual/feature-common/webpack4.md @@ -0,0 +1,27 @@ +```js +module.exports = { + entry: './src/index.js', + output: { + path: path.resolve(__dirname, 'dist'), + filename: 'index.js', + }, + module: { + rules: [ + { + test: /\.js$/, + use: { + loader: 'babel-loader', + options: { + presets: ['@babel/preset-env'], + }, + }, + }, + { + test: /\.js$/, + loader: '@open-wc/webpack-import-meta-loader', + }, + ], + }, + mode: 'production', +}; +``` diff --git a/packages/site/docs/manual/further-reading/bundle.en.md b/packages/site/docs/manual/further-reading/bundle.en.md index d1b68828d03..abfeac6e41e 100644 --- a/packages/site/docs/manual/further-reading/bundle.en.md +++ b/packages/site/docs/manual/further-reading/bundle.en.md @@ -40,10 +40,21 @@ npx webpack > The above configuration works with `"webpack": "^5.94.0"`, `"webpack-cli": "^5.1.4"`. -If your Webpack version is lower, you may need to add additional loaders: +:::error{title=Webpack4} +⚠️ It is strongly recommended that projects use Webpack 5. If you are using Webpack 4, follow the steps below to configure: -- `ts-loader`: Used to load TypeScript files -- `@babel/plugin-transform-class-properties`: Used to transform properties of TypeScript classes +1. Install the necessary dependencies: `babel-loader` (<9), `@babel/preset-env`, `@open-wc/webpack-import-meta-loader` + +> If you are using TypeScript, you also need to install `ts-loader`. + +```bash +npm install babel-loader@8 @babel/preset-env @open-wc/webpack-import-meta-loader --save-dev +``` + +2. Modify the `webpack.config.js` configuration: + + +::: ## Bundle Project with Rollup diff --git a/packages/site/docs/manual/further-reading/bundle.zh.md b/packages/site/docs/manual/further-reading/bundle.zh.md index 66a144e3d30..c8093339395 100644 --- a/packages/site/docs/manual/further-reading/bundle.zh.md +++ b/packages/site/docs/manual/further-reading/bundle.zh.md @@ -40,10 +40,21 @@ npx webpack > 上述配置在:"webpack": "^5.94.0","webpack-cli": "^5.1.4" 可以正常工作。 -如果你的 webpack 版本较低,可能需要添加额外的 loader: +:::error{title=Webpack4} +⚠️ 强烈建议项目使用 Webpack 5,如果你使用的是 Webpack 4,按以下步骤配置: -- `ts-loader`:用于加载 TypeScript 文件 -- `@babel/plugin-transform-class-properties`:用于转换 TypeScript 类的属性 +1. 安装相关依赖:babel-loader(<9)、@babel/preset-env、@open-wc/webpack-import-meta-loader + +> 如果你使用的 typescript,还需要安装 ts-loader + +```bash +npm install babel-loader@8 @babel/preset-env @open-wc/webpack-import-meta-loader --save-dev +``` + +2. 修改 `webpack.config.js` 配置: + + +::: ## 使用 Rollup 打包项目 diff --git a/tsconfig.json b/tsconfig.json index d25ceb5c715..41117c29c5b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,7 +12,7 @@ "skipLibCheck": true, "sourceMap": true, "strict": true, - "target": "esnext", + "target": "ES6", "types": ["node", "@types/jest"] }, "exclude": ["node_modules"]