The sample app was bootstrapped with Create React App.
git clone [email protected]:rakutentech/js-miniapp.git
cd js-miniapp
yarn install
yarn sample start
For test just execute:
yarn sample test
To build the app for production:
yarn sample build
The building will be inside the build
folder on js-miniapp-sample
root.
The following environment variables should be set before building:
REACT_APP_MINI_APP_ID
- the Mini App ID of this mini app
to build and package docker image of the production build:
yarn sample dockerBuild
The poc.tar
file will be generated inside ci/
directory on js-miniapp-sample
root.
Prerequisite: Docker LTS
to unpackage and run a production build on your local computer:
- Copy
js-miniapp-sample/ci/Makefile
to thepoc.tar
file directory and run
make run
Note: to stop the local docker container run make stop
on Makefile
directory.
Prerequisite: Docker LTS
- We use Flow as a static type checker in our App.
- To check the files for type errors:
npm run flow
- Check Flow integrations for code editors here
- Please check to this document about Custom Environment Varibles in create-react-app.
- To set your environment variables you need to create a file
.env
on the root of your project. This file is on .gitignore, so it'll just be loaded on your machine. - All the environment variables must start with
REACT_APP_
to work. - To access any variable you must follow this syntax:
process.env.REACT_APP_XXX
- At this moment we've 3 different files to add environment variables:
.env.development
,.env.test
and.env.production
. - Check this link to understand the priority on each available npm script.
- The following dev-dependencies have been installed for this purpose:
husky, lint-staged, prettier
- Whenever we make a commit Prettier will format the changed files automatically.
- You might want to integrate Prettier in your favorite editor as well. Please check the Prettier Editor Integration.