✅ Prettier s'occupe aussi des scripts
parent
b91e2b1753
commit
800ade5a0a
|
@ -71,7 +71,7 @@ module.exports = {
|
|||
|
||||
// A map from regular expressions to module names that allow to stub out resources with a single module
|
||||
moduleNameMapper: {
|
||||
'\\.css$': 'mon-entreprise/test/regressions/styleMock.js'
|
||||
'\\.css$': 'mon-entreprise/test/regressions/styleMock.js',
|
||||
},
|
||||
|
||||
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
|
||||
|
@ -164,12 +164,12 @@ module.exports = {
|
|||
// ie ['jest-transform-nearley', 'babel-jest'], so we removed ES6 module from nearley output.
|
||||
'\\.ne$': require.resolve('jest-transform-nearley'),
|
||||
'\\.yaml$': require.resolve('yaml-jest'),
|
||||
'\\.(js|tsx?)$': require.resolve('babel-jest')
|
||||
'\\.(js|tsx?)$': require.resolve('babel-jest'),
|
||||
},
|
||||
|
||||
// An array of regexp pattern strings that are matched against all source file
|
||||
// paths, matched files will skip transformation
|
||||
transformIgnorePatterns: ['node_modules/(?!ramda|publicodes)/']
|
||||
transformIgnorePatterns: ['node_modules/(?!ramda|publicodes)/'],
|
||||
|
||||
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
|
||||
// unmockedModulePathPatterns: undefined,
|
||||
|
|
|
@ -32,19 +32,19 @@ const query = `query {
|
|||
const fakeData = [
|
||||
{
|
||||
name: 'Fake release',
|
||||
descriptionHTML: `You are seing this fake release because you
|
||||
descriptionHTML: `You are seing this fake release because you
|
||||
didn't configure your GitHub access token and we weren't
|
||||
able to fetch the real releases from GitHub.<br /><br />
|
||||
See the script <pre>fetch-releases.js</pre> for more informations.`
|
||||
See the script <pre>fetch-releases.js</pre> for more informations.`,
|
||||
},
|
||||
{
|
||||
name: 'Release 2',
|
||||
descriptionHTML: 'blah blah blah'
|
||||
descriptionHTML: 'blah blah blah',
|
||||
},
|
||||
{
|
||||
name: 'Release 3',
|
||||
descriptionHTML: 'blah blah blah'
|
||||
}
|
||||
descriptionHTML: 'blah blah blah',
|
||||
},
|
||||
]
|
||||
|
||||
async function main() {
|
||||
|
@ -66,14 +66,14 @@ async function fetchReleases() {
|
|||
const response = await fetch('https://api.github.com/graphql', {
|
||||
method: 'post',
|
||||
headers: new Headers({ Authorization: `bearer ${githubAuthToken}` }),
|
||||
body: JSON.stringify({ query })
|
||||
body: JSON.stringify({ query }),
|
||||
})
|
||||
const {
|
||||
data: {
|
||||
repository: {
|
||||
releases: { nodes: releases }
|
||||
}
|
||||
}
|
||||
releases: { nodes: releases },
|
||||
},
|
||||
},
|
||||
} = await response.json()
|
||||
return releases.filter(Boolean).reverse()
|
||||
} catch (e) {
|
||||
|
|
|
@ -12,7 +12,7 @@ const querystring = require('querystring')
|
|||
const { createDataDir, writeInDataDir } = require('./utils.js')
|
||||
const R = require('ramda')
|
||||
|
||||
const apiURL = params => {
|
||||
const apiURL = (params) => {
|
||||
const query = querystring.stringify({
|
||||
period: 'month',
|
||||
date: 'last1',
|
||||
|
@ -23,7 +23,7 @@ const apiURL = params => {
|
|||
language: 'fr',
|
||||
apiAction: 'get',
|
||||
token_auth: process.env.MATOMO_TOKEN,
|
||||
...params
|
||||
...params,
|
||||
})
|
||||
return `https://stats.data.gouv.fr/index.php?${query}`
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ async function main() {
|
|||
dailyVisits: await fetchDailyVisits(),
|
||||
statusChosen: await fetchStatusChosen(),
|
||||
feedback: await fetchFeedback(),
|
||||
channelType: await fetchChannelType()
|
||||
channelType: await fetchChannelType(),
|
||||
}
|
||||
writeInDataDir('stats.json', stats)
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ function xMonthAgo(x = 0) {
|
|||
}
|
||||
|
||||
async function fetchSimulatorsMonth() {
|
||||
const getDataFromXMonthAgo = async x => {
|
||||
const getDataFromXMonthAgo = async (x) => {
|
||||
const date = xMonthAgo(x)
|
||||
return { date, visites: await fetchSimulators(`${date}-01`) }
|
||||
}
|
||||
|
@ -62,25 +62,25 @@ async function fetchSimulatorsMonth() {
|
|||
oneMonthAgo: await getDataFromXMonthAgo(1),
|
||||
twoMonthAgo: await getDataFromXMonthAgo(2),
|
||||
threeMonthAgo: await getDataFromXMonthAgo(3),
|
||||
fourMonthAgo: await getDataFromXMonthAgo(4)
|
||||
fourMonthAgo: await getDataFromXMonthAgo(4),
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchSimulators(dt) {
|
||||
async function fetchSubTableData(data, label) {
|
||||
const subTable = data.find(page => page.label === label)
|
||||
const subTable = data.find((page) => page.label === label)
|
||||
if (!subTable) {
|
||||
console.log('No subtable for ' + label + ' for the period ' + dt + '.')
|
||||
return []
|
||||
}
|
||||
|
||||
|
||||
const response = await fetch(
|
||||
apiURL({
|
||||
date: `${dt}`,
|
||||
method: 'Actions.getPageUrls',
|
||||
search_recursive: 1,
|
||||
filter_limits: -1,
|
||||
idSubtable: subTable.idsubdatatable
|
||||
idSubtable: subTable.idsubdatatable,
|
||||
})
|
||||
)
|
||||
return await response.json()
|
||||
|
@ -91,21 +91,31 @@ async function fetchSimulators(dt) {
|
|||
period: 'month',
|
||||
date: `${dt}`,
|
||||
method: 'Actions.getPageUrls',
|
||||
filter_limits: -1
|
||||
filter_limits: -1,
|
||||
})
|
||||
)
|
||||
const firstLevelData = await response.json()
|
||||
|
||||
const coronavirusPage = firstLevelData.find(
|
||||
page => page.label === '/coronavirus'
|
||||
(page) => page.label === '/coronavirus'
|
||||
)
|
||||
|
||||
// Visits on simulators pages
|
||||
const dataSimulateurs = await fetchSubTableData(firstLevelData, 'simulateurs')
|
||||
const dataSimulateurs = await fetchSubTableData(
|
||||
firstLevelData,
|
||||
'simulateurs'
|
||||
)
|
||||
const dataGérer = await fetchSubTableData(firstLevelData, 'gérer')
|
||||
const dataProfessionLiberale = await fetchSubTableData(dataSimulateurs, 'profession-liberale')
|
||||
const dataProfessionLiberale = await fetchSubTableData(
|
||||
dataSimulateurs,
|
||||
'profession-liberale'
|
||||
)
|
||||
|
||||
const resultSimulateurs = [...dataSimulateurs, ...dataProfessionLiberale, ...dataGérer]
|
||||
const resultSimulateurs = [
|
||||
...dataSimulateurs,
|
||||
...dataProfessionLiberale,
|
||||
...dataGérer,
|
||||
]
|
||||
.filter(({ label }) =>
|
||||
[
|
||||
'/salaire-brut-net',
|
||||
|
@ -124,40 +134,40 @@ async function fetchSimulators(dt) {
|
|||
'/chirugien-dentiste',
|
||||
'/avocat',
|
||||
'/expert-comptable',
|
||||
'/économie-collaborative'
|
||||
'/économie-collaborative',
|
||||
].includes(label)
|
||||
)
|
||||
|
||||
/// Two '/salarié' pages are reported on Matomo, one of which has very few
|
||||
/// visitors. We delete it manually.
|
||||
.filter(
|
||||
x =>
|
||||
(x) =>
|
||||
x.label != '/salarié' ||
|
||||
x.nb_visits !=
|
||||
dataSimulateurs
|
||||
.filter(x => x.label == '/salarié')
|
||||
.filter((x) => x.label == '/salarié')
|
||||
.reduce((a, b) => Math.min(a, b.nb_visits), 1000)
|
||||
)
|
||||
|
||||
|
||||
const resultIframes = (await fetchSubTableData(firstLevelData, 'iframes'))
|
||||
.filter(x =>
|
||||
[
|
||||
'/simulateur-embauche',
|
||||
'/simulateur-autoentrepreneur',
|
||||
'/simulateur-assimilesalarie',
|
||||
'/simulateur-artiste-auteur',
|
||||
'/simulateur-independant',
|
||||
'/demande-mobilite',
|
||||
'/profession-liberale',
|
||||
'/medecin',
|
||||
'/auxiliaire-medical',
|
||||
'/sage-femme',
|
||||
'/chirugien-dentiste',
|
||||
'/avocat',
|
||||
'/expert-comptable',
|
||||
].some(path => x.label.startsWith(path))
|
||||
)
|
||||
const resultIframes = (
|
||||
await fetchSubTableData(firstLevelData, 'iframes')
|
||||
).filter((x) =>
|
||||
[
|
||||
'/simulateur-embauche',
|
||||
'/simulateur-autoentrepreneur',
|
||||
'/simulateur-assimilesalarie',
|
||||
'/simulateur-artiste-auteur',
|
||||
'/simulateur-independant',
|
||||
'/demande-mobilite',
|
||||
'/profession-liberale',
|
||||
'/medecin',
|
||||
'/auxiliaire-medical',
|
||||
'/sage-femme',
|
||||
'/chirugien-dentiste',
|
||||
'/avocat',
|
||||
'/expert-comptable',
|
||||
].some((path) => x.label.startsWith(path))
|
||||
)
|
||||
|
||||
const groupSimulateursIframesVisits = ({ label }) =>
|
||||
label.startsWith('/coronavirus')
|
||||
|
@ -210,7 +220,7 @@ const visitsIn2019 = {
|
|||
'2019-09': 178474,
|
||||
'2019-10': 198260,
|
||||
'2019-11': 174515,
|
||||
'2019-12': 116305
|
||||
'2019-12': 116305,
|
||||
}
|
||||
|
||||
async function fetchMonthlyVisits() {
|
||||
|
@ -219,7 +229,7 @@ async function fetchMonthlyVisits() {
|
|||
apiURL({
|
||||
period: 'month',
|
||||
date: 'previous12',
|
||||
method: 'VisitsSummary.getUniqueVisitors'
|
||||
method: 'VisitsSummary.getUniqueVisitors',
|
||||
})
|
||||
)
|
||||
const data = await response.json()
|
||||
|
@ -239,13 +249,13 @@ async function fetchDailyVisits() {
|
|||
apiURL({
|
||||
period: 'day',
|
||||
date: 'previous30',
|
||||
method: 'VisitsSummary.getUniqueVisitors'
|
||||
method: 'VisitsSummary.getUniqueVisitors',
|
||||
})
|
||||
)
|
||||
const data = await response.json()
|
||||
return Object.entries(data).map(([date, visiteurs]) => ({
|
||||
date,
|
||||
visiteurs
|
||||
visiteurs,
|
||||
}))
|
||||
} catch (e) {
|
||||
console.log('fail to fetch Daily Visits')
|
||||
|
@ -259,7 +269,7 @@ async function fetchStatusChosen() {
|
|||
apiURL({
|
||||
method: 'Events.getAction',
|
||||
label: 'status chosen',
|
||||
date: 'previous1'
|
||||
date: 'previous1',
|
||||
})
|
||||
)
|
||||
const data = await response.json()
|
||||
|
@ -267,13 +277,13 @@ async function fetchStatusChosen() {
|
|||
apiURL({
|
||||
method: 'Events.getNameFromActionId',
|
||||
idSubtable: Object.values(data)[0][0].idsubdatatable,
|
||||
date: 'previous1'
|
||||
date: 'previous1',
|
||||
})
|
||||
)
|
||||
const data2 = await response2.json()
|
||||
const result = Object.values(data2)[0].map(({ label, nb_visits }) => ({
|
||||
label,
|
||||
nb_visits
|
||||
nb_visits,
|
||||
}))
|
||||
return result
|
||||
} catch (e) {
|
||||
|
@ -288,14 +298,14 @@ async function fetchFeedback() {
|
|||
apiURL({
|
||||
method: 'Events.getCategory',
|
||||
label: 'Feedback > @rate%20page%20usefulness',
|
||||
date: 'previous5'
|
||||
date: 'previous5',
|
||||
})
|
||||
)
|
||||
const APIsimulator = await fetch(
|
||||
apiURL({
|
||||
method: 'Events.getCategory',
|
||||
label: 'Feedback > @rate%20simulator',
|
||||
date: 'previous5'
|
||||
date: 'previous5',
|
||||
})
|
||||
)
|
||||
const feedbackcontent = await APIcontent.json()
|
||||
|
@ -315,7 +325,7 @@ async function fetchFeedback() {
|
|||
}
|
||||
return {
|
||||
content: Math.round(content * 10),
|
||||
simulator: Math.round(simulator * 10)
|
||||
simulator: Math.round(simulator * 10),
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('fail to fetch feedbacks')
|
||||
|
@ -329,23 +339,23 @@ async function fetchChannelType() {
|
|||
apiURL({
|
||||
period: 'month',
|
||||
date: 'last6',
|
||||
method: 'Referrers.getReferrerType'
|
||||
method: 'Referrers.getReferrerType',
|
||||
})
|
||||
)
|
||||
|
||||
const data = await response.json()
|
||||
|
||||
const result = R.map(
|
||||
date =>
|
||||
(date) =>
|
||||
date
|
||||
.filter(x =>
|
||||
.filter((x) =>
|
||||
['Sites web', 'Moteurs de recherche', 'Entrées directes'].includes(
|
||||
x.label
|
||||
)
|
||||
)
|
||||
.map(({ label, nb_visits }) => ({
|
||||
label,
|
||||
nb_visits
|
||||
nb_visits,
|
||||
})),
|
||||
data
|
||||
)
|
||||
|
@ -355,7 +365,7 @@ async function fetchChannelType() {
|
|||
oneMonthAgo: { date: dates[1], visites: result[dates[1]] },
|
||||
twoMonthAgo: { date: dates[2], visites: result[dates[2]] },
|
||||
threeMonthAgo: { date: dates[3], visites: result[dates[3]] },
|
||||
fourMonthAgo: { date: dates[4], visites: result[dates[4]] }
|
||||
fourMonthAgo: { date: dates[4], visites: result[dates[4]] },
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('fail to fetch channel type')
|
||||
|
|
|
@ -3,7 +3,7 @@ const missingTranslationKeys = Object.keys(getUiMissingTranslations())
|
|||
if (missingTranslationKeys.length) {
|
||||
throw new Error(`Il manque des traductions UI pour les clés suivantes : ${[
|
||||
'',
|
||||
...missingTranslationKeys
|
||||
...missingTranslationKeys,
|
||||
].join('\n\t- ')}
|
||||
Utilisez la commande suivante pour traduire automatiquement les clés manquantes :
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ module.exports = {
|
|||
jsx: ['JsxLexer'],
|
||||
tsx: ['JsxLexer'],
|
||||
|
||||
default: ['JavascriptLexer']
|
||||
default: ['JavascriptLexer'],
|
||||
},
|
||||
|
||||
lineEnding: 'auto',
|
||||
|
@ -70,6 +70,6 @@ module.exports = {
|
|||
// Whether to use the keys as the default value; ex. "Hello": "Hello", "World": "World"
|
||||
// The option `defaultValue` will not work if this is set to true
|
||||
|
||||
verbose: false
|
||||
verbose: false,
|
||||
// Display info about the parsing including some stats
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ var prettier = require('prettier')
|
|||
const {
|
||||
getRulesMissingTranslations,
|
||||
rulesTranslationPath,
|
||||
fetchTranslation
|
||||
fetchTranslation,
|
||||
} = require('./utils')
|
||||
|
||||
const [missingTranslations, resolved] = getRulesMissingTranslations()
|
||||
|
@ -26,12 +26,12 @@ fs.writeFileSync(
|
|||
})
|
||||
)
|
||||
|
||||
prettier.resolveConfig(rulesTranslationPath).then(options => {
|
||||
prettier.resolveConfig(rulesTranslationPath).then((options) => {
|
||||
const formattedYaml = prettier.format(
|
||||
stringify(resolved, { sortMapEntries: true }),
|
||||
{
|
||||
...options,
|
||||
parser: 'yaml'
|
||||
parser: 'yaml',
|
||||
}
|
||||
)
|
||||
fs.writeFileSync(rulesTranslationPath, formattedYaml)
|
||||
|
|
|
@ -5,7 +5,7 @@ var fs = require('fs')
|
|||
const {
|
||||
getUiMissingTranslations,
|
||||
UiTranslationPath,
|
||||
fetchTranslation
|
||||
fetchTranslation,
|
||||
} = require('./utils')
|
||||
|
||||
const missingTranslations = getUiMissingTranslations()
|
||||
|
|
|
@ -13,60 +13,59 @@ module.exports.default = {
|
|||
Selectors: path.resolve('source/selectors/'),
|
||||
Reducers: path.resolve('source/reducers/'),
|
||||
Types: path.resolve('source/types/'),
|
||||
Rules: path.resolve('source/rules/'),
|
||||
Images: path.resolve('source/images/')
|
||||
Images: path.resolve('source/images/'),
|
||||
},
|
||||
extensions: ['.js', '.ts', '.tsx']
|
||||
extensions: ['.js', '.ts', '.tsx'],
|
||||
},
|
||||
entry: {
|
||||
'mon-entreprise': './source/sites/mon-entreprise.fr/entry.fr.tsx',
|
||||
infrance: './source/sites/mon-entreprise.fr/entry.en.tsx',
|
||||
'simulateur-iframe-integration':
|
||||
'./source/sites/mon-entreprise.fr/iframe-integration-script.js',
|
||||
publicodes: './source/sites/publi.codes/entry.tsx'
|
||||
publicodes: './source/sites/publi.codes/entry.tsx',
|
||||
},
|
||||
output: {
|
||||
globalObject: 'self'
|
||||
globalObject: 'self',
|
||||
},
|
||||
plugins: [
|
||||
new MonacoWebpackPlugin(),
|
||||
new EnvironmentPlugin({
|
||||
EN_SITE: '/infrance${path}',
|
||||
FR_SITE: '/mon-entreprise${path}'
|
||||
FR_SITE: '/mon-entreprise${path}',
|
||||
}),
|
||||
new EnvironmentPlugin({
|
||||
GITHUB_REF: '',
|
||||
GITHUB_HEAD_REF: '',
|
||||
GITHUB_SHA: ''
|
||||
GITHUB_SHA: '',
|
||||
}),
|
||||
new CopyPlugin([
|
||||
'./manifest.webmanifest',
|
||||
{
|
||||
from: './source/sites/mon-entreprise.fr/robots.txt',
|
||||
to: 'robots.infrance.txt'
|
||||
to: 'robots.infrance.txt',
|
||||
},
|
||||
{
|
||||
from: './source/sites/mon-entreprise.fr/sitemap.fr.txt',
|
||||
to: 'sitemap.infrance.fr.txt'
|
||||
to: 'sitemap.infrance.fr.txt',
|
||||
},
|
||||
{
|
||||
from: './source/sites/mon-entreprise.fr/sitemap.en.txt',
|
||||
to: 'sitemap.infrance.en.txt'
|
||||
to: 'sitemap.infrance.en.txt',
|
||||
},
|
||||
{
|
||||
from: './source/images',
|
||||
to: 'images'
|
||||
to: 'images',
|
||||
},
|
||||
{
|
||||
from: './source/data',
|
||||
to: 'data'
|
||||
to: 'data',
|
||||
},
|
||||
{
|
||||
from: './source/sites/mon-entreprise.fr/favicon',
|
||||
to: 'favicon'
|
||||
}
|
||||
])
|
||||
]
|
||||
to: 'favicon',
|
||||
},
|
||||
]),
|
||||
],
|
||||
}
|
||||
|
||||
module.exports.HTMLPlugins = ({ injectTrackingScript = false } = {}) => [
|
||||
|
@ -82,7 +81,7 @@ module.exports.HTMLPlugins = ({ injectTrackingScript = false } = {}) => [
|
|||
'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.',
|
||||
filename: 'infrance.html',
|
||||
shareImage: 'https://mon-entreprise.fr/images/logo-mycompany-share.png',
|
||||
logo: 'images/logo-mycompany.svg'
|
||||
logo: 'images/logo-mycompany.svg',
|
||||
}),
|
||||
new HTMLPlugin({
|
||||
template: 'index.html',
|
||||
|
@ -95,7 +94,7 @@ module.exports.HTMLPlugins = ({ injectTrackingScript = false } = {}) => [
|
|||
'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é.',
|
||||
filename: 'mon-entreprise.html',
|
||||
shareImage: 'https://mon-entreprise.fr/images/logo-share.png',
|
||||
logo: 'images/logo.svg'
|
||||
logo: 'images/logo.svg',
|
||||
}),
|
||||
new HTMLPlugin({
|
||||
template: 'index.html',
|
||||
|
@ -107,6 +106,6 @@ module.exports.HTMLPlugins = ({ injectTrackingScript = false } = {}) => [
|
|||
'Un langage de calcul ouvert, lisible en français, contributif pour encoder et publier les sujets de société.',
|
||||
filename: 'publicodes.html',
|
||||
shareImage: 'https://mon-entreprise.fr/images/publicodes.png',
|
||||
logo: 'images/publicodes.png'
|
||||
})
|
||||
logo: 'images/publicodes.png',
|
||||
}),
|
||||
]
|
||||
|
|
|
@ -8,14 +8,14 @@ const { HTMLPlugins, default: common } = require('./webpack.common')
|
|||
module.exports = {
|
||||
...common,
|
||||
module: {
|
||||
rules: [...commonLoaders(), styleLoader('style-loader')]
|
||||
rules: [...commonLoaders(), styleLoader('style-loader')],
|
||||
},
|
||||
mode: 'development',
|
||||
entry: map(entry => ['webpack-hot-middleware/client', entry], common.entry),
|
||||
entry: map((entry) => ['webpack-hot-middleware/client', entry], common.entry),
|
||||
plugins: [
|
||||
...common.plugins,
|
||||
...HTMLPlugins(),
|
||||
new webpack.EnvironmentPlugin({ NODE_ENV: 'development' }),
|
||||
new webpack.HotModuleReplacementPlugin()
|
||||
]
|
||||
new webpack.HotModuleReplacementPlugin(),
|
||||
],
|
||||
}
|
||||
|
|
|
@ -18,9 +18,9 @@ const prerenderConfig = () => ({
|
|||
staticDir: path.resolve('dist'),
|
||||
renderer: new Renderer({
|
||||
renderAfterTime: 5000,
|
||||
skipThirdPartyRequests: true
|
||||
skipThirdPartyRequests: true,
|
||||
}),
|
||||
postProcess: context => {
|
||||
postProcess: (context) => {
|
||||
const $ = cheerio.load(context.html)
|
||||
// force https on twitter emoji cdn
|
||||
$('img[src^="http://twemoji.maxcdn.com"]').each((i, el) => {
|
||||
|
@ -43,13 +43,13 @@ const prerenderConfig = () => ({
|
|||
|
||||
context.html = $.html()
|
||||
return context
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
module.exports = {
|
||||
...common,
|
||||
module: {
|
||||
rules: [...commonLoaders(), styleLoader(MiniCssExtractPlugin.loader)]
|
||||
rules: [...commonLoaders(), styleLoader(MiniCssExtractPlugin.loader)],
|
||||
},
|
||||
output: {
|
||||
...common.output,
|
||||
|
@ -57,7 +57,7 @@ module.exports = {
|
|||
return chunk.name === 'simulateur-iframe-integration'
|
||||
? '[name].js'
|
||||
: '[name].[contenthash].bundle.js'
|
||||
}
|
||||
},
|
||||
},
|
||||
mode: 'production',
|
||||
devtool: 'source-map',
|
||||
|
@ -65,9 +65,9 @@ module.exports = {
|
|||
minimize: true,
|
||||
minimizer: [
|
||||
new TerserPlugin({
|
||||
parallel: 2
|
||||
})
|
||||
]
|
||||
parallel: 2,
|
||||
}),
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
...common.plugins,
|
||||
|
@ -87,21 +87,21 @@ module.exports = {
|
|||
/.*\.worker\.js/,
|
||||
/^\/robots\.txt$/,
|
||||
/^\/sitemap\.infrance\.fr\.txt$/,
|
||||
/^\/sitemap\.infrance\.en\.txt$/
|
||||
]
|
||||
/^\/sitemap\.infrance\.en\.txt$/,
|
||||
],
|
||||
}),
|
||||
new MiniCssExtractPlugin({
|
||||
// Options similar to the same options in webpackOptions.output
|
||||
// both options are optional
|
||||
filename: '[name].[hash].css',
|
||||
chunkFilename: '[id].[hash].css'
|
||||
chunkFilename: '[id].[hash].css',
|
||||
}),
|
||||
process.env.ANALYZE_BUNDLE !== '1' &&
|
||||
new PrerenderSPAPlugin({
|
||||
...prerenderConfig(),
|
||||
outputDir: path.resolve('dist', 'prerender', 'infrance'),
|
||||
routes: ['/', '/calculators/salary', '/iframes/simulateur-embauche'],
|
||||
indexPath: path.resolve('dist', 'infrance.html')
|
||||
indexPath: path.resolve('dist', 'infrance.html'),
|
||||
}),
|
||||
process.env.ANALYZE_BUNDLE !== '1' &&
|
||||
new PrerenderSPAPlugin({
|
||||
|
@ -119,9 +119,9 @@ module.exports = {
|
|||
'/gérer',
|
||||
'/iframes/simulateur-embauche',
|
||||
'/iframes/simulateur-chomage-partiel',
|
||||
'/iframes/pamc'
|
||||
'/iframes/pamc',
|
||||
],
|
||||
indexPath: path.resolve('dist', 'mon-entreprise.html')
|
||||
})
|
||||
].filter(Boolean)
|
||||
indexPath: path.resolve('dist', 'mon-entreprise.html'),
|
||||
}),
|
||||
].filter(Boolean),
|
||||
}
|
||||
|
|
|
@ -8,23 +8,23 @@ const { EnvironmentPlugin } = require('webpack')
|
|||
|
||||
module.exports = {
|
||||
...prod,
|
||||
entry: map(entry => ['whatwg-fetch', entry], prod.entry),
|
||||
entry: map((entry) => ['whatwg-fetch', entry], prod.entry),
|
||||
output: {
|
||||
filename: '[name].legacy.bundle.js'
|
||||
filename: '[name].legacy.bundle.js',
|
||||
},
|
||||
module: {
|
||||
rules: [...commonLoaders({ legacy: true }), styleLoader('style-loader')]
|
||||
rules: [...commonLoaders({ legacy: true }), styleLoader('style-loader')],
|
||||
},
|
||||
plugins: [
|
||||
new MonacoWebpackPlugin(),
|
||||
new EnvironmentPlugin({
|
||||
GITHUB_REF: '',
|
||||
GITHUB_HEAD_REF: '',
|
||||
GITHUB_SHA: ''
|
||||
GITHUB_SHA: '',
|
||||
}),
|
||||
new EnvironmentPlugin({
|
||||
EN_SITE: '/infrance${path}',
|
||||
FR_SITE: '/mon-entreprise${path}'
|
||||
})
|
||||
]
|
||||
FR_SITE: '/mon-entreprise${path}',
|
||||
}),
|
||||
],
|
||||
}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = {
|
||||
plugins: [require('autoprefixer')]
|
||||
plugins: [require('autoprefixer')],
|
||||
}
|
||||
|
|
|
@ -5,16 +5,16 @@ const { commonLoaders } = require('../webpack/common')
|
|||
|
||||
const common = {
|
||||
resolve: {
|
||||
extensions: ['.ts', '.tsx', '.js']
|
||||
extensions: ['.ts', '.tsx', '.js'],
|
||||
},
|
||||
mode: 'development',
|
||||
entry: path.resolve(__dirname, 'source', 'index.ts'),
|
||||
module: {
|
||||
rules: commonLoaders({ file: false })
|
||||
rules: commonLoaders({ file: false }),
|
||||
},
|
||||
externals:
|
||||
// Every non-relative module is external
|
||||
/^[a-z\-0-9]+$/
|
||||
/^[a-z\-0-9]+$/,
|
||||
}
|
||||
|
||||
module.exports =
|
||||
|
@ -25,6 +25,6 @@ module.exports =
|
|||
filename: 'index.js',
|
||||
library: 'publicodes',
|
||||
libraryTarget: 'umd',
|
||||
globalObject: 'this'
|
||||
}
|
||||
globalObject: 'this',
|
||||
},
|
||||
}
|
||||
|
|
|
@ -3,11 +3,11 @@ const { EnvironmentPlugin } = require('webpack')
|
|||
|
||||
module.exports = {
|
||||
resolve: {
|
||||
extensions: ['.ts', '.tsx', '.js']
|
||||
extensions: ['.ts', '.tsx', '.js'],
|
||||
},
|
||||
output: {
|
||||
devtoolFallbackModuleFilenameTemplate: '[absolute-resource-path]?[hash]',
|
||||
devtoolModuleFilenameTemplate: '[absolute-resource-path]'
|
||||
devtoolModuleFilenameTemplate: '[absolute-resource-path]',
|
||||
},
|
||||
mode: 'development',
|
||||
module: {
|
||||
|
@ -15,13 +15,13 @@ module.exports = {
|
|||
...commonLoaders(),
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: ['css-loader', 'postcss-loader']
|
||||
}
|
||||
]
|
||||
use: ['css-loader', 'postcss-loader'],
|
||||
},
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
new EnvironmentPlugin({
|
||||
NODE_ENV: 'test'
|
||||
})
|
||||
]
|
||||
NODE_ENV: 'test',
|
||||
}),
|
||||
],
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* eslint-env node */
|
||||
|
||||
module.exports.styleLoader = styleLoader => ({
|
||||
module.exports.styleLoader = (styleLoader) => ({
|
||||
test: /\.css$/,
|
||||
use: [
|
||||
{ loader: styleLoader },
|
||||
|
@ -8,13 +8,13 @@ module.exports.styleLoader = styleLoader => ({
|
|||
loader: 'css-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
importLoaders: 1
|
||||
}
|
||||
importLoaders: 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
loader: 'postcss-loader'
|
||||
}
|
||||
]
|
||||
loader: 'postcss-loader',
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
module.exports.commonLoaders = ({ legacy = false, file = true } = {}) => {
|
||||
|
@ -29,25 +29,25 @@ module.exports.commonLoaders = ({ legacy = false, file = true } = {}) => {
|
|||
{
|
||||
targets: !legacy
|
||||
? {
|
||||
esmodules: true
|
||||
esmodules: true,
|
||||
}
|
||||
: {
|
||||
esmodules: false,
|
||||
browsers: ['ie 11']
|
||||
browsers: ['ie 11'],
|
||||
},
|
||||
useBuiltIns: 'entry',
|
||||
corejs: '3'
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
corejs: '3',
|
||||
},
|
||||
],
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
return [
|
||||
{
|
||||
test: /\.(js|ts|tsx)$/,
|
||||
use: babelLoader,
|
||||
exclude: /node_modules|dist/
|
||||
exclude: /node_modules|dist/,
|
||||
},
|
||||
...(file
|
||||
? [
|
||||
|
@ -58,11 +58,11 @@ module.exports.commonLoaders = ({ legacy = false, file = true } = {}) => {
|
|||
loader: 'url-loader',
|
||||
options: {
|
||||
limit: 8192,
|
||||
name: 'images/[name].[ext]'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
name: 'images/[name].[ext]',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
|
@ -73,30 +73,30 @@ module.exports.commonLoaders = ({ legacy = false, file = true } = {}) => {
|
|||
options: {
|
||||
name: '[name].[ext]',
|
||||
outputPath: 'fonts',
|
||||
publicPath: '/fonts'
|
||||
}
|
||||
}
|
||||
]
|
||||
publicPath: '/fonts',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
test: /\.yaml$/,
|
||||
use: ['json-loader', 'yaml-loader']
|
||||
use: ['json-loader', 'yaml-loader'],
|
||||
},
|
||||
{
|
||||
test: /\.toml$/,
|
||||
use: ['toml-loader']
|
||||
use: ['toml-loader'],
|
||||
},
|
||||
{
|
||||
test: /\.ne$/,
|
||||
use: [babelLoader, 'nearley-loader']
|
||||
use: [babelLoader, 'nearley-loader'],
|
||||
},
|
||||
{
|
||||
test: /\.md$/,
|
||||
use: ['raw-loader']
|
||||
use: ['raw-loader'],
|
||||
},
|
||||
{
|
||||
test: /\.pdf$/,
|
||||
use: ['file-loader']
|
||||
}
|
||||
use: ['file-loader'],
|
||||
},
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue