You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by su...@apache.org on 2025/07/02 15:10:38 UTC
(echarts-examples) branch dev updated (1d54d0eb -> cee9b32a)
This is an automated email from the ASF dual-hosted git repository.
sushuang pushed a change to branch dev
in repository https://gitbox.apache.org/repos/asf/echarts-examples.git
from 1d54d0eb matrix: add and fix test case.
new 1c0a17c4 (infra): (1) Support compile:example only a single file. (2) Tweak README doc.
new 6da69e3a fix the previous commit.
new cee9b32a (infra) remove --openssl-legacy-provider, as in node v16.20.2 it throws error "node: --openssl-legacy-provider is not allowed in NODE_OPTIONS". Since later dependabot has upgraded webpack to ^5.94.0, -openssl-legacy-provider is no need.
The 3 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.
Summary of changes:
README.md | 11 +++--
package.json | 7 ++--
public/examples/tsconfig.json | 3 +-
tool/compile-example.js | 93 ++++++++++++++++++++++++++++++++++++++-----
4 files changed, 97 insertions(+), 17 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
(echarts-examples) 01/03: (infra): (1) Support compile:example only a single file. (2) Tweak README doc.
Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sushuang pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/echarts-examples.git
commit 1c0a17c4e4b67098addc4ad4f500c1e2a7f3865c
Author: 100pah <su...@gmail.com>
AuthorDate: Tue Jul 1 19:01:25 2025 +0800
(infra): (1) Support compile:example only a single file. (2) Tweak README doc.
---
README.md | 11 ++++---
tool/compile-example.js | 85 +++++++++++++++++++++++++++++++++++++++++++------
2 files changed, 83 insertions(+), 13 deletions(-)
diff --git a/README.md b/README.md
index e3a4e662..f546291f 100644
--- a/README.md
+++ b/README.md
@@ -64,17 +64,20 @@ Use this code to enable controller panel for a example:
```js
app.config = {
- aNameForTheSelectWidget: 'This is the initial value'
+ aNameForTheSelectionWidget: 'This is the initial value'
aNameForTheRangeWidget: 45,
aNameForTheButtonWidget: function () {
- // Do something.
+ // Do something on button click.
},
onChange: function () {
- // Do something.
+ // Do something on SelectionWidget or RangeWidget changed.
+ // Read the current value.
+ console.log(app.config.aNameForTheRangeWidget)
+ console.log(app.config.aNameForTheSelectionWidget)
}
};
app.configParameters = {
- aNameForTheSelectWidget: {
+ aNameForTheSelectionWidget: {
options: [
'This is the initial value',
'This is another value',
diff --git a/tool/compile-example.js b/tool/compile-example.js
index a367208e..7ce63fec 100644
--- a/tool/compile-example.js
+++ b/tool/compile-example.js
@@ -3,18 +3,85 @@ const fs = require('fs');
const path = require('path');
const shell = require('shelljs');
+/**
+ * @usage
+ * ```shell
+ * # compile all
+ * npm run compile:example
+ *
+ * # compile single
+ * npm run compile:example -- area-basic.ts
+ * ```
+ */
+
const exampleDir = path.join(__dirname, '../public/examples');
+// Get the file argument (relative to exampleDir, e.g. 'area-basic.ts')
+const fileArg = process.argv[2];
+
async function run() {
- const hasError =
- shell.exec(`tsc --project "${path.join(exampleDir, 'tsconfig.json')}"`)
- .code !== 0;
- shell.exec(`prettier --write "${path.join(exampleDir, 'js')}"`);
-
- const files = await globby('js/**/*.js', {
- cwd: exampleDir,
- absolute: true
- });
+ const tsConfigPath = path.join(exampleDir, 'tsconfig.json');
+
+ let singleSrcFilePath;
+ let intermediaJSFilePath;
+ let retCode;
+
+ if (fileArg) {
+ singleSrcFilePath = path.join('ts', fileArg); // relative to exampleDir
+ console.log(`Compile single file "${singleSrcFilePath}" ...`);
+ intermediaJSFilePath = path
+ .join(exampleDir, singleSrcFilePath)
+ .replace(/\.ts$/, '.js')
+ .replace(/\/ts\//, '/js/');
+
+ // Create a temporary tsconfig.single.json
+ const tempConfigPath = path.join(exampleDir, 'tsconfig.single.json');
+ const tempConfig = {
+ extends: './tsconfig.json',
+ include: [singleSrcFilePath]
+ };
+ fs.writeFileSync(
+ tempConfigPath,
+ JSON.stringify(tempConfig, null, 2),
+ 'utf-8'
+ );
+
+ // Compile using the temp config
+ retCode = shell.exec(`tsc --project "${tempConfigPath}"`).code;
+
+ // Remove the temp config
+ fs.unlinkSync(tempConfigPath);
+ } else {
+ retCode = shell.exec(`tsc --project "${tsConfigPath}"`).code;
+ }
+
+ // There might be TS error, but probably no need to handle them immediately,
+ // thus do not block the subsequent process.
+ // if (retCode !== 0) {
+ // process.exit(retCode);
+ // }
+
+ // Prettier for the corresponding JS file
+ if (fileArg) {
+ if (fs.existsSync(intermediaJSFilePath)) {
+ shell.exec(`prettier --write "${intermediaJSFilePath}"`);
+ } else {
+ console.error(`prettier JS file not found: ${intermediaJSFilePath}`);
+ process.exit(1);
+ }
+ } else {
+ shell.exec(`prettier --write "${path.join(exampleDir, 'js')}"`);
+ }
+
+ let files;
+ if (fileArg) {
+ files = [intermediaJSFilePath];
+ } else {
+ files = await globby('js/**/*.js', {
+ cwd: exampleDir,
+ absolute: true
+ });
+ }
for (const file of files) {
const content =
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
(echarts-examples) 02/03: fix the previous commit.
Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sushuang pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/echarts-examples.git
commit 6da69e3a49f09ca8b674c8c9a376d247e9d77296
Author: 100pah <su...@gmail.com>
AuthorDate: Wed Jul 2 00:33:09 2025 +0800
fix the previous commit.
---
public/examples/tsconfig.json | 3 ++-
tool/compile-example.js | 16 ++++++++++++----
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/public/examples/tsconfig.json b/public/examples/tsconfig.json
index f47c85bb..69003a58 100644
--- a/public/examples/tsconfig.json
+++ b/public/examples/tsconfig.json
@@ -6,7 +6,8 @@
"allowJs": true,
"checkJs": false,
"pretty": true,
- "outDir": "./js/",
+ "rootDir": "./ts",
+ "outDir": "./js",
"baseUrl": "./"
},
"include": ["./ts/**/*.ts", "./ts/**/*.js", "./types/**/*.d.ts"]
diff --git a/tool/compile-example.js b/tool/compile-example.js
index 7ce63fec..a2697dec 100644
--- a/tool/compile-example.js
+++ b/tool/compile-example.js
@@ -27,18 +27,24 @@ async function run() {
let retCode;
if (fileArg) {
- singleSrcFilePath = path.join('ts', fileArg); // relative to exampleDir
+ singleSrcFilePath = path.join(exampleDir, 'ts', fileArg);
console.log(`Compile single file "${singleSrcFilePath}" ...`);
- intermediaJSFilePath = path
- .join(exampleDir, singleSrcFilePath)
+ intermediaJSFilePath = singleSrcFilePath
.replace(/\.ts$/, '.js')
.replace(/\/ts\//, '/js/');
+ if (!fs.existsSync(singleSrcFilePath)) {
+ console.error(`${singleSrcFilePath} does not exist.`);
+ process.exit(1);
+ }
// Create a temporary tsconfig.single.json
const tempConfigPath = path.join(exampleDir, 'tsconfig.single.json');
const tempConfig = {
extends: './tsconfig.json',
- include: [singleSrcFilePath]
+ include: [
+ path.join('ts', fileArg), // relative to exampleDir
+ './types/**/*.d.ts'
+ ]
};
fs.writeFileSync(
tempConfigPath,
@@ -55,6 +61,8 @@ async function run() {
retCode = shell.exec(`tsc --project "${tsConfigPath}"`).code;
}
+ console.log(`tsc return code: ${retCode}`);
+
// There might be TS error, but probably no need to handle them immediately,
// thus do not block the subsequent process.
// if (retCode !== 0) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
(echarts-examples) 03/03: (infra) remove --openssl-legacy-provider, as in node v16.20.2 it throws error "node: --openssl-legacy-provider is not allowed in NODE_OPTIONS". Since later dependabot has upgraded webpack to ^5.94.0, -openssl-legacy-provider is no need.
Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sushuang pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/echarts-examples.git
commit cee9b32a40eb66e56b8d41225f3241ee2fa3708f
Author: 100pah <su...@gmail.com>
AuthorDate: Wed Jul 2 23:10:04 2025 +0800
(infra) remove --openssl-legacy-provider, as in node v16.20.2 it throws error "node: --openssl-legacy-provider is not allowed in NODE_OPTIONS". Since later dependabot has upgraded webpack to ^5.94.0, -openssl-legacy-provider is no need.
---
package.json | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/package.json b/package.json
index bede6969..749f7724 100644
--- a/package.json
+++ b/package.json
@@ -4,8 +4,8 @@
"license": "Apache-2.0",
"private": true,
"scripts": {
- "build": "cross-env NODE_OPTIONS=--openssl-legacy-provider webpack --config build/webpack.config.js --mode production",
- "watch": "cross-env NODE_OPTIONS=--openssl-legacy-provider webpack --config build/webpack.config.js --mode development --devtool source-map --watch",
+ "build": "webpack --config build/webpack.config.js --mode production",
+ "watch": "webpack --config build/webpack.config.js --mode development --devtool source-map --watch",
"localsite": "npm run compile:example && npm run build && node build/copyResource.js --env localsite",
"release": "npm run compile:example && npm run build && node build/copyResource.js --env asf",
"dev": "concurrently --kill-others \"npm:watch\" \"npm:server\"",
@@ -46,6 +46,7 @@
"open": "^7.1.0",
"pixelmatch": "^5.2.1",
"pngjs": "^6.0.0",
+ "puppeteer": "^24.10.2",
"raw-loader": "^4.0.2",
"sass.js": "^0.11.1",
"sassjs-loader": "^2.0.0",
@@ -77,4 +78,4 @@
"vue-i18n": "^8.18.2",
"vue-scrollactive": "^0.9.3"
}
-}
\ No newline at end of file
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org