Skip to content

Latest commit

 

History

History
88 lines (58 loc) · 3.07 KB

README.md

File metadata and controls

88 lines (58 loc) · 3.07 KB

js-miniapp-sample

The sample app was bootstrapped with Create React App.

Table of contents

Installation

git clone [email protected]:rakutentech/js-miniapp.git
cd js-miniapp
yarn install
yarn sample start

Testing

For test just execute:

yarn sample test

Building

To build the app for production:

yarn sample build

The building will be inside the build folder on js-miniapp-sample root.

Environment Variables

The following environment variables should be set before building:

  • REACT_APP_MINI_APP_ID - the Mini App ID of this mini app

Export Dockerized App Image as TAR

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

Import Dockerized App Image from TAR

to unpackage and run a production build on your local computer:

  • Copy js-miniapp-sample/ci/Makefile to the poc.tar file directory and run
  make run

Note: to stop the local docker container run make stop on Makefile directory.

Prerequisite: Docker LTS

Flow

  • 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

Custom Environment Variables

  • 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.

Code Formatting

  • 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.