Skip to content

Commit

Permalink
improve meta management
Browse files Browse the repository at this point in the history
  • Loading branch information
smouillour committed Apr 18, 2024
1 parent 5798bf9 commit fa9601a
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 64 deletions.
55 changes: 1 addition & 54 deletions packages/playground/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,60 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="@popperjs/core" content="2.11.8" />
<meta name="@rooks/use-mutation-observer" content="4.11.2" />
<meta name="@talend/locales-design-system" content="7.15.1" />
<meta name="@talend/locales-tui-components" content="11.4.5" />
<meta name="@talend/locales-tui-containers" content="9.1.3" />
<meta name="@talend/locales-tui-faceted-search" content="11.3.0" />
<meta name="@talend/locales-tui-forms" content="10.2.4" />
<meta name="@talend/icons" content="7.7.1" />
<meta name="ace-builds" content="1.32.6" />
<meta name="ajv" content="6.12.6" />
<meta name="ally.js" content="1.4.1" />
<meta name="axios" content="0.21.4" />
<meta name="classnames" content="2.3.1" />
<meta name="core-js-bundle" content="3.36.0" />
<meta name="d3" content="7.8.5" />
<meta name="focus-outline-manager" content="1.0.2" />
<meta name="history" content="5.3.0" />
<meta name="hoist-non-react-statics" content="3.3.2" />
<meta name="i18next" content="23.10.0" />
<meta name="immutable" content="4.3.5" />
<meta name="json-logic-js" content="2.0.2" />
<meta name="lodash" content="4.17.21" />
<meta name="platform" content="1.3.3" />
<meta name="preact" content="10.19.6" />
<meta name="prop-types" content="15.8.1" />
<meta name="react-ace" content="10.1.0" />
<meta name="react-autowhatever" content="10.2.0" />
<meta name="react-debounce-input" content="3.3.0" />
<meta name="react-dom" content="18.2.0" />
<meta name="react-draggable" content="4.4.6" />
<meta name="react-hook-form" content="7.50.1" />
<meta name="react-i18next" content="13.5.0" />
<meta name="react-is" content="17.0.2" />
<meta name="react-jsonschema-form" content="0.51.0" />
<meta name="react-lifecycles-compat" content="3.0.4" />
<meta name="react-popper" content="2.3.0" />
<meta name="react-redux" content="7.2.9" />
<meta name="react-router-dom" content="6.3.0" />
<meta name="react-router" content="6.3.0" />
<meta name="react-side-effect" content="2.1.2" />
<meta name="react-transition-group" content="4.4.5" />
<meta name="react-virtualized" content="9.22.5" />
<meta name="react" content="18.2.0" />
<meta name="recharts" content="2.12.1" />
<meta name="redux-saga" content="1.3.0" />
<meta name="redux-thunk" content="2.4.2" />
<meta name="redux" content="4.2.1" />
<meta name="regenerator-runtime" content="0.14.1" />
<meta name="rx" content="4.1.0" />
<meta name="rxjs" content="6.6.7" />
<meta name="scroll-smooth" content="1.1.1" />
<meta name="simplebar" content="6.2.5" />
<meta name="styled-components" content="5.3.11" />
<meta name="uuid" content="8.3.2" />
<%- injectMeta %>
<script type="text/javascript">
window.basename = '/';
var process = { browser: true, env: { NODE_ENV: 'development' } };
Expand Down
1 change: 1 addition & 0 deletions packages/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"mockjs": "^1.1.0",
"sass": "^1.75.0",
"vite": "^5.2.8",
"vite-plugin-html": "^3.2.2",
"vite-plugin-mock": "^3.0.1",
"webpack": "^5.90.3"
},
Expand Down
56 changes: 53 additions & 3 deletions packages/playground/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,53 @@
import react from '@vitejs/plugin-react';
import fixReactVirtualized from 'esbuild-plugin-react-virtualized';
import fs from 'fs';
import path from 'path';
import fs, { existsSync } from 'fs';
import path, { join } from 'path';
import { fileURLToPath } from 'url';
import { defineConfig } from 'vite';
import { createHtmlPlugin } from 'vite-plugin-html';
import { viteMockServe } from 'vite-plugin-mock';

function getPath(pkg) {
let currentDir = path.dirname(fileURLToPath(import.meta.resolve(pkg)));

while (currentDir !== '/' && !existsSync(join(currentDir, 'package.json'))) {
currentDir = path.dirname(currentDir);
}

if (existsSync(join(currentDir, 'package.json'))) {
return currentDir;
}
throw new Error('package.json introuvable pour le package spécifié');
}

function getVersion(pkg) {
const packagePath = path.join(getPath(pkg), 'package.json');
const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
return packageJson.version;
}

const PKGS = [
'@talend/locales-design-system',
'@talend/locales-tui-components',
'@talend/locales-tui-containers',
'@talend/locales-tui-faceted-search',
'@talend/locales-tui-forms',
'@talend/assets-api',
'@talend/design-tokens',
'@talend/design-system',
'@talend/react-components',
'@talend/react-containers',
'@talend/react-cmf',
'@talend/react-cmf-router',
'@talend/react-dataviz',
'@talend/react-faceted-search',
'@talend/react-forms',
'@talend/bootstrap-theme',
'@talend/icons',
];

const patterns = PKGS.map(pkg => `<meta name="${pkg}" content="${getVersion(pkg)}" />`).join('\n');

// https://vitejs.dev/config/
export default defineConfig({
plugins: [
Expand All @@ -14,6 +56,15 @@ export default defineConfig({
mockPath: 'mockVite',
localEnabled: true,
}),
createHtmlPlugin({
minify: true,
inject: {
data: {
title: 'index',
injectMeta: patterns,
},
},
}),
{
name: 'configure-static-files',
configureServer(server) {
Expand All @@ -29,7 +80,6 @@ export default defineConfig({
},
},
],

optimizeDeps: {
esbuildOptions: {
plugins: [fixReactVirtualized],
Expand Down
70 changes: 63 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3084,6 +3084,14 @@
resolved "https://registry.yarnpkg.com/@redux-saga/types/-/types-1.2.1.tgz#9403f51c17cae37edf870c6bc0c81c1ece5ccef8"
integrity sha512-1dgmkh+3so0+LlBWRhGA33ua4MYr7tUOj+a9Si28vUi0IUFNbff1T3sgpeDJI/LaC75bBYnQ0A3wXjn0OrRNBA==

"@rollup/pluginutils@^4.2.0":
version "4.2.1"
resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-4.2.1.tgz#e6c6c3aba0744edce3fb2074922d3776c0af2a6d"
integrity sha512-iKnFXr7NkdZAIHiIWE+BX5ULi/ucVFYWD6TbAV+rZctiRTY2PL6tsIKhoIOaoskiWAkgu+VsbXgUVDNLHf+InQ==
dependencies:
estree-walker "^2.0.1"
picomatch "^2.2.2"

"@rollup/[email protected]":
version "4.14.0"
resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.14.0.tgz#57936f50d0335e2e7bfac496d209606fa516add4"
Expand Down Expand Up @@ -7480,7 +7488,7 @@ confusing-browser-globals@^1.0.10:
resolved "https://registry.yarnpkg.com/confusing-browser-globals/-/confusing-browser-globals-1.0.11.tgz#ae40e9b57cdd3915408a2805ebd3a5585608dc81"
integrity sha512-JsPKdmh8ZkmnHxDk55FZ1TqVLvEQTvoByJZRN9jzI0UjxK/QgAmsphz7PGtqgPieQZ/CQcHWXCR7ATDNhGe+YA==

connect-history-api-fallback@^1:
connect-history-api-fallback@^1, connect-history-api-fallback@^1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz#8b32089359308d111115d81cad3fceab888f97bc"
integrity sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg==
Expand Down Expand Up @@ -7521,6 +7529,11 @@ connected-react-router@^6.9.3:
immutable "^3.8.1 || ^4.0.0"
seamless-immutable "^7.1.3"

consola@^2.15.3:
version "2.15.3"
resolved "https://registry.yarnpkg.com/consola/-/consola-2.15.3.tgz#2e11f98d6a4be71ff72e0bdf07bd23e12cb61550"
integrity sha512-9vAdYbHj6x2fLKC4+oPH0kFzY/orMZyG2Aj+kNylHxKGJ/Ed4dpNyAQYwJOdqO4zdM7XpVHmyejQDcQHrnuXbw==

consola@^3.2.3:
version "3.2.3"
resolved "https://registry.yarnpkg.com/consola/-/consola-3.2.3.tgz#0741857aa88cfa0d6fd53f1cff0375136e98502f"
Expand Down Expand Up @@ -7858,7 +7871,7 @@ css-select@^2.0.0:
domutils "^1.7.0"
nth-check "^1.0.2"

css-select@^4.1.3:
css-select@^4.1.3, css-select@^4.2.1:
version "4.3.0"
resolved "https://registry.yarnpkg.com/css-select/-/css-select-4.3.0.tgz#db7129b2846662fd8628cfc496abb2b59e41529b"
integrity sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ==
Expand Down Expand Up @@ -8900,6 +8913,11 @@ dotenv-expand@^10.0.0:
resolved "https://registry.yarnpkg.com/dotenv-expand/-/dotenv-expand-10.0.0.tgz#12605d00fb0af6d0a592e6558585784032e4ef37"
integrity sha512-GopVGCpVS1UKH75VKHGuQFqS1Gusej0z4FyQkPdwjil2gNIv+LNsqBlboOzpJFZKVT95GkCyWJbBSdFEFUWI2A==

dotenv-expand@^8.0.2:
version "8.0.3"
resolved "https://registry.yarnpkg.com/dotenv-expand/-/dotenv-expand-8.0.3.tgz#29016757455bcc748469c83a19b36aaf2b83dd6e"
integrity sha512-SErOMvge0ZUyWd5B0NXMQlDkN+8r+HhVUsxgOO7IoPDOdDRD2JjExpN6y3KnFR66jsJMwSn1pqIivhU5rcJiNg==

dotenv@^16.0.0:
version "16.4.5"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.5.tgz#cdd3b3b604cb327e286b4762e13502f717cb099f"
Expand Down Expand Up @@ -8957,6 +8975,13 @@ [email protected]:
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==

ejs@^3.1.6:
version "3.1.10"
resolved "https://registry.yarnpkg.com/ejs/-/ejs-3.1.10.tgz#69ab8358b14e896f80cc39e62087b88500c3ac3b"
integrity sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA==
dependencies:
jake "^10.8.5"

ejs@^3.1.8:
version "3.1.9"
resolved "https://registry.yarnpkg.com/ejs/-/ejs-3.1.9.tgz#03c9e8777fe12686a9effcef22303ca3d8eeb361"
Expand Down Expand Up @@ -9708,7 +9733,7 @@ estree-util-visit@^1.0.0, estree-util-visit@^1.2.1:
"@types/estree-jsx" "^1.0.0"
"@types/unist" "^2.0.0"

estree-walker@^2.0.2:
estree-walker@^2.0.1, estree-walker@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac"
integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==
Expand Down Expand Up @@ -10397,7 +10422,7 @@ [email protected], fs-extra@^9.1.0:
jsonfile "^6.0.1"
universalify "^2.0.0"

fs-extra@^10.0.0, fs-extra@^10.1.0:
fs-extra@^10.0.0, fs-extra@^10.0.1, fs-extra@^10.1.0:
version "10.1.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf"
integrity sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==
Expand Down Expand Up @@ -10915,7 +10940,7 @@ hasown@^2.0.0, hasown@^2.0.1:
dependencies:
function-bind "^1.1.2"

he@^1.2.0:
he@1.2.0, he@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"
integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==
Expand Down Expand Up @@ -11001,7 +11026,7 @@ html-minifier-terser@^5.0.1:
relateurl "^0.2.7"
terser "^4.6.3"

html-minifier-terser@^6.0.2:
html-minifier-terser@^6.0.2, html-minifier-terser@^6.1.0:
version "6.1.0"
resolved "https://registry.yarnpkg.com/html-minifier-terser/-/html-minifier-terser-6.1.0.tgz#bfc818934cc07918f6b3669f5774ecdfd48f32ab"
integrity sha512-YXxSlJBZTP7RS3tWnQw74ooKa6L9b9i9QYXY21eUEvhZ3u9XLfv6OnFsQq6RxkhHygsaUMvYsZRV5rU/OVNZxw==
Expand Down Expand Up @@ -14336,6 +14361,14 @@ node-gyp@^9.0.0:
tar "^6.1.2"
which "^2.0.2"

node-html-parser@^5.3.3:
version "5.4.2"
resolved "https://registry.yarnpkg.com/node-html-parser/-/node-html-parser-5.4.2.tgz#93e004038c17af80226c942336990a0eaed8136a"
integrity sha512-RaBPP3+51hPne/OolXxcz89iYvQvKOydaqoePpOgXcrOKZhjVIzmpKZz+Hd/RBO2/zN2q6CNJhQzucVz+u3Jyw==
dependencies:
css-select "^4.2.1"
he "1.2.0"

node-int64@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b"
Expand Down Expand Up @@ -14963,6 +14996,11 @@ path-type@^4.0.0:
resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b"
integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==

pathe@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/pathe/-/pathe-0.2.0.tgz#30fd7bbe0a0d91f0e60bae621f5d19e9e225c339"
integrity sha512-sTitTPYnn23esFR3RlqYBWn4c45WGeLcsKzQiUpXJAyfcWkolvlYpV8FLo7JishK946oQwMFUCHXQ9AjGPKExw==

pathe@^1.1.1, pathe@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/pathe/-/pathe-1.1.2.tgz#6c4cb47a945692e48a1ddd6e4094d170516437ec"
Expand Down Expand Up @@ -15007,7 +15045,7 @@ picocolors@^1.0.0:
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c"
integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==

picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3, picomatch@^2.3.0, picomatch@^2.3.1:
picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.2, picomatch@^2.2.3, picomatch@^2.3.0, picomatch@^2.3.1:
version "2.3.1"
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
Expand Down Expand Up @@ -19755,6 +19793,24 @@ vinyl@^3.0.0:
replace-ext "^2.0.0"
teex "^1.0.1"

vite-plugin-html@^3.2.2:
version "3.2.2"
resolved "https://registry.yarnpkg.com/vite-plugin-html/-/vite-plugin-html-3.2.2.tgz#661834fa09015d3fda48ba694dbaa809396f5f7a"
integrity sha512-vb9C9kcdzcIo/Oc3CLZVS03dL5pDlOFuhGlZYDCJ840BhWl/0nGeZWf3Qy7NlOayscY4Cm/QRgULCQkEZige5Q==
dependencies:
"@rollup/pluginutils" "^4.2.0"
colorette "^2.0.16"
connect-history-api-fallback "^1.6.0"
consola "^2.15.3"
dotenv "^16.0.0"
dotenv-expand "^8.0.2"
ejs "^3.1.6"
fast-glob "^3.2.11"
fs-extra "^10.0.1"
html-minifier-terser "^6.1.0"
node-html-parser "^5.3.3"
pathe "^0.2.0"

vite-plugin-mock@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/vite-plugin-mock/-/vite-plugin-mock-3.0.1.tgz#281adb7901351d230b636fbbd694573f6e2564b5"
Expand Down

0 comments on commit fa9601a

Please sign in to comment.