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

100pah pushed a commit to branch release-dev
in repository https://gitbox.apache.org/repos/asf/echarts.git

commit ed0e2103071744cb97887757679336cec1d8dac4
Author: 100pah <[email protected]>
AuthorDate: Wed May 13 00:09:03 2026 +0800

    chore: Fix `addHeader` tool and add missing license headers.
---
 .headerignore                | 78 +++++++++++++++++++++++++-------------------
 build/headerUtil.js          | 15 ++++++---
 build/preamble.js            | 12 +++++++
 test/types/cjs/main.ts       | 19 +++++++++++
 test/types/no-module/main.ts | 20 ++++++++++++
 5 files changed, 106 insertions(+), 38 deletions(-)

diff --git a/.headerignore b/.headerignore
index a84a274e6..bcda823b6 100644
--- a/.headerignore
+++ b/.headerignore
@@ -1,6 +1,10 @@
-# Only support regexp, testing against each relative file path
-# based on the echart base directory. And the pattern should
-# match the relative path completely.
+# Each line is a RegExp, testing against each relative file path;
+# case-sensitive; based on the echarts base directory.
+# And the pattern should match the relative path completely.
+# A relative path to matching is like:
+#  types/src/i18n/langZH.d.ts
+#  dist
+#  (no prefix './'; no trailing '/' for a directory)
 
 node_modules
 .*\.git
@@ -18,6 +22,7 @@ node_modules
 .*rat\.iml
 __MAC_OS
 .*README.md
+CONTRIBUTING.md
 .*MANIFEST\.txt
 DISCLAIMER
 NOTICE
@@ -25,34 +30,39 @@ KEYS
 LICENSE
 LICENSE-.+
 licenses
-map/js
-map/json
-benchmark/dep/*
-test/ut/lib
-test/runTest/tmp
-test/data$
-test/lib/esl\.js
-test/lib/perlin\.js
-test/lib/countup\.js
-.*jquery\.min\.js
-.*rollup\.browser\.js
-.*configure
-.+\.json
-.+\.map
-.+\.gexf
-.+\.jar
-.+\.bin
-.+\.csv
-.+\.png
-.+\.PNG
-.+\.jpg
-.+\.JPG
-.+\.jpeg
-.+\.JPEG
-.+\.gif
-.+\.GIF
-.+\.class
-types
-lib
-esm
-dist
+^map/js$
+^map/json$
+^benchmark/dep/*
+^test/ut/lib
+^test/runTest/tmp
+^test/data$
+^test/lib$
+^coverage$
+^test/ut/coverage$
+.*jquery\.min\.js$
+.*rollup\.browser\.js$
+.*configure$
+.eslintignore
+.+\.json$
+.+\.map$
+.+\.gexf$
+.+\.jar$
+.+\.bin$
+.+\.csv$
+.+\.png$
+.+\.PNG$
+.+\.jpg$
+.+\.JPG$
+.+\.jpeg$
+.+\.JPEG$
+.+\.gif$
+.+\.GIF$
+.+\.class$
+^types$
+^lib$
+^ssr/client/lib$
+^ssr/client/types$
+^ssr/client/index.d.ts$
+^ssr/client/index.js$
+^dist$
+^build/source-release/template$
diff --git a/build/headerUtil.js b/build/headerUtil.js
index e83f6a9d5..765bea67d 100644
--- a/build/headerUtil.js
+++ b/build/headerUtil.js
@@ -22,7 +22,12 @@ const fs = require('fs');
 
 // In the `.headerignore`, each line is a pattern in RegExp.
 // all relative path (based on the echarts base directory) is tested.
-// The pattern should match the relative path completely.
+// The pattern should match the relative path completely. case-sensitive.
+// A relative path to matching is like:
+//  types/src/i18n/langZH.d.ts
+//  dist
+//  (no prefix './'; no trailing '/' for a directory)
+
 const excludesPath = pathTool.join(__dirname, '../.headerignore');
 const ecBasePath = pathTool.join(__dirname, '../');
 
@@ -34,18 +39,20 @@ function eachFile(visit) {
     travel('./');
 
     function travel(relativePath) {
-        if (isExclude(relativePath)) {
+        const absolutePath = pathTool.join(ecBasePath, relativePath);
+
+        const relativePathForMatching = pathTool.relative(ecBasePath, 
absolutePath);
+        if (relativePathForMatching && isExclude(relativePathForMatching)) {
             return;
         }
 
-        const absolutePath = pathTool.join(ecBasePath, relativePath);
         const stat = fs.statSync(absolutePath);
 
         if (stat.isFile()) {
             visit(absolutePath, getExt(absolutePath));
         }
         else if (stat.isDirectory()) {
-            fs.readdirSync(relativePath).forEach(function (file) {
+            fs.readdirSync(absolutePath).forEach(function (file) {
                 travel(pathTool.join(relativePath, file));
             });
         }
diff --git a/build/preamble.js b/build/preamble.js
index d1bd0d296..e44dfd4bb 100644
--- a/build/preamble.js
+++ b/build/preamble.js
@@ -103,6 +103,14 @@ const addFns = {
         return headStr + fileStr;
     },
 
+    cjs: function (headStr, fileStr) {
+        return headStr + fileStr;
+    },
+
+    mjs: function (headStr, fileStr) {
+        return headStr + fileStr;
+    },
+
     css: function (headStr, fileStr) {
         return headStr + fileStr;
     },
@@ -157,6 +165,8 @@ function xmlAddFn(headStr, fileStr) {
 const preambleMap = {
     ts: cStyleComment,
     js: cStyleComment,
+    cjs: cStyleComment,
+    mjs: cStyleComment,
     css: cStyleComment,
     java: cStyleComment,
     yml: hashComment,
@@ -195,6 +205,8 @@ const mlCommentReg = /<\!\-\-[\S\s]*?\-\->/;
 const commentReg = {
     ts: cStyleCommentReg,
     js: cStyleCommentReg,
+    cjs: cStyleCommentReg,
+    mjs: cStyleCommentReg,
     css: cStyleCommentReg,
     java: cStyleCommentReg,
     yml: hashCommentReg,
diff --git a/test/types/cjs/main.ts b/test/types/cjs/main.ts
index 77afa46e1..e2e92072e 100644
--- a/test/types/cjs/main.ts
+++ b/test/types/cjs/main.ts
@@ -1,3 +1,22 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
 import echarts = require('echarts');
 
 function init() {
diff --git a/test/types/no-module/main.ts b/test/types/no-module/main.ts
index c30cb5600..eea939b8e 100644
--- a/test/types/no-module/main.ts
+++ b/test/types/no-module/main.ts
@@ -1,4 +1,24 @@
 /// <reference types="echarts" />
+// NOTE: a TS triple-slash directive must be at the top of the file.
+
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
 
 function init() {
     var myChart = echarts.init(document.getElementById('chart0'));


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to