Skip to content

Latest commit

 

History

History
66 lines (44 loc) · 3.06 KB

File metadata and controls

66 lines (44 loc) · 3.06 KB

This project was bootstrapped with Create React App using @ctco-dev/react-scripts mod.

Below you will find some information on how to perform common tasks.
You can find the most recent version of this guide here. You can find the official CRA docs here

Table of content

Common tasks

npm start or yarn start

Runs the app in development mode.
Open http://localhost:3000 to view it in the browser.

npm test or yarn test

Runs the test watcher in an interactive mode.

npm run build or yarn build

Builds the app for production to the build folder.

npm run lint or yarn lint

Runs tslint linter to analyze your project. Run it with --fix flag to make it try to fix some errors automatically.

npm run analyze or yarn analyze

Runs source-map-explorer to analyze the bundle size of your project inside build directory. Should be run after building the app.

npm run eject or yarn eject

Ejects configuration for your pleasure. Remember! There is no way back! So fairwell, and let the force be with you.

Use docker

Build and run example:

docker build --tag my-cra-image .
docker run --rm -it --name my-cra-container -p 8080:80 my-cra-image

These commands will run the container app and allow to see it on http://localhost:8080 on your local machine (in case of remote docker host replace localhost with the docker host domain name or ip).

12 Factor app config

Environment variables filtered by mask (default mask is WEB_APP_) and injected into window.env at runtime in development mode (after yarn start) and in production mode (if running under docker with provided .docker scripts).

Development

To run project in dev mode and inject variables try to assign them in command line:

WEB_APP_ONE="hello my app" yarn start

or add variables to .env, .env.local, .env.development et c. (see Official CRA doc, but remember, only WEB_APP_ prefixed variables will be injected into window.env).

Production

To inject environment variables into an application on starting a docker container:

docker run --rm -it --name my-cra-container -e "WEB_APP_ONE=hello my app" -p 8080:80 my-cra-image