Browse Source

chore: change storybook build

代强 2 years ago
parent
commit
5e41de065b
3 changed files with 22 additions and 97 deletions
  1. 19 1
      .storybook/base/base.js
  2. 3 3
      package.json
  3. 0 93
      yarn.lock

+ 19 - 1
.storybook/base/base.js

@@ -2,9 +2,13 @@
 const path = require('path');
 const _ = require('lodash');
 const chalk = require('chalk').default;
-
 const utils = require('./utils');
 
+let AnalyzePlugin = null
+if(process.env.__ENABLE_ANALYZE__ === 'true') {
+    AnalyzePlugin = require("@ies/semi-page-analyze-inject/src/AnalyzePlugin")
+}
+
 function resolve(...dirs) {
     return path.join(__dirname, '../..', ...dirs);
 }
@@ -62,9 +66,22 @@ module.exports = {
                 use: ['style-loader', 'css-loader', 'sass-loader', resolve('packages/semi-webpack/lib/semi-theme-loader.js')],
             }
         );
+        AnalyzePlugin && rules.push({
+            test: /\.tsx?$/,
+            exclude: /node_modules/,
+            use: [
+                {
+                    loader: "babel-loader",
+                    options: {
+                        plugins: [AnalyzePlugin],
+                    }
+                },
+            ]
+        })
         config.module.rules = rules;
         config.resolve.extensions.push('.js', '.jsx', '.ts', '.tsx');
         config.resolve.symlinks = false;
+        config.mode = "development";
         config.resolve.alias = {
             '@douyinfe/semi-foundation': resolve('packages/semi-foundation'),
             '@douyinfe/semi-icons': resolve('packages/semi-icons/src'),
@@ -76,6 +93,7 @@ module.exports = {
             '@douyinfe/semi-animation-styled': resolve('packages/semi-animation-styled')
         };
         config.devtool = 'source-map';
+        // config.output.publicPath = "/storybook/"
 
         return config;
     }

+ 3 - 3
package.json

@@ -64,6 +64,8 @@
         "cypress-real-events": "^1.8.1",
         "date-fns": "^2.23.0",
         "debug": "^4.3.2",
+        "execa": "5",
+        "fast-xml-parser": "^4.2.7",
         "gatsby": "^2.32.13",
         "gatsby-plugin-i18n": "^1.0.1",
         "gatsby-plugin-mdx": "^1.10.1",
@@ -101,9 +103,7 @@
         "unist-util-remove": "^1.0.3",
         "unist-util-visit": "^2.0.3",
         "wait-on": "^6.0.1",
-        "wcag-color": "^1.1.1",
-        "fast-xml-parser": "^4.2.7",
-        "execa": "5"
+        "wcag-color": "^1.1.1"
     },
     "devDependencies": {
         "@actions/core": "^1.6.0",

+ 0 - 93
yarn.lock

@@ -1519,25 +1519,11 @@
     "@douyinfe/semi-animation-styled" "2.23.2"
     classnames "^2.2.6"
 
-"@douyinfe/[email protected]":
-  version "2.40.0-beta.0"
-  resolved "https://registry.yarnpkg.com/@douyinfe/semi-animation-react/-/semi-animation-react-2.40.0-beta.0.tgz#c42c2248c0468cb477df3d92ac14573bfb65f0bb"
-  integrity sha512-b68hGH8JqMGlGRwn0UNTx8zTSXb2oRgERyVziisVSlco6nhnp29CtAOLZuTxQrgHX9OEfA/Jz07ancg1ebqqUw==
-  dependencies:
-    "@douyinfe/semi-animation" "2.40.0-beta.0"
-    "@douyinfe/semi-animation-styled" "2.40.0-beta.0"
-    classnames "^2.2.6"
-
 "@douyinfe/[email protected]":
   version "2.23.2"
   resolved "https://registry.npmjs.org/@douyinfe/semi-animation-styled/-/semi-animation-styled-2.23.2.tgz#f18bc074515441c297cc636ed98521e249d093c9"
   integrity sha512-cKaA1yGHPF76Rx7EZDZicj+1oX1su2wnqb/UGFOTquAwqWmkTfgQ+EKxCd/N704WH+RtmGf4xbrJKpBvvcEdSQ==
 
-"@douyinfe/[email protected]":
-  version "2.40.0-beta.0"
-  resolved "https://registry.yarnpkg.com/@douyinfe/semi-animation-styled/-/semi-animation-styled-2.40.0-beta.0.tgz#8907a9bbdba1f77aecd46a276eae001249a3aaee"
-  integrity sha512-+ez2aIIGnjMYr5u7mM747GqISBFnC2Zby/njMm+AL90gg7JTPU9jmIocaKF38W23DbDocdl/iGop1FNAq3fbvA==
-
 "@douyinfe/[email protected]":
   version "2.12.0"
   resolved "https://registry.npmjs.org/@douyinfe/semi-animation/-/semi-animation-2.12.0.tgz#51fe52d3911c2591a80a6e9fe96e6809c1511f13"
@@ -1553,13 +1539,6 @@
   dependencies:
     bezier-easing "^2.1.0"
 
-"@douyinfe/[email protected]":
-  version "2.40.0-beta.0"
-  resolved "https://registry.yarnpkg.com/@douyinfe/semi-animation/-/semi-animation-2.40.0-beta.0.tgz#c8cfa769550fc6dc146956b37804b6be331625a3"
-  integrity sha512-YJhZalmBpo2BOAILasMgJnn7ybzKHSfGFVmbManuA1yP9GW4J3mF/HWthml5PVqNmeXGkLjjHJyrGJ7d9OZizQ==
-  dependencies:
-    bezier-easing "^2.1.0"
-
 "@douyinfe/[email protected]":
   version "2.33.1"
   resolved "https://registry.npmjs.org/@douyinfe/semi-foundation/-/semi-foundation-2.33.1.tgz#1dfe6233e35a4ed768cb580b0c9a677d1c34ffba"
@@ -1574,20 +1553,6 @@
     memoize-one "^5.2.1"
     scroll-into-view-if-needed "^2.2.24"
 
-"@douyinfe/[email protected]":
-  version "2.40.0-beta.0"
-  resolved "https://registry.yarnpkg.com/@douyinfe/semi-foundation/-/semi-foundation-2.40.0-beta.0.tgz#dfaced34afa05cead1cb09d344239b8344755ca1"
-  integrity sha512-7tGu97gosYo5mCuPXqm9z8bYTuaAXt5U+6mq4VSrHcqpllOfGed3YvHPRDTz6JRKT7/PR+1yzK01VMzwy8P4zw==
-  dependencies:
-    "@douyinfe/semi-animation" "2.40.0-beta.0"
-    async-validator "^3.5.0"
-    classnames "^2.2.6"
-    date-fns "^2.29.3"
-    date-fns-tz "^1.3.8"
-    lodash "^4.17.21"
-    memoize-one "^5.2.1"
-    scroll-into-view-if-needed "^2.2.24"
-
 "@douyinfe/[email protected]", "@douyinfe/semi-icons@latest":
   version "2.33.1"
   resolved "https://registry.yarnpkg.com/@douyinfe/semi-icons/-/semi-icons-2.33.1.tgz#8e2871d9bc0ab7e12df74e3c71802d53d69b7425"
@@ -1595,30 +1560,11 @@
   dependencies:
     classnames "^2.2.6"
 
-"@douyinfe/[email protected]":
-  version "2.40.0-beta.0"
-  resolved "https://registry.yarnpkg.com/@douyinfe/semi-icons/-/semi-icons-2.40.0-beta.0.tgz#456505d15a35380bdcb4b25a2d075223b574e68a"
-  integrity sha512-J4BLLG1ShXoZ9wJaKhJ8b0fKHgPNUfzy2t+/FkWIfw9FF5Y14TMA51YzLKR6DY+s8ZKpikzO7PG/xmu3qqdrkg==
-  dependencies:
-    classnames "^2.2.6"
-
-"@douyinfe/semi-icons@^2.0.0":
-  version "2.41.3"
-  resolved "https://registry.yarnpkg.com/@douyinfe/semi-icons/-/semi-icons-2.41.3.tgz#beea6a1d2a101e49c7e96937f88fd8ad6568da88"
-  integrity sha512-fmhmIql3YidFScE+mi7cGu/eCNGf+3FOnik0q+Q69wdoO+cGzhIVpJtj1o1/aU5Y9f7lckUj5VhJkjAYeRiwrw==
-  dependencies:
-    classnames "^2.2.6"
-
 "@douyinfe/[email protected]":
   version "2.33.1"
   resolved "https://registry.npmjs.org/@douyinfe/semi-illustrations/-/semi-illustrations-2.33.1.tgz#530ab851f4dc32a52221c4067c778c800b9b55d7"
   integrity sha512-tTTUN8QwnQiF++sk4VBNzfkG87aYZ4iUeqk2ys8/ymVUmCZQ7y46ys020GO1MfPHRR47OMFPI82FVcH1WQtE3g==
 
-"@douyinfe/[email protected]":
-  version "2.40.0-beta.0"
-  resolved "https://registry.yarnpkg.com/@douyinfe/semi-illustrations/-/semi-illustrations-2.40.0-beta.0.tgz#1fb83134d67c06425eb85e65a527c37806cc397d"
-  integrity sha512-/JHPg8lX80a1L9qzF0Vf7vBkQ6n9fy2EcDAJDF1qx1+Eh3GaFi4Wi9ngbRPrla9cVdmsHyTTAUMoypxwoHMHVg==
-
 "@douyinfe/[email protected]":
   version "2.23.2"
   resolved "https://registry.npmjs.org/@douyinfe/semi-scss-compile/-/semi-scss-compile-2.23.2.tgz#30884bb194ee9ae1e81877985e5663c3297c1ced"
@@ -1692,40 +1638,6 @@
   dependencies:
     glob "^7.1.6"
 
-"@douyinfe/[email protected]":
-  version "2.40.0-beta.0"
-  resolved "https://registry.yarnpkg.com/@douyinfe/semi-theme-default/-/semi-theme-default-2.40.0-beta.0.tgz#f0f3e04870b24d229fcb89fcc9ffcb6fee1eb964"
-  integrity sha512-fi9OCHVG3kY+bntiTfLkUz0BzC3xnzFFrvp+Wqg68OC11osLZMR5kKuAUFj/mskTsuUyikGI0lx/dIi0IMNNFw==
-  dependencies:
-    glob "^7.1.6"
-
-"@douyinfe/semi-ui@^2.0.0":
-  version "2.41.3"
-  resolved "https://registry.yarnpkg.com/@douyinfe/semi-ui/-/semi-ui-2.41.3.tgz#35b029d9bfba96f2afeec5ca2baf77317704eace"
-  integrity sha512-MbgGzltuJbktiGmpO0EMrO8adjBLKHpd+XCu8OeDbZONJaJsGXjY366UL7JLUs9ESTpzLPTJY3EKmT2nuZS5QA==
-  dependencies:
-    "@dnd-kit/core" "^6.0.8"
-    "@dnd-kit/sortable" "^7.0.2"
-    "@dnd-kit/utilities" "^3.2.1"
-    "@douyinfe/semi-animation" "2.40.0-beta.0"
-    "@douyinfe/semi-animation-react" "2.40.0-beta.0"
-    "@douyinfe/semi-foundation" "2.40.0-beta.0"
-    "@douyinfe/semi-icons" "2.40.0-beta.0"
-    "@douyinfe/semi-illustrations" "2.40.0-beta.0"
-    "@douyinfe/semi-theme-default" "2.40.0-beta.0"
-    async-validator "^3.5.0"
-    classnames "^2.2.6"
-    copy-text-to-clipboard "^2.1.1"
-    date-fns "^2.29.3"
-    date-fns-tz "^1.3.8"
-    lodash "^4.17.21"
-    prop-types "^15.7.2"
-    react-resizable "^3.0.5"
-    react-window "^1.8.2"
-    resize-observer-polyfill "^1.5.1"
-    scroll-into-view-if-needed "^2.2.24"
-    utility-types "^3.10.0"
-
 "@douyinfe/semi-ui@latest":
   version "2.33.1"
   resolved "https://registry.yarnpkg.com/@douyinfe/semi-ui/-/semi-ui-2.33.1.tgz#3234ca96eb3560b8299bc9750fbe59446522d9bb"
@@ -11293,11 +11205,6 @@ eslint-plugin-react@^7.20.6, eslint-plugin-react@^7.24.0:
     semver "^6.3.0"
     string.prototype.matchall "^4.0.8"
 
-eslint-plugin-semi-design@^2.33.0:
-  version "2.41.3"
-  resolved "https://registry.yarnpkg.com/eslint-plugin-semi-design/-/eslint-plugin-semi-design-2.41.3.tgz#f336e15021f6efd7411bfab10ce276ac29a116a8"
-  integrity sha512-SHDRf6mAmZP/e6pq0bnSQz0JbZhqJLah+wjFF4fx0dLDWb2pXTeAOZ0+WseuzPGZe53E+eLuB2h+YlWe1xglKw==
-
 eslint-rule-composer@^0.3.0:
   version "0.3.0"
   resolved "https://registry.npmjs.org/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz#79320c927b0c5c0d3d3d2b76c8b4a488f25bbaf9"