ipwa-demo v0.2.0
āļø Star us on GitHub ā it helps!
iPWA
š Spin up an isomorphic progressive web app or native app deployable in the cloud, publishable as AN npm package or docker container with a fully automated supercharged pipeline, all in under an hour!
Salient Features
- Frontend in React, Redux
- Backend in Node
- Native in React Native (Expo)
- Isomorphic/Progressive Web Apps
- Unit testing using Jest
- Code coverage reports using Codecov
- Regression testing using Cypress, Puppeteer & Percy
- Fully automated pipeline using Github actions
- Deployable in Dockerhub, Github Container Registry as Docker image
- Publishable in npm, Github package registry as npm package
- Publishable in Expo as OTA updates.
- Deployable in Google Container Registry using Terraform (WIP)
- Helm charts deployable in a Kubernetes Cluster (WIP)
How this works
This package was created with automated pipeline in mind. All you need to do is spin up a new project, sign up to a few providers, set the tokens and secrets correctly and the rest is all magic. When you push code to master, it will just be deployed everywhere after a series of checks.
Setup Project
Install ipwa globally
`npm i -g ipwa`Spawn a new ipwa app
`ipwa my-app install`This will create a new project called my-app in the current directory and install npm dependencies.
Create a new project in Github. Do not push anything yet.
Create new Codecov app and set CODECOV_TOKEN secret in Github. This is where our unit test reports are stored.
Create new Heroku app and set HEROKU_APP_NAME in ./.github/workflows/build-master.yml and HEROKU_API_KEY secret in Github. This is where our app will be staged.
Set your stage url in .configrc
Run npm run test:cypress:open, create a new project in Cypress and set CYPRESS_PROJECT_ID and CYPRESS_TOKEN secrets in Github.
Create new Percy app and set PERCY_TOKEN secrets in Github. This is where our visual regression test reports are stored.
Sign up to Docker and set DOCKER_USER and DOCKER_PASS secrets in Github. This is where our docker image is pushed.
Set GITHUB_DOCKER_IMAGE_NAME & DOCKERHUB_DOCKER_IMAGE_NAME in ./.github/workflows/build-master.yml. The docker image above will be pushed to Github package registry as well.
Sign up to npm and set NPM_TOKEN secret in Github.
Sign up to expo and set EXPO_CLI_USERNAME and EXPO_CLI_PASSWORD secrets in Github. This is where our expo app will be published.
Create new firebase app and set FIREBASE_APP_NAME in ./.github/workflows/build-master.yml and FIREBASE_TOKEN secrets in Github. This will be our production environment.
Push the new project you just created to Github.
Local setup
Install ipwa
npm i -g ipwaSpawn a new ipwa app.
ipwa my-app installRun app locally
Make sure npm dependencies are installed.
npm run dev in one shell,
npm run nodemon in another.
Run app as docker container
- Set the following environment variables.
DOCKERHUB_DOCKER_IMAGE_NAME
npm run build:dockerRun as a helm app
Make sure minikube and helm are installed.
Set HELM_APP_NAME environment variable.
npm run build:helmUnit tests
npm run testRun Codecov
- Set the following environment variables.
CODECOV_TOKEN
npm run test:codecovRun Cypress tests
- Set the following environment variables.
CYPRESS_PROJECT_IDCYPRESS_TOKEN
npm run test:cypress:openRun Percy
- Set the following environment variables.
PERCY_TOKEN
npm run test:percyRun Puppeteer
npm run test:puppeteerDeploy on Heroku
Set the following environment variables.
HEROKU_APP_NAMEHEROKU_API_KEY
npm run release:herokuDeploy on Firebase
- Set the following environment variables.
FIREBASE_TOKEN
npm run release:firebaseRelease image on Dockerhub Container Registry
Set the following environment variables:
DOCKER_USERDOCKER_PASSDOCKERHUB_DOCKER_IMAGE_NAME
npm run release:dockerhubRelease image on Github Container Registry
Set the following environment variables:
GITHUB_REPOGITHUB_DOCKER_IMAGE_NAMEGITHUB_USERGITHUB_TOKEN
npm run release:githubRelease npm package to npm registry
- Set the following environment variables:
NPM_TOKEN
npm run release:npmPublish app on Expo
- Set the following environment variables.
EXPO_CLI_USERNAMEEXPO_CLI_PASSWORD
npm run release:expo6 years ago