This is an automated email from the ASF dual-hosted git repository. sushuang pushed a commit to branch gh-pages in repository https://gitbox.apache.org/repos/asf/echarts-examples.git
commit bda4d6aa756e35d53afa35cb35e09eea01e19569 Author: 100pah <sushuang0...@gmail.com> AuthorDate: Tue Sep 13 01:45:08 2022 +0800 fix: make the build guide clear in README.md --- README.md | 139 ++++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 80 insertions(+), 59 deletions(-) diff --git a/README.md b/README.md index d2c73149..7d84a7ee 100644 --- a/README.md +++ b/README.md @@ -6,26 +6,10 @@ npm install ``` -## Dev -```shell -npm run dev -``` - -## Release - -```shell -npm run release -``` +## Edit examples -It will copy all the build resources to echarts-website/next/examples - -## Use local echarts build - -1. Update the URL of localEChartsMinJS in `common/config.js` -2. Add `local=1` in URL. For example: `editor.html?c=area-basic&local=1` - -## Edit example +### How All test cases are in the `public/examples/ts` folder. The comment in the header @@ -58,9 +42,9 @@ Most of examples are written in `TypeScript`. You need to comile it to `JavaScri npm run compile:example ``` -## Some built-in features available in examples +### Some built-in features available in examples -### Import third-party library +#### Import third-party library For example: @@ -75,37 +59,37 @@ $.when( }); ``` -### Controller panel +#### Controller panel Use this code to enable controller panel for a example: ```js app.config = { - aNameForTheSelectWidget: 'This is the initial value' - aNameForTheRangeWidget: 45, - aNameForTheButtonWidget: function () { - // Do something. - }, - onChange: function () { - // Do something. - } + aNameForTheSelectWidget: 'This is the initial value' + aNameForTheRangeWidget: 45, + aNameForTheButtonWidget: function () { + // Do something. + }, + onChange: function () { + // Do something. + } }; app.configParameters = { - aNameForTheSelectWidget: { - options: [ - 'This is the initial value', - 'This is another value', - 'This is the third value' - ] - }, - aNameForTheRangeWidget: { - min: -90, - max: 90 - } + aNameForTheSelectWidget: { + options: [ + 'This is the initial value', + 'This is another value', + 'This is the third value' + ] + }, + aNameForTheRangeWidget: { + min: -90, + max: 90 + } }; ``` -### Resize +#### Resize ```js app.onresize = function () { @@ -113,57 +97,76 @@ app.onresize = function () { }; ``` -### Get width and height of the chart area +#### Get width and height of the chart area ```js var width = myChart.getWidth(); var height = myChart.getHeight(); ``` -## Update example snapshots -```shell -npm run build:example -``` +## View and edit echarts-examples website -Only for default theme +### Dev and view examples in website ```shell -node tool/build-example.js -t default +npm run dev ``` +### Use local echarts build + +1. Update the URL of `localEChartsDir` & `localEChartsGLJS` in `src/common/config.js` +2. Add `local=1` in URL. For example: + + `editor.html?c=area-basic&local=1` + + ## Run e2e tests. Run all the examples to test package publishing and install, module importing, minimal bundling and DTS correctness. -Before run the tests. you need to update the examples. +Before run the tests. you need to update the examples list. ```shell -npm run build:example +npm run build:examplelist ``` -Then run the tests. +If puppeteer has not been installed: +```shell +npm i puppeteer +``` +If you want to save the log: ```shell -npm run test:e2e +exe_something > 1.log 2>&1 ``` -You can change the testing branch or local dir, which is available when add `--local` in `e2e/config.js` +### Run e2e test using local dependent repos -If you want to test with esbuild bundler. Which is much faster. +If you are testing a new version of echarts or zrender, which are not released in github yet, you need run e2e test with local dependent repos. + +Firstly, make sure the dependent repos listed in `dir` attributes in `echarts-examples/e2e/config.js` existing and having release built. + +Note: the commands below will execute `npm install` in these local directories. ```shell -npm run test:e2e:esbuild +# run e2e using local dependent repos and webpack. +npm run test:e2e:local +# run e2e using local dependent repos and esbuild, which is much faster. +npm run test:e2e:esbuild:local ``` -If you want use the packages in your local folder which is still in developing. Please update the `dir` path in `test/config.js` for all packages first. Then run the script directly with `--local` arg. +### Run e2e test using remote dependent repos + +Note: the commands below will download the repos listed in `echarts-examples/e2e/config.js` to a temporary folder. ```shell -node e2e/main.js --bundler esbuild -m --local -node e2e/main.js --bundler webpack -m --local +# run e2e using remote dependent repos and webpack. +npm run test:e2e +# run e2e using remote dependent repos and esbuild, which is much faster. +npm run test:e2e:esbuild ``` -#### Run partial tests. +### Run partial tests. > Note: This can only be used when you run the whole e2e test at least once. @@ -178,3 +181,21 @@ Specify matched tests. ```shell node e2e/main.js --skip npm --tests bar3D* ``` + + +## Release + +1. Update example snapshots + ```shell + npm run build:example + + # Node: If only build for default theme: + node tool/build-example.js -t default + ``` +2. Build and copy all the build resources to `echarts-website` + ```shell + npm run release + + # Note: the config of the dir of echarts-website is in + # `echarts-examples/config/**` + ``` --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org For additional commands, e-mail: commits-h...@echarts.apache.org