You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2021/04/20 12:24:57 UTC

[echarts] branch enhance-workflow created (now 017a90c)

This is an automated email from the ASF dual-hosted git repository.

shenyi pushed a change to branch enhance-workflow
in repository https://gitbox.apache.org/repos/asf/echarts.git.


      at 017a90c  chore: add DTS test in the workflow.

This branch includes the following new commits:

     new a379237  style: format code
     new fa9ece7  test: fix ts-jest don't work on zrender. remove canvas dependency
     new 5919ce5  chore: not install from github zrender in the ci test.
     new 92e3416  fix(type): remove template string in exported type. #14716
     new 017a90c  chore: add DTS test in the workflow.

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[echarts] 01/05: style: format code

Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

shenyi pushed a commit to branch enhance-workflow
in repository https://gitbox.apache.org/repos/asf/echarts.git

commit a37923769ac7c7517fef5bbd5502288697ed21dc
Author: pissang <bm...@gmail.com>
AuthorDate: Tue Apr 20 13:09:00 2021 +0800

    style: format code
---
 src/chart/pie/PieView.ts | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/chart/pie/PieView.ts b/src/chart/pie/PieView.ts
index 30a21dd..e7e575f 100644
--- a/src/chart/pie/PieView.ts
+++ b/src/chart/pie/PieView.ts
@@ -191,19 +191,19 @@ class PiePiece extends graphic.Sector {
         const labelPosition = seriesModel.get(['label', 'position']);
         if (labelPosition !== 'outside' && labelPosition !== 'outer') {
             sector.removeTextGuideLine();
-            return;
-        } else {
-          let polyline = this.getTextGuideLine();
-          if (!polyline) {
-            polyline = new graphic.Polyline();
-            this.setTextGuideLine(polyline);
-          }
-
-          // Default use item visual color
-          setLabelLineStyle(this, getLabelLineStatesModels(itemModel), {
-            stroke: visualColor,
-            opacity: retrieve3(labelLineModel.get(['lineStyle', 'opacity']), visualOpacity, 1)
-          });
+        }
+        else {
+            let polyline = this.getTextGuideLine();
+            if (!polyline) {
+                polyline = new graphic.Polyline();
+                this.setTextGuideLine(polyline);
+            }
+
+            // Default use item visual color
+            setLabelLineStyle(this, getLabelLineStatesModels(itemModel), {
+                stroke: visualColor,
+                opacity: retrieve3(labelLineModel.get(['lineStyle', 'opacity']), visualOpacity, 1)
+            });
         }
     }
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[echarts] 04/05: fix(type): remove template string in exported type. #14716

Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

shenyi pushed a commit to branch enhance-workflow
in repository https://gitbox.apache.org/repos/asf/echarts.git

commit 92e3416ee5b8253bc5753b6da5e04e99a33c3fef
Author: pissang <bm...@gmail.com>
AuthorDate: Tue Apr 20 20:22:02 2021 +0800

    fix(type): remove template string in exported type. #14716
---
 src/util/types.ts | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/util/types.ts b/src/util/types.ts
index 50d255f..62ddb56 100644
--- a/src/util/types.ts
+++ b/src/util/types.ts
@@ -1356,8 +1356,6 @@ export type ComponentItemTooltipLabelFormatterParams = {
     // properies key array like ['name']
     $vars: string[]
 } & {
-    [key in `${ComponentMainType}Index`]: number
-} & {
     // Other properties
     [key in string]: unknown
 };

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[echarts] 02/05: test: fix ts-jest don't work on zrender. remove canvas dependency

Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

shenyi pushed a commit to branch enhance-workflow
in repository https://gitbox.apache.org/repos/asf/echarts.git

commit fa9ece7792b4da573da73c71e887986b3fd5b2b2
Author: pissang <bm...@gmail.com>
AuthorDate: Tue Apr 20 20:12:12 2021 +0800

    test: fix ts-jest don't work on zrender. remove canvas dependency
---
 package.json                     |  1 -
 src/chart/helper/EffectSymbol.ts |  1 -
 test/ut/core/setup.ts            | 10 +---------
 test/ut/index.d.ts               |  3 +++
 test/ut/jest.config.js           |  4 ++++
 test/ut/tsconfig.json            | 12 ++----------
 6 files changed, 10 insertions(+), 21 deletions(-)

diff --git a/package.json b/package.json
index 1fc1c5b..35ff260 100644
--- a/package.json
+++ b/package.json
@@ -80,7 +80,6 @@
     "@types/jest": "^26.0.14",
     "@typescript-eslint/eslint-plugin": "^4.9.1",
     "@typescript-eslint/parser": "^4.9.1",
-    "canvas": "^2.6.0",
     "chalk": "^3.0.0",
     "commander": "2.11.0",
     "dtslint": "^4.0.5",
diff --git a/src/chart/helper/EffectSymbol.ts b/src/chart/helper/EffectSymbol.ts
index 34f0a02..31c6179 100644
--- a/src/chart/helper/EffectSymbol.ts
+++ b/src/chart/helper/EffectSymbol.ts
@@ -250,6 +250,5 @@ class EffectSymbol extends Group {
     };
 
 }
-zrUtil.inherits(EffectSymbol, Group);
 
 export default EffectSymbol;
diff --git a/test/ut/core/setup.ts b/test/ut/core/setup.ts
index 479ea92..eadc8aa 100644
--- a/test/ut/core/setup.ts
+++ b/test/ut/core/setup.ts
@@ -17,12 +17,4 @@
 * under the License.
 */
 
-// import { JSDOM } from 'jsdom';
-import { Image } from 'canvas';
-
-// const { window } = new JSDOM();
-
-// (global as any).window = window;
-// (global as any).navigator = window.navigator;
-// (global as any).document = window.document;
-(global as any).Image = Image;
+export {};
\ No newline at end of file
diff --git a/test/ut/index.d.ts b/test/ut/index.d.ts
index b1eb5a9..c486c8e 100644
--- a/test/ut/index.d.ts
+++ b/test/ut/index.d.ts
@@ -20,6 +20,9 @@
 
 export {};
 declare global {
+
+  const __DEV__: boolean;
+
   namespace jest {
     interface Matchers<R> {
         toBeFinite(): R
diff --git a/test/ut/jest.config.js b/test/ut/jest.config.js
index bc09902..9946de2 100644
--- a/test/ut/jest.config.js
+++ b/test/ut/jest.config.js
@@ -32,6 +32,10 @@ module.exports = {
     globals: {
         '__DEV__': true
     },
+    // Not exclude node_modules because zrender also needs to be transformed.
+    transformIgnorePatterns: [
+        "node_modules/(?!zrender/)"
+    ],
     testMatch: [
         '**/spec/api/*.test.ts',
         '**/spec/component/**/*.test.ts',
diff --git a/test/ut/tsconfig.json b/test/ut/tsconfig.json
index ff8304b..0cdbc3d 100644
--- a/test/ut/tsconfig.json
+++ b/test/ut/tsconfig.json
@@ -1,22 +1,14 @@
 {
     "compilerOptions": {
-        "target": "ES3",
+        "target": "ES6",
 
         "noImplicitAny": true,
         "noImplicitThis": true,
         "strictBindCallApply": true,
-        "removeComments": true,
-        "sourceMap": true,
 
-        // https://github.com/ezolenko/rollup-plugin-typescript2/issues/12#issuecomment-536173372
-        "moduleResolution": "node",
-
-        "importHelpers": true,
-
-        "pretty": true
+        "esModuleInterop": true
     },
     "include": [
-        "../../src/global.d.ts",
         "**/*.ts"
     ],
     "exclude": [

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[echarts] 03/05: chore: not install from github zrender in the ci test.

Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

shenyi pushed a commit to branch enhance-workflow
in repository https://gitbox.apache.org/repos/asf/echarts.git

commit 5919ce5143e9cd99831b8f0edccdd1cc5c010e9d
Author: pissang <bm...@gmail.com>
AuthorDate: Tue Apr 20 20:13:08 2021 +0800

    chore: not install from github zrender in the ci test.
---
 .github/workflows/nodejs.yml | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml
index 1a2c1d2..20354b8 100644
--- a/.github/workflows/nodejs.yml
+++ b/.github/workflows/nodejs.yml
@@ -21,14 +21,7 @@ jobs:
           node-version: ${{ matrix.node-version }}
       - name: npm install
         run: |
-          npm install
-          npm install git+https://github.com/ecomfe/zrender.git
-      - name: build zrender
-        run: |
-          cd node_modules/zrender
-          npm install
-          npm run prepublish
-          cd ../..
+          npm ci
       - name: check type
         run: |
           npm run checktype

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[echarts] 05/05: chore: add DTS test in the workflow.

Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

shenyi pushed a commit to branch enhance-workflow
in repository https://gitbox.apache.org/repos/asf/echarts.git

commit 017a90ce374a1a55df065d0b830cec0b92ce2b84
Author: pissang <bm...@gmail.com>
AuthorDate: Tue Apr 20 20:23:03 2021 +0800

    chore: add DTS test in the workflow.
    
    Also throw error when TS compile error.
---
 .github/workflows/nodejs.yml |  3 +++
 build/pre-publish.js         | 24 +++---------------------
 2 files changed, 6 insertions(+), 21 deletions(-)

diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml
index 20354b8..38c7ce5 100644
--- a/.github/workflows/nodejs.yml
+++ b/.github/workflows/nodejs.yml
@@ -28,6 +28,9 @@ jobs:
       - name: build release
         run: |
           npm run release
+      - name: test generated DTS
+        run: |
+          npm run test:dts
 
   # test:
   #   runs-on: ubuntu-latest
diff --git a/build/pre-publish.js b/build/pre-publish.js
index b4f1097..0c5e350 100644
--- a/build/pre-publish.js
+++ b/build/pre-publish.js
@@ -206,7 +206,9 @@ async function runTsCompile(localTs, compilerOptions, srcPathList) {
             console.log(chalk.red(localTs.flattenDiagnosticMessageText(diagnostic.messageText, '\n')));
         }
     });
-    assert(!emitResult.emitSkipped, 'ts compile failed.');
+    if (allDiagnostics.length > 0) {
+        throw new Error('TypeScript Compile Failed')
+    }
 }
 module.exports.runTsCompile = runTsCompile;
 
@@ -270,26 +272,6 @@ async function transformDistributionFiles(rooltFolder, replacement) {
     }
 }
 
-/**
- * Remove __esModule mark.
- *
- * In the 4.x version. The exported CJS don't have __esModule mark.
- * Developers can use `import echarts from 'echarts/lib/echarts' instead of
- * `import * as echarts from 'echarts/lib/echarts'` to import all the exported methods.
- * It's not recommand but developers may still have the chance to do it.
- * But in the tsc export with __esModule mark. This will get an undefined export.
- * To avoid breaking this kind of code. We remove __esModule mark manually here.
- */
-function removeESmoduleMark() {
-    const filePath = nodePath.resolve(ecDir, 'lib/echarts.js');
-    const code = fs.readFileSync(filePath, 'utf-8')
-        .replace('\nexports.__esModule = true;\n', '');
-    if (code.indexOf('__esModule') >= 0) {
-        throw new Error('Seems still has __esModule mark');
-    }
-    fs.writeFileSync(filePath, code, 'utf-8');
-}
-
 function singleTransformZRRootFolder(code, replacement) {
     return code.replace(/([\"\'])zrender\/src\//g, `$1zrender/${replacement}/`);
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org