Sites mon-entreprise et infrance
- Création d'un plugin personnalisé pour gérer le serveur dev et le build Rollup - Restauration d'un template.html (ne fonctionne pas encore au build) - Suppression de la config Babelpull/1967/head
|
@ -83,6 +83,7 @@ module.exports = {
|
|||
// TODO - enable these new recommended rules, a first step would be to switch from "off" to "warn"
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@typescript-eslint/no-floating-promises': 'off',
|
||||
'@typescript-eslint/no-misused-promises': 'off',
|
||||
'@typescript-eslint/no-extra-semi': 'off',
|
||||
'@typescript-eslint/no-unsafe-assignment': 'off',
|
||||
'@typescript-eslint/no-unsafe-call': 'off',
|
||||
|
|
|
@ -65,8 +65,8 @@ jobs:
|
|||
yarn workspace site build:ssr
|
||||
yarn workspace site build:prerender
|
||||
- name: Replace site placeholders in netlify.toml redirection file
|
||||
run: sed -i "s|:SITE_FR|$FR_BASE_URL|g" netlify.toml;
|
||||
sed -i "s|:SITE_EN|$EN_BASE_URL|g" netlify.toml;
|
||||
run: sed -i "s|:SITE_FR|$FR_BASE_URL|g" site/netlify.toml;
|
||||
sed -i "s|:SITE_EN|$EN_BASE_URL|g" site/netlify.toml;
|
||||
- name: Update Algolia index
|
||||
run: yarn workspace site algolia:update
|
||||
env:
|
||||
|
@ -79,7 +79,7 @@ jobs:
|
|||
name: static-site
|
||||
path: |
|
||||
site/dist/**
|
||||
netlify.toml
|
||||
site/netlify.toml
|
||||
if-no-files-found: error
|
||||
|
||||
deploy-preview:
|
||||
|
@ -97,7 +97,7 @@ jobs:
|
|||
- id: deploy-netlify
|
||||
uses: nwtgck/actions-netlify@v1.1
|
||||
with:
|
||||
publish-dir: './site/dist'
|
||||
publish-dir: '.'
|
||||
netlify-config-path: ./netlify.toml
|
||||
production-deploy: false
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
@ -126,7 +126,7 @@ jobs:
|
|||
- id: deploy-netlify
|
||||
uses: nwtgck/actions-netlify@v1.1
|
||||
with:
|
||||
publish-dir: './site/dist'
|
||||
publish-dir: '.'
|
||||
netlify-config-path: ./netlify.toml
|
||||
production-deploy: true
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
{
|
||||
"presets": [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
"targets": {
|
||||
"node": "current"
|
||||
}
|
||||
}
|
||||
],
|
||||
[
|
||||
"@babel/preset-react",
|
||||
{
|
||||
"runtime": "automatic"
|
||||
}
|
||||
],
|
||||
"@babel/preset-typescript"
|
||||
],
|
||||
"plugins": [
|
||||
"babel-plugin-styled-components",
|
||||
"@babel/plugin-proposal-class-properties",
|
||||
"@babel/plugin-proposal-optional-chaining",
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator",
|
||||
"@babel/plugin-proposal-object-rest-spread",
|
||||
"@babel/plugin-syntax-dynamic-import"
|
||||
]
|
||||
}
|
|
@ -96,70 +96,70 @@ Content-Security-Policy = "default-src 'self' mon-entreprise.fr; style-src 'self
|
|||
to = "/sitemap.fr.txt"
|
||||
status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = ":SITE_FR"
|
||||
to = "/prerender/mon-entreprise/index.html"
|
||||
status = 200
|
||||
# [[redirects]]
|
||||
# from = ":SITE_FR"
|
||||
# to = "/prerender/mon-entreprise/index.html"
|
||||
# status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = ":SITE_FR/cr%C3%A9er"
|
||||
to = "/prerender/mon-entreprise/cr%C3%A9er/index.html"
|
||||
status = 200
|
||||
# [[redirects]]
|
||||
# from = ":SITE_FR/cr%C3%A9er"
|
||||
# to = "/prerender/mon-entreprise/cr%C3%A9er/index.html"
|
||||
# status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = ":SITE_FR/g%C3%A9rer"
|
||||
to = "/prerender/mon-entreprise/g%C3%A9rer/index.html"
|
||||
status = 200
|
||||
# [[redirects]]
|
||||
# from = ":SITE_FR/g%C3%A9rer"
|
||||
# to = "/prerender/mon-entreprise/g%C3%A9rer/index.html"
|
||||
# status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = ":SITE_FR/simulateurs"
|
||||
to = "/prerender/mon-entreprise/simulateurs/index.html"
|
||||
status = 200
|
||||
# [[redirects]]
|
||||
# from = ":SITE_FR/simulateurs"
|
||||
# to = "/prerender/mon-entreprise/simulateurs/index.html"
|
||||
# status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = ":SITE_FR/simulateurs/ch%C3%B4mage-partiel"
|
||||
to = "/prerender/mon-entreprise/simulateurs/ch%C3%B4mage-partiel/index.html"
|
||||
status = 200
|
||||
# [[redirects]]
|
||||
# from = ":SITE_FR/simulateurs/ch%C3%B4mage-partiel"
|
||||
# to = "/prerender/mon-entreprise/simulateurs/ch%C3%B4mage-partiel/index.html"
|
||||
# status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = ":SITE_FR/simulateurs/salaire-brut-net"
|
||||
to = "/prerender/mon-entreprise/simulateurs/salaire-brut-net/index.html"
|
||||
status = 200
|
||||
# [[redirects]]
|
||||
# from = ":SITE_FR/simulateurs/salaire-brut-net"
|
||||
# to = "/prerender/mon-entreprise/simulateurs/salaire-brut-net/index.html"
|
||||
# status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = ":SITE_FR/simulateurs/auto-entrepreneur"
|
||||
to = "/prerender/mon-entreprise/simulateurs/auto-entrepreneur/index.html"
|
||||
status = 200
|
||||
# [[redirects]]
|
||||
# from = ":SITE_FR/simulateurs/auto-entrepreneur"
|
||||
# to = "/prerender/mon-entreprise/simulateurs/auto-entrepreneur/index.html"
|
||||
# status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = ":SITE_FR/simulateurs/ind%C3%A9pendant"
|
||||
to = "/prerender/mon-entreprise/simulateurs/ind%C3%A9pendant/index.html"
|
||||
status = 200
|
||||
# [[redirects]]
|
||||
# from = ":SITE_FR/simulateurs/ind%C3%A9pendant"
|
||||
# to = "/prerender/mon-entreprise/simulateurs/ind%C3%A9pendant/index.html"
|
||||
# status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = ":SITE_FR/simulateurs/dirigeant-sasu"
|
||||
to = "/prerender/mon-entreprise/simulateurs/dirigeant-sasu/index.html"
|
||||
status = 200
|
||||
# [[redirects]]
|
||||
# from = ":SITE_FR/simulateurs/dirigeant-sasu"
|
||||
# to = "/prerender/mon-entreprise/simulateurs/dirigeant-sasu/index.html"
|
||||
# status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = ":SITE_FR/simulateurs/artiste-auteur"
|
||||
to = "/prerender/mon-entreprise/simulateurs/artiste-auteur/index.html"
|
||||
status = 200
|
||||
# [[redirects]]
|
||||
# from = ":SITE_FR/simulateurs/artiste-auteur"
|
||||
# to = "/prerender/mon-entreprise/simulateurs/artiste-auteur/index.html"
|
||||
# status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = ":SITE_FR/iframes/simulateur-embauche"
|
||||
to = "/prerender/mon-entreprise/iframes/simulateur-embauche/index.html"
|
||||
status = 200
|
||||
# [[redirects]]
|
||||
# from = ":SITE_FR/iframes/simulateur-embauche"
|
||||
# to = "/prerender/mon-entreprise/iframes/simulateur-embauche/index.html"
|
||||
# status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = ":SITE_FR/iframes/simulateur-chomage-partiel"
|
||||
to = "/prerender/mon-entreprise/iframes/simulateur-chomage-partiel/index.html"
|
||||
status = 200
|
||||
# [[redirects]]
|
||||
# from = ":SITE_FR/iframes/simulateur-chomage-partiel"
|
||||
# to = "/prerender/mon-entreprise/iframes/simulateur-chomage-partiel/index.html"
|
||||
# status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = ":SITE_FR/iframes/pamc"
|
||||
to = "/prerender/mon-entreprise/iframes/pamc/index.html"
|
||||
status = 200
|
||||
# [[redirects]]
|
||||
# from = ":SITE_FR/iframes/pamc"
|
||||
# to = "/prerender/mon-entreprise/iframes/pamc/index.html"
|
||||
# status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = ":SITE_FR/*"
|
||||
|
@ -180,20 +180,20 @@ Content-Security-Policy = "default-src 'self' mon-entreprise.fr; style-src 'self
|
|||
to = "/sitemap.en.txt"
|
||||
status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = ":SITE_EN"
|
||||
to = "/prerender/infrance/index.html"
|
||||
status = 200
|
||||
# [[redirects]]
|
||||
# from = ":SITE_EN"
|
||||
# to = "/prerender/infrance/index.html"
|
||||
# status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = ":SITE_EN/calculators/salary"
|
||||
to = "/prerender/infrance/calculators/salary/index.html"
|
||||
status = 200
|
||||
# [[redirects]]
|
||||
# from = ":SITE_EN/calculators/salary"
|
||||
# to = "/prerender/infrance/calculators/salary/index.html"
|
||||
# status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = ":SITE_EN/iframes/simulateur-embauche"
|
||||
to = "/prerender/infrance/iframes/simulateur-embauche/index.html"
|
||||
status = 200
|
||||
# [[redirects]]
|
||||
# from = ":SITE_EN/iframes/simulateur-embauche"
|
||||
# to = "/prerender/infrance/iframes/simulateur-embauche/index.html"
|
||||
# status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = ":SITE_EN/*"
|
|
@ -19,17 +19,18 @@
|
|||
],
|
||||
"scripts": {
|
||||
"prepare": "node scripts/prepare.js",
|
||||
"start": "vite dev",
|
||||
"build": "vite build",
|
||||
"serve:dev": "concurrently -k \"yarn run serve:dev:mon-entreprise\" \"yarn run serve:dev:infrance\"",
|
||||
"serve:dev:mon-entreprise": "PORT=5000 serve --config serve.mon-entreprise.json --no-clipboard",
|
||||
"serve:dev:infrance": "PORT=5001 serve --config serve.infrance.json --no-clipboard",
|
||||
"typecheck:watch": "tsc --skipLibCheck --noEmit --watch",
|
||||
"test": "vitest",
|
||||
"test:dev-e2e:mon-entreprise": "cypress open --browser chromium",
|
||||
"test:dev-e2e:mycompanyinfrance": "cypress open --browser chromium --config baseUrl=http://localhost:8080/infrance,integrationFolder=cypress/integration/mon-entreprise/english --env language=en",
|
||||
"test:record-http-calls:mon-entreprise": "cypress run --env record_http=",
|
||||
"start": "WATCH_MODELE_SOCIAL=1 vite",
|
||||
"serve:dev:mycompanyinfrance": "PORT=5001 serve --config serve.infrance.json --no-clipboard",
|
||||
"algolia:update": "node scripts/search/update-data.js",
|
||||
"algolia:clean": "node scripts/search/clean.js",
|
||||
"preview": "vite preview"
|
||||
"algolia:clean": "node scripts/search/clean.js"
|
||||
},
|
||||
"resolutions": {
|
||||
"@mui/styled-engine": "npm:@mui/styled-engine-sc@latest"
|
||||
|
@ -68,7 +69,7 @@
|
|||
"ramda": "^0.27.0",
|
||||
"react": "^17.0.0",
|
||||
"react-color": "^2.14.0",
|
||||
"react-dom": "npm:@hot-loader/react-dom",
|
||||
"react-dom": "^17.0.0",
|
||||
"react-easy-emoji": "^1.2.0",
|
||||
"react-helmet-async": "^1.1.2",
|
||||
"react-i18next": "^11.0.0",
|
||||
|
@ -93,15 +94,6 @@
|
|||
"yaml": "^1.9.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.9.0",
|
||||
"@babel/plugin-proposal-class-properties": "^7.8.3",
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.9.5",
|
||||
"@babel/plugin-proposal-optional-chaining": "^7.9.0",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
||||
"@babel/preset-env": "^7.9.5",
|
||||
"@babel/preset-react": "^7.9.4",
|
||||
"@babel/preset-typescript": "^7.9.0",
|
||||
"@react-types/numberfield": "^3.1.0",
|
||||
"@react-types/searchfield": "^3.1.2",
|
||||
"@rollup/plugin-yaml": "^3.1.0",
|
||||
|
@ -137,9 +129,9 @@
|
|||
"prettier": "^2.3.2",
|
||||
"rimraf": "^3.0.2",
|
||||
"rollup-plugin-toml": "^1.0.0",
|
||||
"serve": "^13.0.2",
|
||||
"typescript": "^4.3.2",
|
||||
"vite": "^2.7.7",
|
||||
"vite-plugin-html": "2.1.1",
|
||||
"vitest": "^0.0.116",
|
||||
"xml2js": "^0.4.23"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"rewrites": [{ "source": "**", "destination": "infrance.html" }],
|
||||
"public": "dist"
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"rewrites": [{ "source": "**", "destination": "mon-entreprise.html" }],
|
||||
"public": "dist"
|
||||
}
|
|
@ -30,7 +30,7 @@ import {
|
|||
// ATInternet Tracking
|
||||
import { TrackingContext } from './ATInternetTracking'
|
||||
import { createTracker } from './ATInternetTracking/Tracker'
|
||||
import logo from './static/images/logo-monentreprise.svg'
|
||||
import logo from 'Images/logo-monentreprise.svg'
|
||||
import safeLocalStorage from './storage/safeLocalStorage'
|
||||
import { inIframe } from './utils'
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@ import { Trans, useTranslation } from 'react-i18next'
|
|||
import Worker from './SelectTauxRisque.worker.js?worker'
|
||||
const worker = new Worker()
|
||||
|
||||
console.log(worker)
|
||||
|
||||
function SelectComponent({ onChange, onSubmit, options, autoFocus }) {
|
||||
const [searchResults, setSearchResults] = useState()
|
||||
let submitOnChange = (option) => {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { I18nProvider } from '@react-aria/i18n'
|
||||
import rules from 'modele-social'
|
||||
import { render } from 'react-dom'
|
||||
import 'regenerator-runtime/runtime'
|
||||
|
@ -7,18 +8,17 @@ import ruleTranslations from './locales/rules-en.yaml'
|
|||
import translateRules from './locales/translateRules'
|
||||
import translations from './locales/ui-en.yaml'
|
||||
import './sentry'
|
||||
import { I18nProvider } from '@react-aria/i18n'
|
||||
|
||||
i18next.addResourceBundle('en', 'translation', translations)
|
||||
i18next.changeLanguage('en')
|
||||
|
||||
const anchor = document.querySelector('#js')
|
||||
render(
|
||||
const AppEn = () => (
|
||||
<I18nProvider locale="en-GB">
|
||||
<App
|
||||
basename="infrance"
|
||||
rules={translateRules('en', ruleTranslations, rules)}
|
||||
/>
|
||||
</I18nProvider>,
|
||||
anchor
|
||||
</I18nProvider>
|
||||
)
|
||||
|
||||
render(<AppEn />, document.querySelector('#js'))
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
import { I18nProvider } from '@react-aria/i18n'
|
||||
import rules from 'modele-social'
|
||||
import { render } from 'react-dom'
|
||||
import 'regenerator-runtime/runtime'
|
||||
import App from './App'
|
||||
import i18next from './locales/i18n'
|
||||
import { I18nProvider } from '@react-aria/i18n'
|
||||
|
||||
import './sentry'
|
||||
|
||||
i18next.changeLanguage('fr')
|
||||
|
||||
const anchor = document.querySelector('#js')
|
||||
render(
|
||||
const AppFr = () => (
|
||||
<I18nProvider locale="fr-FR">
|
||||
<App basename="mon-entreprise" rules={rules} />
|
||||
</I18nProvider>,
|
||||
anchor
|
||||
</I18nProvider>
|
||||
)
|
||||
|
||||
render(<AppFr />, document.querySelector('#js'))
|
||||
|
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 90 KiB |
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 72 KiB |
Before Width: | Height: | Size: 892 B After Width: | Height: | Size: 892 B |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 9.1 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 8.1 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 9.2 KiB |
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 400 B After Width: | Height: | Size: 400 B |
Before Width: | Height: | Size: 769 B After Width: | Height: | Size: 769 B |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
@ -1,5 +1,5 @@
|
|||
import { Redirect } from 'react-router-dom'
|
||||
import netlifyToml from '../../netlify.toml'
|
||||
import netlifyToml from '../netlify.toml'
|
||||
|
||||
export default netlifyToml.redirects
|
||||
.filter(({ from, status }) => status === 301 && !from.startsWith('https'))
|
||||
|
|
|
@ -197,11 +197,19 @@ export const generateSiteMap = (sitePaths: SitePathsType): SiteMap =>
|
|||
sitePaths
|
||||
)
|
||||
|
||||
// TODO: HACKY, find a better way to expose this information
|
||||
const basePathFr = import.meta.env.PROD
|
||||
? import.meta.env.VITE_FR_BASE_URL
|
||||
: '/mon-entreprise'
|
||||
const basePathEn = import.meta.env.PROD
|
||||
? import.meta.env.VITE_EN_BASE_URL
|
||||
: '/infrance'
|
||||
|
||||
const enSiteMap = generateSiteMap(constructLocalizedSitePath('en')).map(
|
||||
(path) => import.meta.env.VITE_EN_BASE_URL + path
|
||||
(path) => 'http://' + window.location.host + basePathEn + path
|
||||
)
|
||||
const frSiteMap = generateSiteMap(constructLocalizedSitePath('fr')).map(
|
||||
(path) => import.meta.env.VITE_FR_BASE_URL + path
|
||||
(path) => 'http://' + window.location.host + basePathFr + path
|
||||
)
|
||||
|
||||
export const hrefLangLink = {
|
||||
|
|
|
@ -31,9 +31,26 @@
|
|||
name="google-site-verification"
|
||||
content="lO4OheVzHWfvwcoUC-1VKN_GTWtA5vEM-uPZqb2PORs"
|
||||
/>
|
||||
<meta property="og:type" content="website" />
|
||||
|
||||
<!-- data-helmet pour que React Helmet puisse écraser ce meta par défaut -->
|
||||
<meta
|
||||
name="description"
|
||||
content="{{ description }}"
|
||||
data-react-helmet="true"
|
||||
/>
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" data-react-helmet="true" content="{{ title }}" />
|
||||
<meta
|
||||
property="og:description"
|
||||
data-react-helmet="true"
|
||||
content="{{ description }}"
|
||||
/>
|
||||
|
||||
<meta
|
||||
property="og:image"
|
||||
data-react-helmet="true"
|
||||
content="{{ shareImage }}"
|
||||
/>
|
||||
|
||||
<link rel="manifest" href="/manifest.webmanifest" />
|
||||
|
||||
|
@ -155,6 +172,7 @@
|
|||
<body>
|
||||
<!-- APP -->
|
||||
<div id="js"></div>
|
||||
<script type="module" src="{{ entry }}"></script>
|
||||
|
||||
<script>
|
||||
// Set the main colors from the provided customization in the URL We do it
|
|
@ -1 +0,0 @@
|
|||
dottednames.json
|
|
@ -1,51 +1,21 @@
|
|||
declare namespace NodeJS {
|
||||
interface ProcessEnv {
|
||||
EN_BASE_URL: string
|
||||
FR_BASE_URL: string
|
||||
NODE_ENV: 'development' | 'production' | 'test'
|
||||
ANALYZE_BUNDLE: '0' | '1'
|
||||
interface ImportMetaEnv {
|
||||
VITE_EN_BASE_URL: string
|
||||
VITE_FR_BASE_URL: string
|
||||
|
||||
// Github actions env variables
|
||||
// https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables
|
||||
GITHUB_REF: string
|
||||
GITHUB_SHA: string
|
||||
// Github actions env variables
|
||||
// https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables
|
||||
VITE_GITHUB_REF: string
|
||||
VITE_GITHUB_HEAD_REF: string
|
||||
VITE_GITHUB_SHA: string
|
||||
VITE_GIT_HEAD: string
|
||||
|
||||
// .env variables
|
||||
GITHUB_API_SECRET: string
|
||||
DEEPL_API_SECRET: string
|
||||
INSEE_SIRENE_API_SECRET: string
|
||||
ATINTERNET_API_ACCESS_KEY: string
|
||||
ATINTERNET_API_SECRET_KEY: string
|
||||
ZAMMAD_API_SECRET_KEY: string
|
||||
}
|
||||
VITE_AT_INTERNET_SITE_ID: string
|
||||
VITE_ATINTERNET_API_ACCESS_KEY: string
|
||||
VITE_ATINTERNET_API_SECRET_KEY: string
|
||||
|
||||
interface Global {
|
||||
SC_DISABLE_SPEEDY: boolean
|
||||
}
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
env: {
|
||||
MODE: 'development' | 'production' | 'test'
|
||||
|
||||
VITE_EN_BASE_URL: string
|
||||
VITE_FR_BASE_URL: string
|
||||
|
||||
// Github actions env variables
|
||||
// https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables
|
||||
VITE_GITHUB_REF: string
|
||||
VITE_GITHUB_HEAD_REF: string
|
||||
VITE_GITHUB_SHA: string
|
||||
VITE_GIT_HEAD: string
|
||||
|
||||
VITE_AT_INTERNET_SITE_ID: string
|
||||
VITE_ATINTERNET_API_ACCESS_KEY: string
|
||||
VITE_ATINTERNET_API_SECRET_KEY: string
|
||||
|
||||
VITE_ALGOLIA_INDEX_PREFIX: string
|
||||
VITE_ALGOLIA_SEARCH_KEY: string
|
||||
VITE_ALGOLIA_APP_ID: string
|
||||
|
||||
VITE_REDUX_TRACE: string
|
||||
}
|
||||
VITE_ALGOLIA_INDEX_PREFIX: string
|
||||
VITE_ALGOLIA_SEARCH_KEY: string
|
||||
VITE_ALGOLIA_APP_ID: string
|
||||
|
||||
VITE_REDUX_TRACE: string
|
||||
}
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
declare module '*.ttf' {
|
||||
const content: string
|
||||
export default content
|
||||
}
|
||||
|
||||
declare module '*.pdf' {
|
||||
const content: string
|
||||
export default content
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
declare module '*.svg' {
|
||||
const content: any
|
||||
export default content
|
||||
}
|
||||
|
||||
declare module '*.png' {
|
||||
const content: any
|
||||
export default content
|
||||
}
|
||||
|
||||
declare module '*.jpg' {
|
||||
const content: any
|
||||
export default content
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
declare module '*.md?raw' {
|
||||
const content: string
|
||||
export default content
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
declare module '*.ne' {
|
||||
const content: any
|
||||
export default content
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
declare module 'rollup-plugin-toml' {
|
||||
import { Plugin } from 'vite'
|
||||
const plugin: Plugin
|
||||
export default plugin
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
declare module '*.worker.js' {
|
||||
class WebpackWorker extends Worker {
|
||||
constructor()
|
||||
}
|
||||
|
||||
export default WebpackWorker
|
||||
}
|
|
@ -10,11 +10,12 @@
|
|||
"forceConsistentCasingInFileNames": true,
|
||||
"resolveJsonModule": true,
|
||||
"allowJs": true,
|
||||
"isolatedModules": true,
|
||||
"paths": {
|
||||
"Actions/*": ["actions/*"],
|
||||
"Components": ["components"],
|
||||
"Components/*": ["components/*"],
|
||||
"Images/*": ["static/images/*"],
|
||||
"Images/*": ["images/*"],
|
||||
"Reducers/*": ["reducers/*"],
|
||||
"Selectors/*": ["selectors/*"],
|
||||
"Types/*": ["types/*"],
|
||||
|
@ -23,9 +24,10 @@
|
|||
"Hooks/*": ["hooks/*"],
|
||||
"API/*": ["api/*"]
|
||||
},
|
||||
"types": ["vite/client"],
|
||||
"typeRoots": ["./types/", "./node_modules/@types"],
|
||||
"noEmit": true,
|
||||
"strict": true
|
||||
},
|
||||
"include": ["source", "test/**/*.ts", "dev-server.js"]
|
||||
"include": ["source", "test/**/*.ts", "vite.config.ts"]
|
||||
}
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
import yaml from '@rollup/plugin-yaml'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import path from 'path'
|
||||
import toml from 'rollup-plugin-toml'
|
||||
import { defineConfig } from 'vite'
|
||||
import { injectHtml } from 'vite-plugin-html'
|
||||
import { watchDottedNames } from '../modele-social/build.js'
|
||||
|
||||
if (process.env.WATCH_MODELE_SOCIAL) {
|
||||
watchDottedNames()
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {import('vite').Config}
|
||||
*/
|
||||
export default defineConfig({
|
||||
resolve: {
|
||||
alias: {
|
||||
Actions: path.resolve('source/actions/'),
|
||||
Components: path.resolve('source/components/'),
|
||||
Selectors: path.resolve('source/selectors/'),
|
||||
Reducers: path.resolve('source/reducers/'),
|
||||
Types: path.resolve('source/types/'),
|
||||
Images: path.resolve('source/static/images/'),
|
||||
DesignSystem: path.resolve('source/design-system'),
|
||||
Data: path.resolve('source/data'),
|
||||
Hooks: path.resolve('source/hooks'),
|
||||
API: path.resolve('source/api'),
|
||||
},
|
||||
extensions: ['.js', '.ts', '.jsx', '.tsx', '.json'],
|
||||
},
|
||||
publicDir: 'source/static',
|
||||
plugins: [
|
||||
react({
|
||||
babel: {
|
||||
plugins: ['babel-plugin-styled-components'],
|
||||
},
|
||||
}),
|
||||
yaml(),
|
||||
toml,
|
||||
injectHtml(),
|
||||
],
|
||||
build: {},
|
||||
})
|
|
@ -0,0 +1,153 @@
|
|||
import yaml from '@rollup/plugin-yaml'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import path from 'path'
|
||||
import toml from 'rollup-plugin-toml'
|
||||
import { promises as fs } from 'fs'
|
||||
import { defineConfig, Plugin } from 'vite'
|
||||
import { watchDottedNames } from '../modele-social/build.js'
|
||||
|
||||
export default defineConfig({
|
||||
resolve: {
|
||||
alias: {
|
||||
Actions: path.resolve('source/actions/'),
|
||||
Components: path.resolve('source/components/'),
|
||||
Selectors: path.resolve('source/selectors/'),
|
||||
Reducers: path.resolve('source/reducers/'),
|
||||
Types: path.resolve('source/types/'),
|
||||
Images: path.resolve('source/images/'),
|
||||
DesignSystem: path.resolve('source/design-system'),
|
||||
Data: path.resolve('source/data'),
|
||||
Hooks: path.resolve('source/hooks'),
|
||||
API: path.resolve('source/api'),
|
||||
},
|
||||
extensions: ['.js', '.ts', '.jsx', '.tsx', '.json'],
|
||||
},
|
||||
root: 'source',
|
||||
plugins: [
|
||||
react({
|
||||
babel: {
|
||||
plugins: ['babel-plugin-styled-components'],
|
||||
},
|
||||
}),
|
||||
yaml(),
|
||||
toml,
|
||||
multipleSPA({
|
||||
defaultSite: 'mon-entreprise',
|
||||
templatePath: './source/template.html',
|
||||
sites: {
|
||||
'mon-entreprise': {
|
||||
entry: '/entry.fr.tsx',
|
||||
title:
|
||||
"mon-entreprise.urssaf.fr : L'assistant officiel du créateur d'entreprise",
|
||||
description:
|
||||
'Du statut juridique à la première embauche, en passant par la simulation des cotisations, vous trouverez ici toutes les ressources pour démarrer votre activité.',
|
||||
shareImage: 'https://mon-entreprise.urssaf.fr/images/logo-share.png',
|
||||
},
|
||||
infrance: {
|
||||
entry: '/entry.en.tsx',
|
||||
title:
|
||||
'My company in France: A step-by-step guide to start a business in France',
|
||||
description:
|
||||
'Find the type of company that suits you and follow the steps to register your company. Discover the French social security system by simulating your hiring costs. Discover the procedures to hire in France and learn the basics of French labour law.',
|
||||
shareImage:
|
||||
'https://mon-entreprise.urssaf.fr/images/logo-mycompany-share.png',
|
||||
},
|
||||
},
|
||||
}),
|
||||
],
|
||||
})
|
||||
|
||||
type MultipleSPAOptions = {
|
||||
defaultSite: string
|
||||
templatePath: string
|
||||
sites: Record<string, Record<string, string>>
|
||||
}
|
||||
|
||||
/**
|
||||
* A custom plugin to create multiple virtual html files from a template. Will
|
||||
* generate distinct entry points and single-page application outputs.
|
||||
*/
|
||||
function multipleSPA(options: MultipleSPAOptions): Plugin {
|
||||
const fillTemplate = async (siteName: string) => {
|
||||
const siteData = options.sites[siteName]
|
||||
const template = await fs.readFile(options.templatePath, 'utf-8')
|
||||
const filledTemplate = template
|
||||
.toString()
|
||||
.replace(/\{\{(.+)\}\}/g, (_match, p1) => siteData[p1.trim()])
|
||||
return filledTemplate
|
||||
}
|
||||
|
||||
return {
|
||||
name: 'multiple-spa',
|
||||
enforce: 'pre',
|
||||
|
||||
configureServer(vite) {
|
||||
// Small hack: This call shouldn't be here, but it's the easiest way to
|
||||
// start the watcher with the development server. We could use native
|
||||
// ViteJS watch API, but it would require changing more code and maybe the
|
||||
// whole "modele-social" package build process.
|
||||
watchDottedNames()
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
vite.middlewares.use(async (req, res, next) => {
|
||||
const url = req.originalUrl
|
||||
if (url === '/') {
|
||||
res.writeHead(302, { Location: '/' + options.defaultSite })
|
||||
res.end()
|
||||
} else if (
|
||||
url &&
|
||||
Object.keys(options.sites).some((name) =>
|
||||
url.slice(1).startsWith(name)
|
||||
)
|
||||
) {
|
||||
const siteName = url.slice(1).split('/')[0]
|
||||
const content = await vite.transformIndexHtml(
|
||||
'/',
|
||||
await fillTemplate(siteName),
|
||||
url
|
||||
)
|
||||
res.end(content)
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
config(config, { command }) {
|
||||
if (command === 'build' && !config.build?.ssr) {
|
||||
config.build = {
|
||||
...config.build,
|
||||
rollupOptions: {
|
||||
input: Object.fromEntries(
|
||||
Object.keys(options.sites).map((name) => [
|
||||
name,
|
||||
`virtual:${name}.html`,
|
||||
])
|
||||
),
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
resolveId(id) {
|
||||
const pathname = id.split('/').at(-1)
|
||||
if (pathname?.startsWith('virtual:')) {
|
||||
return pathname.replace('virtual:', '')
|
||||
}
|
||||
return null
|
||||
},
|
||||
|
||||
async load(id) {
|
||||
if (
|
||||
Object.keys(options.sites).some((name) => id.endsWith(name + '.html'))
|
||||
) {
|
||||
return await fillTemplate(
|
||||
id
|
||||
.split('/')
|
||||
.at(-1)
|
||||
.replace(/\.html$/, '')
|
||||
)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|