You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ha...@apache.org on 2026/08/09 16:24:34 UTC

(superset) 01/01: chore(build): replace external file-related deps with native Node modules

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

hainenber pushed a commit to branch replace-external-fs-deps-with-node-native
in repository https://gitbox.apache.org/repos/asf/superset.git

commit ffdaf9e6b82c45efc88e2fe41908da32fa5543ac
Author: hainenber <do...@gmail.com>
AuthorDate: Sun Aug 9 23:24:12 2026 +0700

    chore(build): replace external file-related deps with native Node modules
    
    Signed-off-by: hainenber <do...@gmail.com>
---
 superset-frontend/package-lock.json                | 23 ++++++++-
 superset-frontend/package.json                     |  3 --
 .../generator-superset/test/plugin-chart.test.ts   |  6 +--
 superset-frontend/scripts/build.js                 | 25 +++++-----
 superset-frontend/scripts/copyAssets.js            | 56 ----------------------
 5 files changed, 35 insertions(+), 78 deletions(-)

diff --git a/superset-frontend/package-lock.json b/superset-frontend/package-lock.json
index 4d53e7ae5f0..cb07a59296d 100644
--- a/superset-frontend/package-lock.json
+++ b/superset-frontend/package-lock.json
@@ -90,8 +90,6 @@
         "dom-to-image-more": "^3.10.2",
         "dom-to-pdf": "^0.3.2",
         "echarts": "^6.1.0",
-        "fast-glob": "^3.3.2",
-        "fs-extra": "^11.4.0",
         "fuse.js": "^7.5.0",
         "geolib": "^3.3.14",
         "geostyler": "^18.6.0",
@@ -6743,6 +6741,7 @@
       "version": "2.1.5",
       "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
       "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==",
+      "dev": true,
       "license": "MIT",
       "dependencies": {
         "@nodelib/fs.stat": "2.0.5",
@@ -6756,6 +6755,7 @@
       "version": "2.0.5",
       "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz",
       "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==",
+      "dev": true,
       "license": "MIT",
       "engines": {
         "node": ">= 8"
@@ -6765,6 +6765,7 @@
       "version": "1.2.8",
       "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz",
       "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==",
+      "dev": true,
       "license": "MIT",
       "dependencies": {
         "@nodelib/fs.scandir": "2.1.5",
@@ -15908,6 +15909,7 @@
       "version": "3.0.3",
       "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
       "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
+      "dev": true,
       "license": "MIT",
       "dependencies": {
         "fill-range": "^7.1.1"
@@ -20675,6 +20677,7 @@
       "version": "3.3.3",
       "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz",
       "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==",
+      "dev": true,
       "license": "MIT",
       "dependencies": {
         "@nodelib/fs.stat": "^2.0.2",
@@ -20798,6 +20801,7 @@
       "version": "1.18.0",
       "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.18.0.tgz",
       "integrity": "sha512-QKHXPW0hD8g4UET03SdOdunzSouc9N4AuHdsX8XNcTsuz+yYFILVNIX4l9yHABMhiEI9Db0JTTIpu0wB+Y1QQw==",
+      "dev": true,
       "license": "ISC",
       "dependencies": {
         "reusify": "^1.0.4"
@@ -20982,6 +20986,7 @@
       "version": "7.1.1",
       "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
       "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
+      "dev": true,
       "license": "MIT",
       "dependencies": {
         "to-regex-range": "^5.0.1"
@@ -21555,6 +21560,7 @@
       "version": "11.4.0",
       "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.4.0.tgz",
       "integrity": "sha512-EQsFzMUJkCKGr1ePqlYADkIUmHW1s3ZXr5Yqy6wbGrfUCphpl2maM/kyOIRA2HpP3AaFQTZXD4ldjek+nccddA==",
+      "dev": true,
       "license": "MIT",
       "dependencies": {
         "graceful-fs": "^4.2.0",
@@ -22532,6 +22538,7 @@
       "version": "5.1.2",
       "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
       "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
+      "dev": true,
       "license": "ISC",
       "dependencies": {
         "is-glob": "^4.0.1"
@@ -22776,6 +22783,7 @@
       "version": "4.2.11",
       "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
       "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
+      "dev": true,
       "license": "ISC"
     },
     "node_modules/h3-js": {
@@ -24273,6 +24281,7 @@
       "version": "2.1.1",
       "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
       "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
+      "dev": true,
       "license": "MIT",
       "engines": {
         "node": ">=0.10.0"
@@ -24335,6 +24344,7 @@
       "version": "4.0.3",
       "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
       "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
+      "dev": true,
       "license": "MIT",
       "dependencies": {
         "is-extglob": "^2.1.1"
@@ -24442,6 +24452,7 @@
       "version": "7.0.0",
       "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
       "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
+      "dev": true,
       "license": "MIT",
       "engines": {
         "node": ">=0.12.0"
@@ -26953,6 +26964,7 @@
       "version": "6.1.0",
       "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
       "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
+      "dev": true,
       "license": "MIT",
       "dependencies": {
         "universalify": "^2.0.0"
@@ -29021,6 +29033,7 @@
       "version": "1.4.1",
       "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
       "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==",
+      "dev": true,
       "license": "MIT",
       "engines": {
         "node": ">= 8"
@@ -29609,6 +29622,7 @@
       "version": "4.0.8",
       "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
       "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==",
+      "dev": true,
       "license": "MIT",
       "dependencies": {
         "braces": "^3.0.3",
@@ -33305,6 +33319,7 @@
       "version": "1.2.3",
       "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
       "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==",
+      "dev": true,
       "funding": [
         {
           "type": "github",
@@ -36065,6 +36080,7 @@
       "version": "1.0.4",
       "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz",
       "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==",
+      "dev": true,
       "license": "MIT",
       "engines": {
         "iojs": ">=1.0.0",
@@ -36134,6 +36150,7 @@
       "version": "1.2.0",
       "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",
       "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==",
+      "dev": true,
       "funding": [
         {
           "type": "github",
@@ -39188,6 +39205,7 @@
       "version": "5.0.1",
       "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
       "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+      "dev": true,
       "license": "MIT",
       "dependencies": {
         "is-number": "^7.0.0"
@@ -40257,6 +40275,7 @@
       "version": "2.0.1",
       "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz",
       "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==",
+      "dev": true,
       "license": "MIT",
       "engines": {
         "node": ">= 10.0.0"
diff --git a/superset-frontend/package.json b/superset-frontend/package.json
index 5da9b916e56..3db32298eab 100644
--- a/superset-frontend/package.json
+++ b/superset-frontend/package.json
@@ -65,7 +65,6 @@
     "ensure-oxc": "echo 'OXC linter is ready' && npx oxlint --version",
     "lint-stats": "node ./scripts/oxlint-metrics-uploader.js",
     "plugins:build": "node ./scripts/build.js",
-    "plugins:build-assets": "node ./scripts/copyAssets.js",
     "plugins:create-conventional-version": "npm run prune && lerna version --conventional-commits --create-release github --no-private --yes --tag-version-prefix=\"plugins-and-packages-v\"",
     "plugins:create-minor-version": "npm run prune && lerna version minor --no-private --yes --tag-version-prefix=\"plugins-and-packages-v\"",
     "plugins:create-patch-version": "npm run prune && lerna version patch --no-private --yes --tag-version-prefix=\"plugins-and-packages-v\"",
@@ -167,8 +166,6 @@
     "dom-to-image-more": "^3.10.2",
     "dom-to-pdf": "^0.3.2",
     "echarts": "^6.1.0",
-    "fast-glob": "^3.3.2",
-    "fs-extra": "^11.4.0",
     "fuse.js": "^7.5.0",
     "geolib": "^3.3.14",
     "geostyler": "^18.6.0",
diff --git a/superset-frontend/packages/generator-superset/test/plugin-chart.test.ts b/superset-frontend/packages/generator-superset/test/plugin-chart.test.ts
index 4687d27db5f..bdeea43bc5a 100644
--- a/superset-frontend/packages/generator-superset/test/plugin-chart.test.ts
+++ b/superset-frontend/packages/generator-superset/test/plugin-chart.test.ts
@@ -20,8 +20,7 @@
 import { dirname, join } from 'path';
 // @ts-ignore -- yeoman-test type resolution differs between local and Docker environments
 import helpers from 'yeoman-test';
-// @ts-ignore -- fs-extra/esm has no type declarations
-import { copySync } from 'fs-extra/esm';
+import { cpSync } from 'fs';
 import { fileURLToPath } from 'url';
 import pluginChartModule from '../generators/plugin-chart';
 
@@ -31,9 +30,10 @@ test('generator-superset:plugin-chart:creates files', async () => {
     .onTargetDirectory((dir: string) => {
       // `dir` is the path to the new temporary directory
       const generatorDirname = dirname(fileURLToPath(import.meta.url));
-      copySync(
+      cpSync(
         join(generatorDirname, '../generators/plugin-chart/templates'),
         join(dir, 'unknown/templates'),
+        { recursive: true },
       );
     })
     .withPrompts({
diff --git a/superset-frontend/scripts/build.js b/superset-frontend/scripts/build.js
index e850ae283d2..2c0f772ba53 100755
--- a/superset-frontend/scripts/build.js
+++ b/superset-frontend/scripts/build.js
@@ -26,7 +26,7 @@
 process.env.PATH = `./node_modules/.bin:${process.env.PATH}`;
 
 const { spawnSync } = require('child_process');
-const fastGlob = require('fast-glob');
+const { globSync } = require('fs');
 const yargs = require('yargs');
 const { hideBin } = require('yargs/helpers');
 
@@ -60,12 +60,11 @@ function getPackages(packagePattern, tsOnly = false) {
   // Find packages in both @superset-ui and @apache-superset scopes
   const supersetUiPackages = [
     ...new Set(
-      fastGlob
-        .sync([
-          `./node_modules/@superset-ui/${pattern}/src/**/*.${
-            tsOnly ? '{ts,tsx}' : '{ts,tsx,js,jsx}'
-          }`,
-        ])
+      globSync([
+        `./node_modules/@superset-ui/${pattern}/src/**/*.${
+          tsOnly ? '{ts,tsx}' : '{ts,tsx,js,jsx}'
+        }`,
+      ])
         .map(x => x.split('/')[3])
         .filter(x => !META_PACKAGES.has(x)),
     ),
@@ -73,13 +72,11 @@ function getPackages(packagePattern, tsOnly = false) {
 
   const apachePackages = [
     ...new Set(
-      fastGlob
-        .sync([
-          `./node_modules/@apache-superset/${pattern}/src/**/*.${
-            tsOnly ? '{ts,tsx}' : '{ts,tsx,js,jsx}'
-          }`,
-        ])
-        .map(x => x.split('/')[3]),
+      globSync([
+        `./node_modules/@apache-superset/${pattern}/src/**/*.${
+          tsOnly ? '{ts,tsx}' : '{ts,tsx,js,jsx}'
+        }`,
+      ]).map(x => x.split('/')[3]),
     ),
   ];
 
diff --git a/superset-frontend/scripts/copyAssets.js b/superset-frontend/scripts/copyAssets.js
deleted file mode 100644
index c66e5912880..00000000000
--- a/superset-frontend/scripts/copyAssets.js
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/env node
-
-/*
- * 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.
- */
-
-/* eslint-disable no-console */
-const { sync } = require('fast-glob');
-const { copy } = require('fs-extra');
-
-const pkgGlob = process.argv[2] || '*';
-
-const packages = sync([`{packages,plugins}/${pkgGlob}`], {
-  onlyDirectories: true,
-});
-
-console.log('Copying asset files from package {src} to {lib,esm}...');
-packages.forEach(pkg => {
-  const assets = sync([`${pkg}/src/**/*.{png,gif,jpg,css,geojson}`]);
-  assets.forEach(filePath => {
-    ['lib', 'esm']
-      .map(dir => filePath.replace(`${pkg}/src`, `${pkg}/${dir}`))
-      .forEach(newFilePath => {
-        copy(filePath, newFilePath, err => {
-          if (err) {
-            console.error(err);
-          }
-        });
-      });
-  });
-  if (assets.length > 0) {
-    console.log(
-      `  Copied ${assets.length
-        .toString()
-        .padStart(2)} asset files for ${pkg.replace(
-        'packages/superset-ui-',
-        '',
-      )}`,
-    );
-  }
-});