-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: hasResponse for table * doc: add comment for dirty code * bumb: queenv2 to 1.1.3, drama-queen-container 1.3.15 * chore: create new constants (version from package.json) * build: switch to craco * build: upgrade lunatic to 2.7.6 * feat: use hasPageResponse * style: subsequence and table * build: fix conflicts
- Loading branch information
1 parent
3ad7b05
commit f4e5e76
Showing
11 changed files
with
4,187 additions
and
297 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,18 @@ | ||
module.exports = { | ||
babel: { | ||
loaderOptions: babelLoaderOptions => { | ||
const origBabelPresetCRAIndex = babelLoaderOptions.presets.findIndex(preset => { | ||
return preset[0].includes('babel-preset-react-app'); | ||
}); | ||
|
||
const origBabelPresetCRA = babelLoaderOptions.presets[origBabelPresetCRAIndex]; | ||
|
||
babelLoaderOptions.presets[origBabelPresetCRAIndex] = function overridenPresetCRA( | ||
api, | ||
opts, | ||
env | ||
) { | ||
const babelPresetCRAResult = require(origBabelPresetCRA[0])( | ||
api, | ||
origBabelPresetCRA[1], | ||
env | ||
); | ||
const OVERLOAD = { fs: false, stream: false, os: false }; | ||
|
||
babelPresetCRAResult.presets.forEach(preset => { | ||
// detect @babel/preset-react with {development: true, runtime: 'automatic'} | ||
const isReactPreset = | ||
preset && | ||
preset[1] && | ||
preset[1].runtime === 'automatic' && | ||
preset[1].development === true; | ||
if (isReactPreset) { | ||
preset[1].importSource = '@welldone-software/why-did-you-render'; | ||
} | ||
}); | ||
module.exports = { | ||
webpack: { | ||
configure: (config, { env, paths }) => { | ||
const { resolve } = config; | ||
const { fallback } = resolve; | ||
|
||
return babelPresetCRAResult; | ||
return { | ||
...config, | ||
resolve: { | ||
...resolve, | ||
fallback: { ...fallback, ...OVERLOAD }, | ||
}, | ||
}; | ||
|
||
return babelLoaderOptions; | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "queen-v2", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "Web application for the management of questionnaires powered by Lunatic", | ||
"repository": { | ||
"type": "git", | ||
|
@@ -11,8 +11,8 @@ | |
"private": true, | ||
"dependencies": { | ||
"@axa-fr/react-oidc-context": "^3.1.6", | ||
"@craco/craco": "^6.4.0", | ||
"@inseefr/lunatic": "^2.7.4", | ||
"@craco/craco": "7.0.0", | ||
"@inseefr/lunatic": "2.7.6", | ||
"@inseefr/trevas": "^0.1.16", | ||
"@material-ui/core": "^4.11.3", | ||
"@material-ui/icons": "^4.11.2", | ||
|
@@ -28,7 +28,7 @@ | |
"react-keyboard-event-handler": "^1.5.4", | ||
"react-markdown": "^5.0.3", | ||
"react-router-dom": "^5.2.0", | ||
"react-scripts": "^4.0.3", | ||
"react-scripts": "^5.0.1", | ||
"react-shadow": "^19.0.2", | ||
"workbox-cacheable-response": "^6.1.1", | ||
"workbox-core": "^6.1.1", | ||
|
@@ -38,13 +38,12 @@ | |
"workbox-strategies": "^6.1.1" | ||
}, | ||
"scripts": { | ||
"prestart": "npx @inseefr/[email protected] workers", | ||
"start": "cross-env PORT=5002 react-scripts start", | ||
"start-dev": "cross-env PORT=5002 craco start", | ||
"prebuild": "npx @inseefr/[email protected] workers", | ||
"build": "react-scripts build && npm run post-build", | ||
"prestart": "npx @inseefr/[email protected] workers", | ||
"start": "cross-env PORT=5002 craco start", | ||
"prebuild": "npx @inseefr/[email protected] workers", | ||
"build": "craco build && npm run post-build", | ||
"post-build": "node ./configuration/build/build-sw.js && node ./configuration/build/manage-public-url.js && copy-and-watch configuration/files/* build", | ||
"test": "react-scripts test", | ||
"test": "craco test", | ||
"eject": "react-scripts eject", | ||
"format": "prettier --write ." | ||
}, | ||
|
@@ -53,25 +52,8 @@ | |
"react-app", | ||
"react-app/jest", | ||
"prettier", | ||
"plugin:react-hooks/recommended", | ||
"plugin:jsx-a11y/recommended", | ||
"plugin:import/warnings" | ||
"plugin:react-hooks/recommended" | ||
], | ||
"plugins": [ | ||
"prettier", | ||
"jsx-a11y" | ||
], | ||
"rules": { | ||
"react/prop-types": [ | ||
"off" | ||
], | ||
"prettier/prettier": [ | ||
1, | ||
{ | ||
"arrowParens": "avoid" | ||
} | ||
] | ||
}, | ||
"globals": { | ||
"fetch": true, | ||
"window": true, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,14 @@ | ||
import { | ||
COMP_TYPE_CHECK_BOX_BOOLEAN, | ||
COMP_TYPE_CHECK_BOX_GROUP, | ||
COMP_TYPE_INPUT_NUMBER, | ||
COMP_TYPE_LOOP, | ||
COMP_TYPE_SEQUENCE, | ||
COMP_TYPE_SUBSEQUENCE, | ||
COMP_TYPE_TABLE, | ||
COMP_TYPE_TEXTAREA, | ||
} from 'utils/constants'; | ||
import { COMP_TYPE_SEQUENCE, COMP_TYPE_SUBSEQUENCE } from 'utils/constants'; | ||
|
||
export const componentHasResponse = component => { | ||
/** | ||
* TODO: remove this code when this issue of Lunatic will be treated : https://github.com/InseeFr/Lunatic/issues/771 | ||
*/ | ||
export const isSequenceOrSubsequenceComponent = component => { | ||
if (component === undefined) return false; | ||
|
||
// check for missingResponse | ||
if (![undefined, null, {}].includes(component?.missingResponse?.value)) return true; | ||
|
||
const { componentType } = component; | ||
switch (componentType) { | ||
case COMP_TYPE_CHECK_BOX_GROUP: | ||
case COMP_TYPE_TABLE: | ||
return Object.values(component.value).some(val => val !== null); | ||
case COMP_TYPE_INPUT_NUMBER: | ||
case COMP_TYPE_CHECK_BOX_BOOLEAN: | ||
case COMP_TYPE_TEXTAREA: | ||
return component.value !== null; | ||
case COMP_TYPE_LOOP: | ||
case COMP_TYPE_SUBSEQUENCE: | ||
case COMP_TYPE_SEQUENCE: | ||
return true; | ||
default: | ||
return !!component.value; | ||
} | ||
return [COMP_TYPE_SEQUENCE, COMP_TYPE_SUBSEQUENCE].includes(componentType); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.