git clone
npm install
Server and cookie variables can be set in the .env-cmdrc file.
Certain files in the dependencies (i.e. node_modules) need to be overwritten. The files are located in the overrides directory.
cli.js should replace the file located at node_modules/react-snapshot/lib/cli.js
.
webpack.config.prod.js should replace the file located at node_modules/react-scripts/config/webpack.config.prod.js
.
In order for React routing to work properly, a few files need to be altered.
In package.json the homepage
field needs to be set to the build folder on the server, e.g. https://dev-02.cwrc.ca/cwrc-entity-management-forms-static/build/
.
If you're updating this app, many of the directories can be ignored as they're part of the suicrux boilerplate that formed the basis for the app.
Listed below are the files and directories directly related to the entity forms.
Everything related to client server communication is at: https://github.com/cwrc/cwrc-entity-management-forms-static/tree/master/src/api/EntitiesSvc
Entities are stored as XML on the server, and manipulated as JSON on the client. Code for doing XML to JSON and JSON to XML conversion can be found for each entity in the relevant directory inside EntitiesSvc.
Common functions used in the conversions can be found here: https://github.com/cwrc/cwrc-entity-management-forms-static/blob/master/src/api/utils/conversion_utilities.js
Actual server calls are made at: https://github.com/cwrc/cwrc-entity-management-forms-static/blob/master/src/api/EntitiesSvc/index.js
The code for the forms themselves is at: https://github.com/cwrc/cwrc-entity-management-forms-static/tree/master/src/containers/EntityForm
Common components used in all forms can be found here: https://github.com/cwrc/cwrc-entity-management-forms-static/tree/master/src/containers/EntityForm/components
In order for React routing to work properly, you need to define the correct root path for the build according to the server you are deploing:
In package.json the homepage
field needs to be set to the build folder on the server:
run one of the options on package.json:
Each one of them takes env variables from the file .env-cmdrc.js. "build:all" will generate builds for all environments at once. The built files will be saved into each specific folder in the bin
folder.
If dependencies are updated (specifically react-scripts and react-snapshop), you need to replace the override files as follows (check oveerides)
It is better to compile code on site becuase of the different build options. But you can use the pre-built code on bin
if you like.
git pull
to update. (You might need to git stash
the above build customizations. Then git stash pop
them after the pull is complete.)/bin/dev
) to /build
. e.g.: cp -R ./bin/dev ./build
git pull
to update. (You might need to git stash
the above build customizations. Then git stash pop
them after the pull is complete.)npm i
to install eventual dependencies updates.npm run {build-version}
to actually create a build for a specific environment. Or npm run build:all
to create version to all environments./bin/dev
) to /build
. e.g.: cp -R ./bin/dev ./build