From 2178a8493213644b8db0932337212f3b33e9d371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Rialland?= Date: Thu, 23 Feb 2023 17:15:57 +0100 Subject: [PATCH] Move entry files into entries directory --- site/package.json | 2 +- site/source/{ => entries}/entry-en.tsx | 12 ++++++------ site/source/{ => entries}/entry-fr.tsx | 6 +++--- site/source/{ => entries}/entry-iframe.ts | 4 ++-- site/source/{ => entries}/entry-server.tsx | 2 +- site/source/{ => entries}/entry-sw.ts | 0 site/source/{ => entries}/template.html | 0 site/vite-iframe-script.config.ts | 2 +- site/vite-pwa-options.ts | 2 +- site/vite.config.ts | 8 ++++---- 10 files changed, 19 insertions(+), 19 deletions(-) rename site/source/{ => entries}/entry-en.tsx (75%) rename site/source/{ => entries}/entry-fr.tsx (87%) rename site/source/{ => entries}/entry-iframe.ts (97%) rename site/source/{ => entries}/entry-server.tsx (96%) rename site/source/{ => entries}/entry-sw.ts (100%) rename site/source/{ => entries}/template.html (100%) diff --git a/site/package.json b/site/package.json index 91525ef77..32525b458 100644 --- a/site/package.json +++ b/site/package.json @@ -24,7 +24,7 @@ "start:axe-debugging": "VITE_AXE_CORE_ENABLED=true vite dev", "start:netlify": "sed 's|:SITE_EN|/infrance|g' netlify.base.toml | sed 's|:SITE_FR|/mon-entreprise|g' | sed 's|:API_URL|http://localhost:3004|g' | sed 's|\\[\\[redirects\\]\\]|\\[\\[redirects\\]\\]\\n force = true|g' > netlify.toml && HMR_CLIENT_PORT=8888 netlify dev", "build": "NODE_OPTIONS='--max-old-space-size=6144'; yarn build:sitemap && yarn build:simulator-data && vite build && yarn build:iframe-script", - "build:ssr": "NODE_OPTIONS='--max-old-space-size=4096'; vite build --ssr ./source/entry-server.tsx --outDir ./dist/ssr --emptyOutDir && echo '{\"type\": \"module\"}' > dist/package.json", + "build:ssr": "NODE_OPTIONS='--max-old-space-size=4096'; vite build --ssr ./source/entries/entry-server.tsx --outDir ./dist/ssr --emptyOutDir && echo '{\"type\": \"module\"}' > dist/package.json", "build:prerender": "ts-node-esm prerender.ts", "build:simulator-data": "vite build --config vite-build-simulation-data.config.ts", "build:iframe-script": "NODE_OPTIONS='--max-old-space-size=4096'; vite build --config vite-iframe-script.config.ts", diff --git a/site/source/entry-en.tsx b/site/source/entries/entry-en.tsx similarity index 75% rename from site/source/entry-en.tsx rename to site/source/entries/entry-en.tsx index 4e68b587f..030466dbf 100644 --- a/site/source/entry-en.tsx +++ b/site/source/entries/entry-en.tsx @@ -2,13 +2,13 @@ import { I18nProvider } from '@react-aria/i18n' import { withProfiler } from '@sentry/react' import { createRoot } from 'react-dom/client' -import App from './App' -import i18next from './locales/i18n' -import ruleTranslations from './locales/rules-en.yaml' -import translateRules from './locales/translateRules' -import translations from './locales/ui-en.yaml' +import App from '../App' +import i18next from '../locales/i18n' +import ruleTranslations from '../locales/rules-en.yaml' +import translateRules from '../locales/translateRules' +import translations from '../locales/ui-en.yaml' -import './sentry' +import '../sentry' export const AppEn = () => ( diff --git a/site/source/entry-fr.tsx b/site/source/entries/entry-fr.tsx similarity index 87% rename from site/source/entry-fr.tsx rename to site/source/entries/entry-fr.tsx index 353aecaa1..487e2c51c 100644 --- a/site/source/entry-fr.tsx +++ b/site/source/entries/entry-fr.tsx @@ -2,10 +2,10 @@ import { I18nProvider } from '@react-aria/i18n' import { withProfiler } from '@sentry/react' import { createRoot } from 'react-dom/client' -import App from './App' -import i18next from './locales/i18n' +import App from '../App' +import i18next from '../locales/i18n' -import './sentry' +import '../sentry' export const AppFr = () => ( diff --git a/site/source/entry-iframe.ts b/site/source/entries/entry-iframe.ts similarity index 97% rename from site/source/entry-iframe.ts rename to site/source/entries/entry-iframe.ts index b841113d9..5d4d0aba4 100644 --- a/site/source/entry-iframe.ts +++ b/site/source/entries/entry-iframe.ts @@ -9,9 +9,9 @@ * aboutir à des bugs liés à une config de bundling différentes. **/ -import { hexToHSL } from './hexToHSL' +import { hexToHSL } from '../hexToHSL' // @ts-ignore ignore file not exist error -import simulationData from './public/simulation-data-title.json' +import simulationData from '../public/simulation-data-title.json' const script = document.currentScript if (!script) { diff --git a/site/source/entry-server.tsx b/site/source/entries/entry-server.tsx similarity index 96% rename from site/source/entry-server.tsx rename to site/source/entries/entry-server.tsx index 784c71978..133c4e9ce 100644 --- a/site/source/entry-server.tsx +++ b/site/source/entries/entry-server.tsx @@ -4,9 +4,9 @@ import { FilledContext, HelmetProvider } from 'react-helmet-async' import { StaticRouter } from 'react-router-dom/server' import { ServerStyleSheet, StyleSheetManager } from 'styled-components' +import i18next from '../locales/i18n' import { AppEn } from './entry-en' import { AppFr } from './entry-fr' -import i18next from './locales/i18n' export function render(url: string, lang: 'fr' | 'en') { const sheet = new ServerStyleSheet() diff --git a/site/source/entry-sw.ts b/site/source/entries/entry-sw.ts similarity index 100% rename from site/source/entry-sw.ts rename to site/source/entries/entry-sw.ts diff --git a/site/source/template.html b/site/source/entries/template.html similarity index 100% rename from site/source/template.html rename to site/source/entries/template.html diff --git a/site/vite-iframe-script.config.ts b/site/vite-iframe-script.config.ts index 0912e3670..d23691c69 100644 --- a/site/vite-iframe-script.config.ts +++ b/site/vite-iframe-script.config.ts @@ -9,7 +9,7 @@ export default defineConfig({ }, build: { lib: { - entry: './source/entry-iframe.ts', + entry: './source/entries/entry-iframe.ts', name: 'monEntrepriseIframe', formats: ['iife'], fileName: () => 'simulateur-iframe-integration.js', diff --git a/site/vite-pwa-options.ts b/site/vite-pwa-options.ts index cf9ca6bc4..fed482901 100644 --- a/site/vite-pwa-options.ts +++ b/site/vite-pwa-options.ts @@ -5,7 +5,7 @@ export const pwaOptions: Partial = { registerType: 'prompt', strategies: 'injectManifest', srcDir: 'source', - filename: 'entry-sw.ts', + filename: 'entries/entry-sw.ts', injectManifest: { maximumFileSizeToCacheInBytes: 3000000, manifestTransforms: [ diff --git a/site/vite.config.ts b/site/vite.config.ts index e7e5e6f8d..ed6d292b7 100644 --- a/site/vite.config.ts +++ b/site/vite.config.ts @@ -69,11 +69,11 @@ export default defineConfig(({ command, mode }) => ({ }), multipleSPA({ defaultSite: 'mon-entreprise', - templatePath: './source/template.html', + templatePath: './source/entries/template.html', sites: { 'mon-entreprise': { lang: 'fr', - entry: '/source/entry-fr.tsx', + entry: '/source/entries/entry-fr.tsx', title: "mon-entreprise.urssaf.fr : L'assistant officiel du créateur d'entreprise", description: @@ -83,7 +83,7 @@ export default defineConfig(({ command, mode }) => ({ }, infrance: { lang: 'en', - entry: '/source/entry-en.tsx', + entry: '/source/entries/entry-en.tsx', title: 'My company in France: A step-by-step guide to start a business in France', description: @@ -126,7 +126,7 @@ export default defineConfig(({ command, mode }) => ({ }, }, optimizeDeps: { - entries: ['./source/entry-fr.tsx', './source/entry-en.tsx'], + entries: ['./source/entries/entry-fr.tsx', './source/entries/entry-en.tsx'], exclude: ['publicodes-react', 'publicodes'], }, ssr: {