This package includes scripts and configuration used by Create React App.
Please refer to its documentation:
- Getting Started – How to create a new app.
- User Guide – How to develop apps bootstrapped with Create React App.
This has been customized to generate boilerplate Openmrs Open Web Apps(OWAs) with a single line of command. Resulting OWA will be using openmrs-react-components library which includes common web UI components such as headers, footers, buttons, etc.
You do NOT have to clone/download this repository in order to create an openmrs ReactJS app. Just run the following command anywhere in your computer.
npx create-react-app test-app --scripts-version openmrs-react-scripts
cd test-app
cp .env.skeleton .env
npm start
Note: You need to edit .env file by providing your OpenMRS server information. This is necessary that some react components communicate with OpenMRS server to fetch values.
- REACT_APP_SERVER_ADDRESS=[OpenMRS Server Address Goes Here]
- REACT_APP_SERVER_CONTEXT_PATH=[OpenMRS Server Context Path Goes Here]
npx create-react-app test-app --scripts-version openmrs-react-scripts-example
cd test-app
cp .env.skeleton .env
npm start
cd <Path_TO_THIS_REPOSITORY>
yarn
Make the changes you want to make then run,
yarn create-react-app test-app
This command builds a local copy of create-react-app, integrating your changes, then uses it to create a test-app project.
If all goes well, you can now explore the resulting test-app folder and try running the project locally:
cd test-app
yarn start
This Repository differs from that of the CRA in terms of react-scripts.
Browse to packages/react-scripts in your editor. You’ll see a few key files and folders inside.
config – contains configuration for Jest, webpack builds and dev server
scripts – the scripts available for running in a create-react-app project, such as yarn start and yarn build
template – the files you actually see when you’ve run
create-react-app – the base of every new project
Note: The file gitignore instead of .gitignore – this is to avoid ignoring files from the template itself, but will be automatically renamed when generating a project package.json – describes this package and its dependencies
When you’re happy with your changes, you just need to publish them to npm. This makes them publicly available and ready for consumption by anybody using create-react-app.
Navigate back to the packages/react-scripts directory.
Note: you’ll also need to increment the version number.
npm publish