-
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.
- Loading branch information
Showing
12 changed files
with
4,190 additions
and
298 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
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
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.