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 <sushuang0...@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-unsubscr...@echarts.apache.org
For additional commands, e-mail: commits-h...@echarts.apache.org

Reply via email to