From 349941b7f0fd96e6a5a36f7e5fe3c73ed4801830 Mon Sep 17 00:00:00 2001 From: Marco Vettorello Date: Thu, 9 Sep 2021 23:13:12 +0200 Subject: [PATCH] ci: improve VRTs speed (#1366) --- .../server/generate/vrt_page_template.js | 2 - .../server/mocks/use_global_parameters.ts | 2 +- integration/server/webpack.config.js | 10 +++-- integration/server/webpack.tsconfig.json | 5 ++- package.json | 3 ++ yarn.lock | 39 ++++++++++++++----- 6 files changed, 42 insertions(+), 19 deletions(-) diff --git a/integration/server/generate/vrt_page_template.js b/integration/server/generate/vrt_page_template.js index d50a907b0b..4915989a36 100644 --- a/integration/server/generate/vrt_page_template.js +++ b/integration/server/generate/vrt_page_template.js @@ -34,8 +34,6 @@ appendIconComponentCache({ visualizeApp: require('@elastic/eui/es/components/icon/assets/app_visualize').icon, }); -document.querySelector('html')?.classList.add('disable-animations'); - ReactDOM.render(, document.getElementById('story-root') as HTMLElement); `.trim(); diff --git a/integration/server/mocks/use_global_parameters.ts b/integration/server/mocks/use_global_parameters.ts index e1fb005a62..59d211a342 100644 --- a/integration/server/mocks/use_global_parameters.ts +++ b/integration/server/mocks/use_global_parameters.ts @@ -10,7 +10,7 @@ import { useState } from 'react'; import { BackgroundParameter } from '../../../storybook/node_modules/storybook-addon-background-toggle'; import { ThemeParameter } from '../../../storybook/node_modules/storybook-addon-theme-toggle'; -import { parameters as globalParams } from '../../../storybook/preview'; +import { storybookParameters as globalParams } from '../../../storybook/parameters'; import { ThemeId } from '../../../storybook/use_base_theme'; interface Globals { diff --git a/integration/server/webpack.config.js b/integration/server/webpack.config.js index 32696a9dd3..a0f892c870 100644 --- a/integration/server/webpack.config.js +++ b/integration/server/webpack.config.js @@ -9,6 +9,8 @@ const path = require('path'); const HtmlWebpackPlugin = require('html-webpack-plugin'); +const MiniCssExtractPlugin = require('mini-css-extract-plugin'); +const SpeedMeasurePlugin = require('speed-measure-webpack-plugin'); const TerserPlugin = require('terser-webpack-plugin'); const webpack = require('webpack'); @@ -63,9 +65,7 @@ module.exports = { { test: /\.css$/, use: [ - { - loader: 'style-loader', - }, + MiniCssExtractPlugin.loader, { loader: 'css-loader', options: { importLoaders: 1 }, @@ -75,7 +75,7 @@ module.exports = { { test: /\.scss$/, use: [ - 'style-loader', + MiniCssExtractPlugin.loader, { loader: 'css-loader', options: { importLoaders: 1 }, @@ -114,5 +114,7 @@ module.exports = { favicon: '../../public/favicon.ico', }), new webpack.EnvironmentPlugin({ RNG_SEED: null }), + new MiniCssExtractPlugin(), + new SpeedMeasurePlugin(), ], }; diff --git a/integration/server/webpack.tsconfig.json b/integration/server/webpack.tsconfig.json index d2c62282fa..be0f6cff2b 100644 --- a/integration/server/webpack.tsconfig.json +++ b/integration/server/webpack.tsconfig.json @@ -2,8 +2,9 @@ "extends": "../../tsconfig", "compilerOptions": { "downlevelIteration": true, - "target": "ES5", - "module": "ESNext" + "target": "ES2019", + "module": "es2015", + "lib": ["ESNext", "dom"] }, "include": ["../../packages/charts/src/**/*", "./**/*"], "exclude": ["../../**/*.test.*"] diff --git a/package.json b/package.json index 7445cac35e..4cf67901fd 100644 --- a/package.json +++ b/package.json @@ -129,6 +129,7 @@ "eslint-plugin-react": "^7.22.0", "eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-unicorn": "^25.0.1", + "fibers": "^5.0.0", "html-webpack-plugin": "^4.5.2", "jest": "^26.6.3", "jest-canvas-mock": "^2.3.1", @@ -143,6 +144,7 @@ "lodash": "^4.17.15", "lorem-ipsum": "^2.0.3", "luxon": "^1.25.0", + "mini-css-extract-plugin": "1.6.2", "moment": "^2.29.1", "moment-timezone": "^0.5.32", "node-sass": "^4.14.1", @@ -165,6 +167,7 @@ "semantic-release": "^17.4.2", "semantic-release-slack-bot": "^2.1.0", "slugify": "^1.5.0", + "speed-measure-webpack-plugin": "^1.5.0", "ts-jest": "^26.5.5", "ts-prune": "^0.8.4", "typescript": "^4.1.3", diff --git a/yarn.lock b/yarn.lock index 61988b6363..a664e48384 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9712,7 +9712,7 @@ detect-indent@^6.0.0: resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-6.1.0.tgz#592485ebbbf6b3b1ab2be175c8393d04ca0d57e6" integrity sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA== -detect-libc@^1.0.2: +detect-libc@^1.0.2, detect-libc@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= @@ -10602,7 +10602,8 @@ eslint-module-utils@^2.6.0: pkg-dir "^2.0.0" "eslint-plugin-elastic-charts@link:./packages/eslint-plugin-elastic-charts": - version "1.0.0" + version "0.0.0" + uid "" eslint-plugin-eslint-comments@^3.2.0: version "3.2.0" @@ -11225,6 +11226,13 @@ fecha@^4.2.0: resolved "https://registry.yarnpkg.com/fecha/-/fecha-4.2.0.tgz#3ffb6395453e3f3efff850404f0a59b6747f5f41" integrity sha512-aN3pcx/DSmtyoovUudctc8+6Hl4T+hI9GBBHLjA76jdZl7+b1sgh5g4k+u/GL3dTy1/pnYzKp69FpJ0OicE3Wg== +fibers@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/fibers/-/fibers-5.0.0.tgz#3a60e0695b3ee5f6db94e62726716fa7a59acc41" + integrity sha512-UpGv/YAZp7mhKHxDvC1tColrroGRX90sSvh8RMZV9leo+e5+EkRVgCEZPlmXeo3BUNQTZxUaVdLskq1Q2FyCPg== + dependencies: + detect-libc "^1.0.3" + figgy-pudding@^3.4.1, figgy-pudding@^3.5.1: version "3.5.2" resolved "https://registry.yarnpkg.com/figgy-pudding/-/figgy-pudding-3.5.2.tgz#b4eee8148abb01dcf1d1ac34367d59e12fa61d6e" @@ -15008,13 +15016,8 @@ lines-and-columns@^1.1.6: integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= "link-kibana@link:./packages/link_kibana": - version "1.0.0" - dependencies: - chalk "^4.1.1" - change-case "^4.1.2" - glob "^7.1.7" - inquirer "^8.0.0" - ora "^5.4.0" + version "0.0.0" + uid "" lint-staged@^10.5.3: version "10.5.3" @@ -16011,6 +16014,15 @@ min-indent@^1.0.0: resolved "https://registry.yarnpkg.com/min-indent/-/min-indent-1.0.1.tgz#a63f681673b30571fbe8bc25686ae746eefa9869" integrity sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg== +mini-css-extract-plugin@1.6.2: + version "1.6.2" + resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-1.6.2.tgz#83172b4fd812f8fc4a09d6f6d16f924f53990ca8" + integrity sha512-WhDvO3SjGm40oV5y26GjMJYjd2UMqrLAGKy5YS2/3QKJy2F7jgynuHTir/tgUUOiNQu5saXHdc8reo7YuhhT4Q== + dependencies: + loader-utils "^2.0.0" + schema-utils "^3.0.0" + webpack-sources "^1.1.0" + minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" @@ -20881,6 +20893,13 @@ spdy@^4.0.2: select-hose "^2.0.0" spdy-transport "^3.0.0" +speed-measure-webpack-plugin@^1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/speed-measure-webpack-plugin/-/speed-measure-webpack-plugin-1.5.0.tgz#caf2c5bee24ab66c1c7c30e8daa7910497f7681a" + integrity sha512-Re0wX5CtM6gW7bZA64ONOfEPEhwbiSF/vz6e2GvadjuaPrQcHTQdRGsD8+BE7iUOysXH8tIenkPCQBEcspXsNg== + dependencies: + chalk "^4.1.0" + split-on-first@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/split-on-first/-/split-on-first-1.1.0.tgz#f610afeee3b12bce1d0c30425e76398b78249a5f" @@ -22876,7 +22895,7 @@ webpack-merge@^5.7.3: clone-deep "^4.0.1" wildcard "^2.0.0" -webpack-sources@^1.4.0, webpack-sources@^1.4.1, webpack-sources@^1.4.3: +webpack-sources@^1.1.0, webpack-sources@^1.4.0, webpack-sources@^1.4.1, webpack-sources@^1.4.3: version "1.4.3" resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.4.3.tgz#eedd8ec0b928fbf1cbfe994e22d2d890f330a933" integrity sha512-lgTS3Xhv1lCOKo7SA5TjKXMjpSM4sBjNV5+q2bqesbSPs5FjGmU6jjtBSkX9b4qW87vDIsCIlUPOEhbZrMdjeQ==