Remplace les ?s=xxx sur les deploy-preview par des noms de deploiement différents
https://deploy-preview-1477--syso.netlify.app\?s\=m devient https://1477-en--syso.netlify.apppull/1449/head
parent
2b589e0365
commit
11a742aade
|
@ -4,35 +4,33 @@ on:
|
|||
types: [opened, synchronize]
|
||||
push:
|
||||
branches: [master, demo, next]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
deploy-context:
|
||||
runs-on: ubuntu-18.04
|
||||
outputs:
|
||||
fr: ${{ env.FR_SITE }}
|
||||
en: ${{ env.EN_SITE }}
|
||||
publicodes: ${{ env.PUBLICODES_SITE }}
|
||||
steps:
|
||||
- name: Set branch name
|
||||
id: vars
|
||||
run: echo ::set-output name=branch::${GITHUB_REF#refs/*/}
|
||||
- if: github.event_name == 'pull_request'
|
||||
name: 'Set site name for pull request deploy'
|
||||
outputs:
|
||||
env-name: ${{ steps.deploy-env.outputs.name }}
|
||||
fr_url: ${{ steps.base-urls.outputs.fr }}
|
||||
en_url: ${{ steps.base-urls.outputs.en }}
|
||||
publicodes_url: ${{ steps.base-urls.outputs.publicodes }}
|
||||
steps:
|
||||
- id: deploy-env
|
||||
run:
|
||||
echo "FR_SITE=https://deploy-preview-${{ github.event.number }}--syso.netlify.app\${path}" >> $GITHUB_ENV;
|
||||
echo "EN_SITE=https://deploy-preview-${{ github.event.number }}--syso.netlify.app\${path}?s%3Dm" >> $GITHUB_ENV;
|
||||
echo "PUBLICODES_SITE=deploy-preview-${{ github.event.number }}--syso.netlify.app\${path}?s%3Dp" >> $GITHUB_ENV;
|
||||
- if: github.event_name == 'push' && github.ref != 'refs/heads/master'
|
||||
name: 'Set site name for named branch deploy'
|
||||
run:
|
||||
echo "FR_SITE=https://${{ steps.vars.outputs.branch }}.mon-entreprise.fr\${path}" >> $GITHUB_ENV;
|
||||
echo "EN_SITE=https://${{ steps.vars.outputs.branch }}.mon-entreprise.fr\${path}?s%3Dm" >> $GITHUB_ENV;
|
||||
echo "PUBLICODES_SITE=https://${{ steps.vars.outputs.branch }}.mon-entreprise.fr\${path}?s%3Dp" >> $GITHUB_ENV;
|
||||
- if: github.ref == 'refs/heads/master'
|
||||
name: 'Set site name for production deploy'
|
||||
run:
|
||||
echo "FR_SITE=https://mon-entreprise.fr\${path}" >> $GITHUB_ENV;
|
||||
echo "EN_SITE=https://mycompanyinfrance.fr\${path}" >> $GITHUB_ENV
|
||||
echo "PUBLICODES_SITE=https://publi.codes\${path}" >> $GITHUB_ENV
|
||||
echo "::set-output name=name::${{ github.event.number || '${GITHUB_REF#refs/*/}' }}"
|
||||
- id: base-urls
|
||||
run:
|
||||
echo "::set-output name=fr::${{ steps.deploy-env.outputs.name == 'master' && 'https://mon-entreprise.fr' || format('https://{0}--syso.netlify.app', steps.deploy-env.outputs.name) }}";
|
||||
echo "::set-output name=en::${{ steps.deploy-env.outputs.name == 'master' && 'https://mycompanyinfrance.fr' || format('https://{0}-en--syso.netlify.app', steps.deploy-env.outputs.name) }}";
|
||||
echo "::set-output name=publicodes::${{ steps.deploy-env.outputs.name == 'master' && 'https://publi.codes' || format('https://{0}-publicodes--syso.netlify.app', steps.deploy-env.outputs.name) }}";
|
||||
|
||||
build:
|
||||
needs: deploy-context
|
||||
env:
|
||||
FR_BASE_URL: ${{ needs.deploy-context.outputs.fr_url }}
|
||||
EN_BASE_URL: ${{ needs.deploy-context.outputs.en_url }}
|
||||
PUBLICODES_BASE_URL: ${{ needs.deploy-context.outputs.publicodes_url }}
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
|
@ -48,28 +46,74 @@ jobs:
|
|||
- name: Build app
|
||||
run: yarn workspace mon-entreprise build
|
||||
env:
|
||||
# Deploy dependant config (change for production settings)
|
||||
AT_INTERNET_SITE_ID: ${{ github.ref == 'refs/heads/master' && 617190 || 617189 }}
|
||||
AT_INTERNET_SITE_ID: ${{ needs.deploy-context.outputs.env-name == 'master' && 617190 || 617189 }}
|
||||
NODE_ENV: production
|
||||
- name: Deploy to Netlify
|
||||
id: deploy-netlify
|
||||
- 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;
|
||||
sed -i "s|:SITE_PUBLICODES|$PUBLICODES_BASE_URL|g" netlify.toml
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: static-site
|
||||
path: |
|
||||
mon-entreprise/dist/**
|
||||
netlify.toml
|
||||
if-no-files-found: error
|
||||
|
||||
deploy-preview:
|
||||
needs: [build, deploy-context]
|
||||
runs-on: ubuntu-18.04
|
||||
if: needs.deploy-context.outputs.env-name != 'master'
|
||||
strategy:
|
||||
matrix:
|
||||
site: ['', 'en', 'publicodes']
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: static-site
|
||||
- id: deploy-netlify
|
||||
uses: nwtgck/actions-netlify@v1.1
|
||||
with:
|
||||
publish-dir: './mon-entreprise/dist'
|
||||
netlify-config-path: ./netlify.toml
|
||||
production-branch: master
|
||||
production-deploy: ${{ github.ref == 'refs/heads/master' }}
|
||||
production-deploy: false
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
enable-commit-status: true
|
||||
enable-commit-comment: false
|
||||
github-deployment-environment: ${{ env.ENV_NAME }}
|
||||
alias: ${{ env.ENV_NAME }}
|
||||
deploy-message: ${{ github.event.pull_request.title || steps.vars.outputs.branch}}
|
||||
github-deployment-environment: ${{ needs.deploy-context.outputs.env-name }}
|
||||
alias: ${{ needs.deploy-context.outputs.env-name }}${{ matrix.site && format('-{0}', matrix.site) }}
|
||||
deploy-message: ${{ github.event.pull_request.title || needs.deploy-context.outputs.env-name }} (${{ matrix.site || 'fr' }})
|
||||
|
||||
# Disabled because we create our own customized comment
|
||||
enable-pull-request-comment: false
|
||||
env:
|
||||
ENV_NAME: ${{ github.event_name == 'push' && steps.vars.outputs.branch || format('deploy-preview-{0}', github.event.number) }}
|
||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
timeout-minutes: 1
|
||||
|
||||
deploy-prod:
|
||||
needs: [build, deploy-context]
|
||||
runs-on: ubuntu-18.04
|
||||
if: needs.deploy-context.outputs.env-name == 'master'
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: Static site
|
||||
- id: deploy-netlify
|
||||
uses: nwtgck/actions-netlify@v1.1
|
||||
with:
|
||||
publish-dir: './mon-entreprise/dist'
|
||||
netlify-config-path: ./netlify.toml
|
||||
production-deploy: true
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
enable-commit-status: true
|
||||
enable-commit-comment: false
|
||||
github-deployment-environment: master
|
||||
deploy-message: Deploy production branch
|
||||
env:
|
||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
timeout-minutes: 1
|
||||
|
@ -77,7 +121,7 @@ jobs:
|
|||
post-comment:
|
||||
runs-on: ubuntu-18.04
|
||||
if: github.event_name == 'pull_request'
|
||||
needs: build
|
||||
needs: [deploy-preview, deploy-context]
|
||||
steps:
|
||||
- name: Find Comment
|
||||
uses: peter-evans/find-comment@v1
|
||||
|
@ -87,57 +131,80 @@ jobs:
|
|||
comment-author: 'github-actions[bot]'
|
||||
body-includes: netlify
|
||||
- name: Create comment
|
||||
if: steps.find-comment.outputs.comment-id == 0
|
||||
uses: peter-evans/create-or-update-comment@v1
|
||||
with:
|
||||
comment-id: ${{ steps.find-comment.outputs.comment-id }}
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
edit-mode: replace
|
||||
body: |
|
||||
🚀 La branche est déployée ! ${{ steps.deploy-netlify.outputs.deploy-url }}
|
||||
|
||||
_Voir aussi : [version anglaise](${{ steps.deploy-netlify.outputs.deploy-url }}?s=m) | [site publicodes](${{ steps.deploy-netlify.outputs.deploy-url }}?s=p)_
|
||||
🚀 La branche est déployée !
|
||||
|
||||
- mon-entreprise : ${{ needs.deploy-context.outputs.fr_url }}
|
||||
- mycompanyinfrance : ${{ needs.deploy-context.outputs.en_url }}
|
||||
- publicodes : ${{ needs.deploy-context.outputs.publicodes_url }}
|
||||
|
||||
|
||||
end-to-end-test:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
||||
runs-on: ubuntu-16.04
|
||||
needs: build
|
||||
# We need to specify always() https://github.com/actions/runner/issues/491
|
||||
if: always() && (needs.deploy-prod.result == 'success' || needs.deploy-preview.result == 'success')
|
||||
needs: [deploy-context, deploy-prod, deploy-preview]
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
lang: ['fr', 'en']
|
||||
site: ['fr', 'en', 'publicodes']
|
||||
include:
|
||||
- site: fr
|
||||
integrationFolder: mon-entreprise
|
||||
baseUrl: ${{ needs.deploy-context.outputs.fr_url }}
|
||||
language: fr
|
||||
test-external: ${{ needs.deploy-context.outputs.env-name == 'master' }}
|
||||
- site: en
|
||||
integrationFolder: mon-entreprise
|
||||
baseUrl: ${{ needs.deploy-context.outputs.en_url }}
|
||||
language: en
|
||||
- site: publicodes
|
||||
baseUrl: ${{ needs.deploy-context.outputs.publicodes_url }}
|
||||
integrationFolder: publi.codes
|
||||
language: fr
|
||||
|
||||
# TODO : activate parallelization https://github.com/cypress-io/github-action#parallel (missing https://github.com/cypress-io/github-action#custom-build-id)
|
||||
# containers: [1, 2]
|
||||
# TODO : browser: ['firefox', 'chrome']
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- uses: actions/cache@v2
|
||||
# Custom cache as we do not care about installing all the other dependancies
|
||||
with:
|
||||
path: |
|
||||
~/.cache/Cypress
|
||||
node_modules
|
||||
key: cypress-cache-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
|
||||
- run: npm i cypress cypress-plugin-tab
|
||||
- name: Test mon-entreprise
|
||||
uses: cypress-io/github-action@v2
|
||||
if: matrix.lang == 'fr' || !github.event.pull_request
|
||||
with:
|
||||
install: false
|
||||
working-directory: mon-entreprise
|
||||
record: true
|
||||
tag: mon-entreprise-${{ matrix.lang }}
|
||||
config: integrationFolder=cypress/integration/mon-entreprise
|
||||
env: site=${{ needs.build.outputs[matrix.lang] }},language=${{ matrix.lang }}
|
||||
tag: ${{ matrix.site }},${{ needs.deploy-context.outputs.env-name }}-deploy
|
||||
config: integrationFolder=cypress/integration/${{ matrix.integrationFolder }},baseUrl=${{ matrix.baseUrl }}
|
||||
env: language=${{ matrix.language }}
|
||||
env:
|
||||
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }}
|
||||
|
||||
- name: Test publicodes
|
||||
if: matrix.lang == 'fr'
|
||||
uses: cypress-io/github-action@v2
|
||||
with:
|
||||
record: true
|
||||
tag: publicodes
|
||||
config: integrationFolder=cypress/integration/publi.codes
|
||||
env: site=${{ needs.build.outputs.publicodes }}
|
||||
|
||||
- name: Test external integration
|
||||
if: matrix.lang == 'fr' && github.ref == 'refs/heads/master'
|
||||
if: matrix.test-external
|
||||
uses: cypress-io/github-action@v2
|
||||
with:
|
||||
browser: chrome
|
||||
install: false
|
||||
record: true
|
||||
tag: external-integration
|
||||
config: integrationFolder=cypress/integration/external
|
||||
config: integrationFolder=cypress/integration/external, baseUrl=${{ matrix.baseUrl }}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
name: Tests
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-18.04
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"projectId": "jxcngh",
|
||||
"baseUrl": "http://localhost:8080/mon-entreprise",
|
||||
"env": {
|
||||
"site": "http://localhost:8080/mon-entreprise/${path}",
|
||||
"language": "fr"
|
||||
},
|
||||
"integrationFolder": "cypress/integration/mon-entreprise",
|
||||
|
|
|
@ -10,11 +10,7 @@ describe('Page covid-19', function () {
|
|||
if (!fr) {
|
||||
return
|
||||
}
|
||||
before(() =>
|
||||
cy.visit(
|
||||
Cypress.env('site').replace('${path}', '/simulateurs/chômage-partiel')
|
||||
)
|
||||
)
|
||||
before(() => cy.visit('/simulateurs/chômage-partiel'))
|
||||
it('should not crash', () => {
|
||||
cy.contains('Salaire brut mensuel')
|
||||
})
|
||||
|
|
|
@ -4,9 +4,7 @@ describe('Formulaire demande mobilité', function () {
|
|||
if (!fr) {
|
||||
return
|
||||
}
|
||||
before(() =>
|
||||
cy.visit(Cypress.env('site').replace('${path}', '/gérer/demande-mobilité'))
|
||||
)
|
||||
before(() => cy.visit('/gérer/demande-mobilité'))
|
||||
it('should not crash', () => {
|
||||
cy.contains('Demande de mobilité internationale')
|
||||
})
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
describe('Manage page test', function () {
|
||||
const fr = Cypress.env('language') === 'fr'
|
||||
beforeEach(() => {
|
||||
cy.visit(Cypress.env('site').replace('${path}', fr ? '/gérer' : '/manage'))
|
||||
cy.visit(fr ? '/gérer' : '/manage')
|
||||
})
|
||||
it('should not crash', function () {
|
||||
cy.contains(fr ? 'Gérer mon activité' : 'Manage my business')
|
||||
|
|
|
@ -3,7 +3,7 @@ describe('Iframe integration test', function () {
|
|||
return
|
||||
}
|
||||
it('should display an iframe of the simulateur', function () {
|
||||
cy.visit(Cypress.env('site').replace('${path}', '/dev/integration-test'))
|
||||
cy.visit('/dev/integration-test')
|
||||
cy.contains('Visualiser').click()
|
||||
cy.wait(1000)
|
||||
cy.get('#simulateurEmbauche').iframe().contains('Salaire net')
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
describe('Landing test', function () {
|
||||
const fr = Cypress.env('language') === 'fr'
|
||||
it('should not crash', function () {
|
||||
cy.visit(Cypress.env('site').replace('${path}', '/'))
|
||||
cy.visit('/')
|
||||
cy.get('img[alt="logo mon-entreprise.fr"]').should('be.visible')
|
||||
})
|
||||
it('should display urssaf and marianne logo', function () {
|
||||
cy.visit(Cypress.env('site').replace('${path}', '/'))
|
||||
cy.visit('/')
|
||||
cy.get('img[alt="logo urssaf"]').should('be.visible')
|
||||
cy.get('img[alt="logo marianne"]').should('be.visible')
|
||||
})
|
||||
it('should display actionnable items', function () {
|
||||
cy.visit(Cypress.env('site').replace('${path}', '/'))
|
||||
cy.visit('/')
|
||||
cy.contains(fr ? 'Créer une entreprise' : 'Create a company')
|
||||
cy.contains(fr ? 'Gérer mon activité' : 'Manage my business')
|
||||
})
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
describe('Navigation', function () {
|
||||
const fr = Cypress.env('language') === 'fr'
|
||||
it('should enable switching site language', () => {
|
||||
cy.visit(
|
||||
Cypress.env('site').replace(
|
||||
'${path}',
|
||||
fr ? '/créer/auto-entrepreneur' : '/create/auto-entrepreneur'
|
||||
)
|
||||
)
|
||||
cy.visit(fr ? '/créer/auto-entrepreneur' : '/create/auto-entrepreneur')
|
||||
cy.contains(fr ? 'Switch to English' : 'Passer en français').click()
|
||||
cy.url().should(
|
||||
'include',
|
||||
|
@ -15,9 +10,7 @@ describe('Navigation', function () {
|
|||
})
|
||||
|
||||
it('should go back to home when clicking on logo', () => {
|
||||
cy.visit(
|
||||
Cypress.env('site').replace('${path}', '/documentation/contrat-salarié')
|
||||
)
|
||||
cy.visit('/documentation/contrat-salarié')
|
||||
cy.get('img[alt^="logo mon-entreprise"]').click()
|
||||
cy.url().should('be', Cypress.baseUrl)
|
||||
})
|
||||
|
|
|
@ -17,11 +17,7 @@ describe('Simulateurs', function () {
|
|||
'profession-liberale/chirurgien-dentiste',
|
||||
].forEach((simulateur) =>
|
||||
describe(simulateur, () => {
|
||||
before(() =>
|
||||
cy.visit(
|
||||
Cypress.env('site').replace('${path}', `/simulateurs/${simulateur}`)
|
||||
)
|
||||
)
|
||||
before(() => cy.visit(`/simulateurs/${simulateur}`))
|
||||
it('should not crash', function () {
|
||||
cy.get(inputSelector)
|
||||
})
|
||||
|
@ -84,11 +80,7 @@ describe('Simulateur auto-entrepreneur', () => {
|
|||
if (!fr) {
|
||||
return
|
||||
}
|
||||
before(() =>
|
||||
cy.visit(
|
||||
Cypress.env('site').replace('${path}', '/simulateurs/auto-entrepreneur')
|
||||
)
|
||||
)
|
||||
before(() => cy.visit('/simulateurs/auto-entrepreneur'))
|
||||
|
||||
it('should allow to enter the date of creation', () => {
|
||||
cy.get(inputSelector).first().type('{selectall}50000')
|
||||
|
@ -123,7 +115,7 @@ describe('Simulateur salarié mode partagé', () => {
|
|||
return
|
||||
}
|
||||
it('should set input value from URL', function () {
|
||||
cy.visit(Cypress.env('site').replace('${path}', urlWithState))
|
||||
cy.visit(urlWithState)
|
||||
cy.wait(800)
|
||||
cy.get(brutInputSelector).first().invoke('val').should('be', '1 539')
|
||||
|
||||
|
@ -131,7 +123,7 @@ describe('Simulateur salarié mode partagé', () => {
|
|||
cy.get('span.answerContent').first().contains('CDD')
|
||||
})
|
||||
it('should set URL from input value', function () {
|
||||
cy.visit(Cypress.env('site').replace('${path}', simulatorUrl))
|
||||
cy.visit(simulatorUrl)
|
||||
cy.get(brutInputSelector).first().type('{selectall}1539')
|
||||
cy.wait(1000)
|
||||
cy.get('.step').find('input[value="\'CDD\'"]').click({ force: true })
|
||||
|
@ -147,9 +139,7 @@ describe('Simulateur salarié', () => {
|
|||
if (!fr) {
|
||||
return
|
||||
}
|
||||
before(() =>
|
||||
cy.visit(Cypress.env('site').replace('${path}', '/simulateurs/salarié'))
|
||||
)
|
||||
before(() => cy.visit('/simulateurs/salarié'))
|
||||
|
||||
it('should persist the current simulation (persistSimulation)', function () {
|
||||
cy.get(inputSelector).first().type('{selectall}42')
|
||||
|
@ -157,15 +147,13 @@ describe('Simulateur salarié', () => {
|
|||
cy.contains('Passer').click()
|
||||
cy.contains('Passer').click()
|
||||
cy.wait(1600)
|
||||
cy.visit(
|
||||
Cypress.env('site').replace('${path}', '/simulateurs/auto-entrepreneur')
|
||||
)
|
||||
cy.visit('/simulateurs/auto-entrepreneur')
|
||||
cy.get(inputSelector).first().type('{selectall}007')
|
||||
cy.contains('Passer').click()
|
||||
cy.contains('Passer').click()
|
||||
cy.contains('Passer').click()
|
||||
cy.wait(1600)
|
||||
cy.visit(Cypress.env('site').replace('${path}', '/simulateurs/salarié'))
|
||||
cy.visit('/simulateurs/salarié')
|
||||
cy.contains('Retrouver ma simulation').click()
|
||||
cy.get(inputSelector).first().invoke('val').should('match', /42/)
|
||||
})
|
||||
|
@ -181,7 +169,7 @@ describe('Simulateur salarié', () => {
|
|||
|
||||
describe('part time contract', () => {
|
||||
before(() => {
|
||||
cy.visit(Cypress.env('site').replace('${path}', '/simulateurs/salarié'))
|
||||
cy.visit('/simulateurs/salarié')
|
||||
cy.get('input[name$="brut de base"]').click()
|
||||
cy.get('button').contains('SMIC').click()
|
||||
cy.contains('Voir mes paramètres').click()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
describe('Status guide', function () {
|
||||
const fr = Cypress.env('language') === 'fr'
|
||||
beforeEach(() => {
|
||||
cy.visit(Cypress.env('site').replace('${path}', fr ? '/créer' : '/create'))
|
||||
cy.visit(fr ? '/créer' : '/create')
|
||||
cy.get('.cta').click()
|
||||
})
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
describe('Navigation', function () {
|
||||
it('landing should not crash', function () {
|
||||
cy.visit(Cypress.env('site').replace('${path}', '/'))
|
||||
cy.visit('/')
|
||||
})
|
||||
it('liste des mécanismes should not crash', function () {
|
||||
cy.contains('Documentation').click()
|
||||
|
|
|
@ -108,7 +108,7 @@
|
|||
"build:legacy": "yarn run webpack --config webpack.prod.legacyBrowser.js",
|
||||
"build:stats": "webpack --config webpack.prod.js --profile --json > stats.json",
|
||||
"build:analyze-bundle": "ANALYZE_BUNDLE=1 yarn run build",
|
||||
"build:dev": "FR_SITE='http://localhost:5000${path}' EN_SITE='http://localhost:5001${path}' yarn run build",
|
||||
"build:dev": "FR_BASE_URL='http://localhost:5000${path}' EN_BASE_URL='http://localhost:5001${path}' yarn run build",
|
||||
"clean": "rimraf dist node_modules source/data",
|
||||
"test": "yarn test:file \"./{,!(node_modules)/**/}!(webpack).test.{js,ts}\"",
|
||||
"test:file": "yarn mocha-webpack --webpack-config ./webpack.dev.js --include test/componentTestSetup.js --require mock-local-storage --require test/helpers/browser.js",
|
||||
|
|
|
@ -12,10 +12,9 @@ let script =
|
|||
fr = lang === 'fr',
|
||||
baseUrl =
|
||||
script.dataset.iframeUrl ||
|
||||
(fr ? process.env.FR_SITE : process.env.EN_SITE).replace(
|
||||
'${path}',
|
||||
'/iframes/' + moduleName
|
||||
),
|
||||
(fr ? process.env.FR_BASE_URL : process.env.EN_BASE_URL) +
|
||||
'/iframes/' +
|
||||
moduleName,
|
||||
integratorUrl = encodeURIComponent(window.location.href.toString()),
|
||||
src =
|
||||
baseUrl +
|
||||
|
@ -50,10 +49,9 @@ const moduleToSitePath = {
|
|||
'simulateur-independant': '/simulateurs/indépendant',
|
||||
'simulateur-dirigeantsasu': '/simulateurs/dirigeant-sasu',
|
||||
}
|
||||
const simulateurLink = process.env.FR_SITE.replace(
|
||||
'${path}',
|
||||
moduleToSitePath[moduleName] ?? ''
|
||||
)
|
||||
const simulateurLink =
|
||||
process.env.FR_BASE_URL + moduleToSitePath[moduleName] ?? ''
|
||||
|
||||
const url = new URL(simulateurLink, window.location.origin)
|
||||
const params = new URLSearchParams(url.search)
|
||||
params.append('utm_source', 'iframe')
|
||||
|
@ -76,17 +74,14 @@ links.innerHTML = `
|
|||
<a href="${monEntrepriseUrl}">
|
||||
<img
|
||||
style="height: 40px; margin: 10px"
|
||||
src="${process.env.FR_SITE.replace(
|
||||
'${path}',
|
||||
'/' + (lang === 'fr' ? logoFrSvg : logoEnSvg)
|
||||
)}"
|
||||
src="${process.env.FR_BASE_URL + '/' + (lang === 'fr' ? logoFrSvg : logoEnSvg)}"
|
||||
alt="mon-entreprise.fr : l'assistant officiel du créateur d'entreprise"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://www.urssaf.fr">
|
||||
<img
|
||||
style="height: 40px; margin: 10px"
|
||||
src="${process.env.FR_SITE.replace('${path}', '/' + urssafSvg)}"
|
||||
src="${process.env.FR_BASE_URL + '/' + urssafSvg}"
|
||||
alt="un service fourni par l'Urssaf"
|
||||
/>
|
||||
</a>
|
||||
|
|
|
@ -3,11 +3,9 @@ import netlifyToml from '../../netlify.toml'
|
|||
|
||||
export default netlifyToml.redirects
|
||||
.filter(({ from, status }) => status === 301 && !from.startsWith('https'))
|
||||
.map(({ from, to }) => (
|
||||
<Redirect
|
||||
key={from}
|
||||
from={decodeURIComponent(from)}
|
||||
to={decodeURIComponent(to.replace(':splat', '*'))}
|
||||
exact
|
||||
/>
|
||||
))
|
||||
.map(({ from, to }) => ({
|
||||
from: decodeURIComponent(from.replace(/^:.*\//, '')),
|
||||
to: decodeURIComponent(to.replace(/^:.*\//, '').replace(':splat', '*')),
|
||||
}))
|
||||
.filter(({ from, to }) => from != to)
|
||||
.map((props) => <Redirect key={props.from} {...props} exact />)
|
||||
|
|
|
@ -187,12 +187,12 @@ export const generateSiteMap = (sitePaths: SitePathsType): SiteMap =>
|
|||
sitePaths
|
||||
)
|
||||
|
||||
const enSiteMap = generateSiteMap(
|
||||
constructLocalizedSitePath('en')
|
||||
).map((path) => (process.env.EN_SITE || '').replace('${path}', path))
|
||||
const frSiteMap = generateSiteMap(
|
||||
constructLocalizedSitePath('fr')
|
||||
).map((path) => (process.env.FR_SITE || '').replace('${path}', path))
|
||||
const enSiteMap = generateSiteMap(constructLocalizedSitePath('en')).map(
|
||||
(path) => process.env.EN_BASE_URL + path
|
||||
)
|
||||
const frSiteMap = generateSiteMap(constructLocalizedSitePath('fr')).map(
|
||||
(path) => process.env.FR_BASE_URL + path
|
||||
)
|
||||
|
||||
export const hrefLangLink = {
|
||||
en: zipObj(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
declare namespace NodeJS {
|
||||
interface ProcessEnv {
|
||||
EN_SITE: string
|
||||
FR_SITE: string
|
||||
EN_BASE_URL: string
|
||||
FR_BASE_URL: string
|
||||
NODE_ENV: 'development' | 'production' | 'test'
|
||||
ANALYZE_BUNDLE: '0' | '1'
|
||||
|
||||
|
|
|
@ -127,8 +127,8 @@ module.exports.default = {
|
|||
plugins: [
|
||||
new MonacoWebpackPlugin(),
|
||||
new EnvironmentPlugin({
|
||||
EN_SITE: '/infrance${path}',
|
||||
FR_SITE: '/mon-entreprise${path}',
|
||||
EN_BASE_URL: 'http://localhost:8080/infrance',
|
||||
FR_BASE_URL: 'http://localhost:8080/mon-entreprise',
|
||||
AT_INTERNET_SITE_ID: '',
|
||||
}),
|
||||
new EnvironmentPlugin({
|
||||
|
|
|
@ -23,8 +23,8 @@ module.exports = {
|
|||
GITHUB_SHA: '',
|
||||
}),
|
||||
new EnvironmentPlugin({
|
||||
EN_SITE: '/infrance${path}',
|
||||
FR_SITE: '/mon-entreprise${path}',
|
||||
EN_BASE_URL: 'http://localhost:8080/infrance',
|
||||
FR_BASE_URL: 'http://localhost:8080/mon-entreprise',
|
||||
}),
|
||||
],
|
||||
}
|
||||
|
|
212
netlify.toml
212
netlify.toml
|
@ -1,143 +1,57 @@
|
|||
############
|
||||
# Redirects following architectural changes
|
||||
|
||||
# :SITE_<name> is a placeholder replaced before deploy (depends on the environment)
|
||||
|
||||
# FR | coronavirus -> simulateurs/chômage-partiel
|
||||
[[redirects]]
|
||||
from="/coronavirus"
|
||||
to="/simulateurs/ch%C3%B4mage-partiel"
|
||||
from=":SITE_FR/coronavirus"
|
||||
to=":SITE_FR/simulateurs/ch%C3%B4mage-partiel"
|
||||
status = 301
|
||||
|
||||
[[redirects]]
|
||||
from="/%C3%A9conomie-collaborative"
|
||||
to="/simulateurs/%C3%A9conomie-collaborative"
|
||||
from=":SITE_FR/%C3%A9conomie-collaborative"
|
||||
to=":SITE_FR/simulateurs/%C3%A9conomie-collaborative"
|
||||
status = 301
|
||||
|
||||
# EN | salaried -> salary
|
||||
[[redirects]]
|
||||
from="/simulators/salaried"
|
||||
to="/calcultors/salary"
|
||||
status = 301
|
||||
|
||||
# EN | simulators -> calculators
|
||||
[[redirects]]
|
||||
from="/simulators/*"
|
||||
to="/calcultors/:splat"
|
||||
status = 301
|
||||
|
||||
|
||||
# FR | salarié -> salaire-brut-net
|
||||
[[redirects]]
|
||||
from="/simulateurs/salari%C3%A9"
|
||||
to="/simulateurs/salaire-brut-net"
|
||||
from=":SITE_FR/simulateurs/salari%C3%A9"
|
||||
to=":SITE_FR/simulateurs/salaire-brut-net"
|
||||
status = 301
|
||||
|
||||
# FR | assimilé-salarié -> dirigeant-sasu
|
||||
[[redirects]]
|
||||
from="/simulateurs/assimil%C3%A9-salari%C3%A9"
|
||||
to="/simulateurs/dirigeant-sasu"
|
||||
from=":SITE_FR/simulateurs/assimil%C3%A9-salari%C3%A9"
|
||||
to=":SITE_FR/simulateurs/dirigeant-sasu"
|
||||
status = 301
|
||||
|
||||
# FR | s%C3%A9curit%C3%A9-sociale/auto-entrepreneur -> simulateurs/auto-entrepreneur
|
||||
[[redirects]]
|
||||
from="/s%C3%A9curit%C3%A9-sociale/auto-entrepreneur"
|
||||
to="/simulateurs/auto-entrepreneur"
|
||||
from=":SITE_FR/s%C3%A9curit%C3%A9-sociale/auto-entrepreneur"
|
||||
to=":SITE_FR/simulateurs/auto-entrepreneur"
|
||||
status = 301
|
||||
|
||||
# FR | sécurité-social/salarié -> simulateurs/salaire-brut-net
|
||||
[[redirects]]
|
||||
from="/s%C3%A9curit%C3%A9-sociale/salari%C3%A9"
|
||||
to="/simulateurs/salaire-brut-net"
|
||||
from=":SITE_FR/s%C3%A9curit%C3%A9-sociale/salari%C3%A9"
|
||||
to=":SITE_FR/simulateurs/salaire-brut-net"
|
||||
statys = 301
|
||||
|
||||
# FR | sécurité-social/salarié -> simulateurs/salaire-brut-net
|
||||
[[redirects]]
|
||||
from="/s%C3%A9curit%C3%A9-sociale/salari%C3%A9"
|
||||
to="/simulateurs/salaire-brut-net"
|
||||
from=":SITE_FR/s%C3%A9curit%C3%A9-sociale/salari%C3%A9"
|
||||
to=":SITE_FR/simulateurs/salaire-brut-net"
|
||||
status = 301
|
||||
|
||||
# SEO redirect
|
||||
[[redirects]]
|
||||
from = "/documentation/contrat-salari%C3%A9/salaire/*"
|
||||
to = "/documentation/contrat-salari%C3%A9/r%C3%A9mun%C3%A9ration/:splat"
|
||||
from = ":SITE_FR/documentation/contrat-salari%C3%A9/salaire/*"
|
||||
to = ":SITE_FR/documentation/contrat-salari%C3%A9/r%C3%A9mun%C3%A9ration/:splat"
|
||||
status = 301
|
||||
|
||||
############
|
||||
# Redirects for single page app config & prerendering purpose
|
||||
|
||||
# Mycompanyinfrance
|
||||
[[redirects]]
|
||||
from = "https://www.mycompanyinfrance.fr/*"
|
||||
to = "https://mycompanyinfrance.fr/:splat"
|
||||
status = 301
|
||||
|
||||
[[redirects]]
|
||||
from = "https://www.mycompanyinfrance.com/*"
|
||||
to = "https://mycompanyinfrance.fr/:splat"
|
||||
status = 301
|
||||
|
||||
[[redirects]]
|
||||
from = "https://mycompanyinfrance.com/*"
|
||||
to = "https://mycompanyinfrance.fr/:splat"
|
||||
status = 301
|
||||
|
||||
[[redirects]]
|
||||
from = "https://mycompanyinfrance.fr/robots.txt"
|
||||
to = "/robots.infrance.txt"
|
||||
status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = "https://mycompanyinfrance.fr/sitemap.txt"
|
||||
to = "/sitemap.infrance.en.txt"
|
||||
status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = "https://mycompanyinfrance.fr"
|
||||
to = "/prerender/infrance/index.html"
|
||||
status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = "https://mycompanyinfrance.fr/calculators/salary"
|
||||
to = "/prerender/infrance/calculators/salary/index.html"
|
||||
status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = "https://mycompanyinfrance.fr/iframes/simulateur-embauche"
|
||||
to = "/prerender/infrance/iframes/simulateur-embauche/index.html"
|
||||
status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = "https://mycompanyinfrance.fr/*"
|
||||
to = "/infrance.html"
|
||||
status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = "/"
|
||||
query = {s = "m"}
|
||||
to = "/prerender/infrance/index.html"
|
||||
status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = "/*"
|
||||
query = {s = "m"}
|
||||
to = "/infrance.html"
|
||||
status = 200
|
||||
|
||||
|
||||
# Publicode
|
||||
[[redirects]]
|
||||
from = "https://publi.codes/*"
|
||||
to = "/publicodes.html"
|
||||
status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = "/*"
|
||||
query = {s = "p"}
|
||||
to = "/publicodes.html"
|
||||
status = 200
|
||||
|
||||
|
||||
# Embauche redirection settings
|
||||
|
||||
[[redirects]]
|
||||
from = "https://embauche.beta.gouv.fr/"
|
||||
to = "https://mon-entreprise.fr/s%C3%A9curit%C3%A9-sociale/salari%C3%A9"
|
||||
|
@ -165,80 +79,138 @@
|
|||
status = 301
|
||||
|
||||
|
||||
############
|
||||
# Redirects for single page app config & prerendering purpose
|
||||
|
||||
|
||||
# Publicode
|
||||
[[redirects]]
|
||||
from = ":SITE_PUBLICODES/*"
|
||||
to = "/publicodes.html"
|
||||
status = 200
|
||||
|
||||
|
||||
# Mon-entreprise.fr
|
||||
[[redirects]]
|
||||
from = "https://mon-entreprise.fr/robots.txt"
|
||||
from = ":SITE_FR/robots.txt"
|
||||
to = "/robots.infrance.txt"
|
||||
status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = "https://mon-entreprise.fr/sitemap.txt"
|
||||
from = ":SITE_FR/sitemap.txt"
|
||||
to = "/sitemap.infrance.fr.txt"
|
||||
status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = "/"
|
||||
from = ":SITE_FR"
|
||||
to = "/prerender/mon-entreprise/index.html"
|
||||
status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = "/cr%C3%A9er"
|
||||
from = ":SITE_FR/cr%C3%A9er"
|
||||
to = "/prerender/mon-entreprise/cr%C3%A9er/index.html"
|
||||
status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = "/g%C3%A9rer"
|
||||
from = ":SITE_FR/g%C3%A9rer"
|
||||
to = "/prerender/mon-entreprise/g%C3%A9rer/index.html"
|
||||
status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = "/simulateurs/ch%C3%B4mage-partiel"
|
||||
from = ":SITE_FR/simulateurs/ch%C3%B4mage-partiel"
|
||||
to = "/prerender/mon-entreprise/simulateurs/ch%C3%B4mage-partiel/index.html"
|
||||
status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = "/simulateurs/salaire-brut-net"
|
||||
from = ":SITE_FR/simulateurs/salaire-brut-net"
|
||||
to = "/prerender/mon-entreprise/simulateurs/salaire-brut-net/index.html"
|
||||
status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = "/simulateurs/auto-entrepreneur"
|
||||
from = ":SITE_FR/simulateurs/auto-entrepreneur"
|
||||
to = "/prerender/mon-entreprise/simulateurs/auto-entrepreneur/index.html"
|
||||
status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = "/simulateurs/ind%C3%A9pendant"
|
||||
from = ":SITE_FR/simulateurs/ind%C3%A9pendant"
|
||||
to = "/prerender/mon-entreprise/simulateurs/ind%C3%A9pendant/index.html"
|
||||
status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = "/simulateurs/dirigeant-sasu"
|
||||
from = ":SITE_FR/simulateurs/dirigeant-sasu"
|
||||
to = "/prerender/mon-entreprise/simulateurs/dirigeant-sasu/index.html"
|
||||
status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = "/simulateurs/artiste-auteur"
|
||||
from = ":SITE_FR/simulateurs/artiste-auteur"
|
||||
to = "/prerender/mon-entreprise/simulateurs/artiste-auteur/index.html"
|
||||
status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = "/iframes/simulateur-embauche"
|
||||
from = ":SITE_FR/iframes/simulateur-embauche"
|
||||
to = "/prerender/mon-entreprise/iframes/simulateur-embauche/index.html"
|
||||
status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = "/iframes/simulateur-chomage-partiel"
|
||||
from = ":SITE_FR/iframes/simulateur-chomage-partiel"
|
||||
to = "/prerender/mon-entreprise/iframes/simulateur-chomage-partiel/index.html"
|
||||
status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = "/iframes/pamc"
|
||||
from = ":SITE_FR/iframes/pamc"
|
||||
to = "/prerender/mon-entreprise/iframes/pamc/index.html"
|
||||
status = 200
|
||||
|
||||
|
||||
[[redirects]]
|
||||
from = "/*"
|
||||
from = ":SITE_FR/*"
|
||||
to = "/mon-entreprise.html"
|
||||
status = 200
|
||||
|
||||
|
||||
# Mycompanyinfrance
|
||||
|
||||
[[redirects]]
|
||||
from = "https://www.mycompanyinfrance.fr/*"
|
||||
to = "https://mycompanyinfrance.fr/:splat"
|
||||
status = 301
|
||||
|
||||
[[redirects]]
|
||||
from = "https://www.mycompanyinfrance.com/*"
|
||||
to = "https://mycompanyinfrance.fr/:splat"
|
||||
status = 301
|
||||
|
||||
[[redirects]]
|
||||
from = "https://mycompanyinfrance.com/*"
|
||||
to = "https://mycompanyinfrance.fr/:splat"
|
||||
status = 301
|
||||
|
||||
|
||||
[[redirects]]
|
||||
from = ":SITE_EN/robots.txt"
|
||||
to = "/robots.infrance.txt"
|
||||
status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = ":SITE_EN/sitemap.txt"
|
||||
to = "/sitemap.infrance.en.txt"
|
||||
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/iframes/simulateur-embauche"
|
||||
to = "/prerender/infrance/iframes/simulateur-embauche/index.html"
|
||||
status = 200
|
||||
|
||||
[[redirects]]
|
||||
from = ":SITE_EN/*"
|
||||
to = "/infrance.html"
|
||||
status = 200
|
||||
|
|
Loading…
Reference in New Issue