Install dependencies:
$ yarn install
Start the development server:
$ PORT=8081 REACT_APP_DHIS2_BASE_URL="http://localhost:8080" yarn start
Now in your browser, go to http://localhost:8081.
Notes:
-
Requests to DHIS2 will be transparently proxied (see
src/setupProxy.js) fromhttp://localhost:8081/dhis2/pathtohttp://localhost:8080/pathto avoid CORS and cross-domain problems. -
The optional environment variable
REACT_APP_DHIS2_AUTH=USERNAME:PASSWORDforces some credentials to be used by the proxy. This variable is usually not set, so the app has the same user logged in atREACT_APP_DHIS2_BASE_URL. -
Create a file
.env.local(copy it from.env) to customize environment variables so you can simply runyarn start. -
why-did-you-render is installed, but it does not work when using standard react scripts (
yarn start). Instead, useyarn craco-startto debug re-renders with WDYR. Note that hot reloading does not work out-of-the-box with craco.
$ yarn test
Create the required users for testing (cypress/support/App.ts) in your instance and run:
$ export CYPRESS_EXTERNAL_API="http://localhost:8080"
$ export CYPRESS_ROOT_URL=http://localhost:8081
# non-interactive
$ yarn cy:e2e:run
# interactive UI
$ yarn cy:e2e:open
$ yarn build
i18n/: Contains literal translations (gettext format)public/: Main app folder with aindex.html, exposes the APP.src/pages: Main React components.src/domain: Domain layer of the app (clean architecture)src/data: Data of the app (clean architecture)src/components: Reusable React components.src/types:.d.tsfile types for modules without TS definitions.src/utils: Misc utilities.src/locales: Auto-generated, do not update or add to the version control.cypress/integration/: Cypress integration tests.
$ yarn localize
The file src/contexts/app-context.ts holds some general context so typical infrastructure objects (api, d2, ...) are readily available. Add your own global objects if necessary.