Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/playground-vite/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@
<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" />
<%- injectMeta %>
<script type="text/javascript">
window.basename = '/';
var process = { browser: true, env: { NODE_ENV: 'development' } };
</script>
<title>Vite + React</title>
'', '@talend/locales-tui-components', '@talend/locales-tui-containers',
'@talend/locales-tui-faceted-search', '@talend/locales-tui-forms',

<meta name="@talend/locales-design-system" content="7.15.1" />
<meta name="@talend/locales-tui-components" content="16.0.1" />
<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="15.2.0" />
</head>
<body>
<div id="app"></div>
Expand Down
3 changes: 1 addition & 2 deletions packages/playground-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
"i18next-http-backend": "^1.4.5",
"mockjs": "^1.1.0",
"sass": "^1.93.2",
"vite": "^5.4.21",
"vite-plugin-html": "^3.2.2",
"vite": "^7.1.12",
"vite-plugin-mock": "^3.0.2",
"webpack": "^5.102.1"
},
Expand Down
15 changes: 4 additions & 11 deletions packages/playground-vite/src/app/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
* Being the first import is important, so that it is the default style
* and other style can override it
*/
// eslint-disable-next-line @talend/import-depth
import { initI18n } from './i18n.js';

// eslint-disable-next-line @talend/import-depth
import '@talend/bootstrap-theme/dist/bootstrap.css';
import cmf from '@talend/react-cmf';
import getRouter from '@talend/react-cmf-router';
import { AppLoader, IconsProvider as BaseIconsProvider } from '@talend/react-components';
import { AppLoader } from '@talend/react-components';
import containersModule from '@talend/react-containers';
import ComponentForm from '@talend/react-containers/lib/ComponentForm';

Expand All @@ -21,6 +20,7 @@ import { Dataviz } from './components/Dataviz.jsx';
import { FacetedSearchPlayground } from './components/FacetedSearch.jsx';
import { Icons } from './components/Icons.jsx';
import { LeaguesList } from './components/List.jsx';
import { initI18n } from './i18n.js';

// thanks ui-scripts
let basename = window.basename;
Expand All @@ -31,21 +31,13 @@ if (basename === '/') {
const router = getRouter({ basename });

initI18n();
const allsvg = `${basename || ''}/cdn/@talend/icons/${
process.env.ICONS_VERSION
}/dist/svg-bundle/all.svg`;

function IconsProvider() {
return <BaseIconsProvider bundles={[allsvg]} />;
}

const app = {
components: {
ComponentForm,
ComponentFormSandbox,
FacetedSearch: FacetedSearchPlayground,
LeaguesList,
IconsProvider,
Dataviz,
Icons,
},
Expand All @@ -68,4 +60,5 @@ console.log('app bootstrap should happens only once');
* - Fetch the settings
* - render react-dom in the dom 'app' element
*/
debugger;
cmf.bootstrap(app);
56 changes: 3 additions & 53 deletions packages/playground-vite/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,53 +1,12 @@
/* eslint-disable import/no-extraneous-dependencies */
import react from '@vitejs/plugin-react';
import fixReactVirtualized from 'esbuild-plugin-react-virtualized';
import fs, { existsSync } from 'fs';
import path, { join } from 'path';
import fs from 'fs';
import path 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 @@ -56,15 +15,6 @@ export default defineConfig({
mockPath: 'mockVite',
localEnabled: true,
}),
createHtmlPlugin({
minify: true,
inject: {
data: {
title: 'index',
injectMeta: patterns,
},
},
}),
{
name: 'configure-static-files',
configureServer(server) {
Expand Down
Loading
Loading