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 2020/02/22 08:12:27 UTC

[incubator-echarts] branch typescript updated: chore: add clean build

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

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


The following commit(s) were added to refs/heads/typescript by this push:
     new 9df74a9  chore: add clean build
9df74a9 is described below

commit 9df74a9de224b14451bd80135605b7041e9c9a80
Author: pissang <bm...@gmail.com>
AuthorDate: Sat Feb 22 16:11:54 2020 +0800

    chore: add clean build
---
 build/build.js               |  9 ++++++++-
 build/config.js              |  7 ++++++-
 src/visual/visualSolution.ts | 16 ++++++++++++----
 3 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/build/build.js b/build/build.js
index c270406..384831d 100755
--- a/build/build.js
+++ b/build/build.js
@@ -119,6 +119,10 @@ async function run() {
             '-o, --output <output file path>',
             'If output file path is specified, input file path must be specified too.'
         )
+        .option(
+            '--clean',
+            'If cleaning build without cache. Maybe useful if some unexpected happens.'
+        )
         // .option(
         //     '--zrender <zrender>',
         //     'Local zrender path. Used when you want to use develop version of zrender instead of npm version.'
@@ -138,7 +142,10 @@ async function run() {
         format: commander.format,
         sourcemap: commander.sourcemap,
         removeDev: commander.removedev,
-        addBundleVersion: isWatch
+        addBundleVersion: isWatch,
+        // Force to disable cache in release build.
+        // TODO npm run build also disable cache?
+        clean: commander.clean || isRelease
     };
 
     validateIO(opt.input, opt.output);
diff --git a/build/config.js b/build/config.js
index 251fb91..688fbd3 100644
--- a/build/config.js
+++ b/build/config.js
@@ -30,7 +30,7 @@ const fs = require('fs');
 const progress = require('./progress');
 
 function preparePlugins(
-    {min, lang, sourcemap, removeDev, addBundleVersion, totalFiles},
+    {min, lang, sourcemap, removeDev, addBundleVersion, totalFiles, clean},
     {include, exclude}
 ) {
     assert(include);
@@ -41,6 +41,10 @@ function preparePlugins(
         include.push(zrRealPath + '/**/*.ts');
     }
 
+    if (clean) {
+        console.log('Built in clean mode without cache.');
+    }
+
     let plugins = [
         typescriptPlugin({
             tsconfig: nodePath.resolve(ecDir, 'tsconfig.json'),
@@ -57,6 +61,7 @@ function preparePlugins(
                 // include: include,
                 // exclude: exclude || []
             },
+            clean: clean || false,
             include: include,
             exclude: exclude || []
         }),
diff --git a/src/visual/visualSolution.ts b/src/visual/visualSolution.ts
index 96fd708..62cb939 100644
--- a/src/visual/visualSolution.ts
+++ b/src/visual/visualSolution.ts
@@ -25,7 +25,6 @@ import * as zrUtil from 'zrender/src/core/util';
 import VisualMapping, { VisualMappingOption } from './VisualMapping';
 import { Dictionary } from 'zrender/src/core/types';
 import {
-    VisualOption,
     BuiltinVisualProperty,
     ParsedDataValue,
     DimensionLoose,
@@ -37,7 +36,13 @@ var each = zrUtil.each;
 
 type WithKey<T extends string, S> = { [key in T]?: S}
 type VisualMappingCollection<VisualState extends string>
-    = WithKey<VisualState, WithKey<BuiltinVisualProperty, VisualMapping>>
+    = {
+        [key in VisualState]?: {
+            [key in BuiltinVisualProperty]?: VisualMapping
+        } & {
+            __alphaForOpacity?: VisualMapping
+        }
+    }
 
 function hasKeys(obj: Dictionary<any>) {
     if (obj) {
@@ -49,8 +54,11 @@ function hasKeys(obj: Dictionary<any>) {
     }
 }
 
+type VisualOption = {[key in BuiltinVisualProperty]?: any};
+
+
 export function createVisualMappings<VisualState extends string>(
-    option: Dictionary<VisualOption>,
+    option: WithKey<VisualState, VisualOption>,
     stateList: readonly VisualState[],
     supplementVisualOption: (mappingOption: VisualMappingOption, state: string) => void
 ) {
@@ -59,7 +67,7 @@ export function createVisualMappings<VisualState extends string>(
     each(stateList, function (state) {
         var mappings = visualMappings[state] = createMappings();
 
-        each(option[state], function (visualData: VisualMappingOption['visual'], visualType: BuiltinVisualProperty) {
+        each(option[state], function (visualData: VisualOption, visualType: BuiltinVisualProperty) {
             if (!VisualMapping.isValidType(visualType)) {
                 return;
             }


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