Contexts generator for create-react-application.
Generates state, context, context provider and context builder for the given state props.
Execute the following command to generate the source code:
cra-generate-contexts src dest
where:
src
: the file name of.json
file that contains state props description (see examples).dest
: the destination path of generated source code.
Please note, the generator will not create folders, they must exist.
Execute the following command to link cra-generate-contexts
command to simulate node.js package installation for development:
npm link
Execute the following command to unlink cra-generate-contexts
command:
npm unlink -g
Execute the following command to generate the source code:
cra-generate-contexts ./examples/widget-builder-contexts.json ./examples/widget-builder-contexts
- added context imports
- added customUpdateLocation feature
- fixed location's pathname serialization issue
- fixed sync location with state issue
- simplified contexts for disableContextBuilder set to true
- added forceExternalStateGeneration feature
- fixed array type issue
- added shouldUpdateLocation functionality
- fixed issues related to isOptional functionality
- fixed object type issue
- fixed react-router-dom v6 issues
- removed CustomRouter
- simplified context builder
- added options to json file
- fixed isOptional issue
- implemented generation context and context builder files