Просмотр исходного кода

[build] remove cuix dependencies from published npm package

Björn Alm 2 лет назад
Родитель
Сommit
a51f01ff1f
2 измененных файлов с 21 добавлено и 2 удалено
  1. 1 1
      package.json
  2. 20 1
      webpack.config.npm.js

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "gethue",
-  "version": "6.0.0",
+  "version": "6.0.1",
   "description": "Hue is an Open source SQL Query Editor for Databases/Warehouses",
   "keywords": [
     "Query Editor",

+ 20 - 1
webpack.config.npm.js

@@ -65,7 +65,26 @@ const copySourceConfig = {
     new CopyWebpackPlugin({
       patterns: [
         { from: './NPM-README.md', to: `${DIST_DIR}/README.md` },
-        { from: './package.json', to: `${DIST_DIR}/package.json` },
+        {
+          from: './package.json',
+          to: `${DIST_DIR}/package.json`,
+          transform: (content) => {
+            // Remove local dependencies (currently only cuix) since it is not needed
+            // and cannot be accessed by the npm registry.
+            const contentStr = content.toString();      
+            const contentObj = JSON.parse(contentStr);
+
+            // Iterate over the dependencies and remove local references
+            Object.keys(contentObj.dependencies || {}).forEach((key) => {
+              const value = contentObj.dependencies[key];
+              if (value.startsWith("file:")) {
+                delete contentObj.dependencies[key];
+              }
+            });
+            
+            return JSON.stringify(contentObj, null, 2);
+          }
+        },
         {
           from: JS_ROOT,
           to: `${DIST_DIR}`,