Skip to content

Commit

Permalink
Created Drive App
Browse files Browse the repository at this point in the history
  • Loading branch information
souyahia-monk committed Apr 29, 2024
1 parent 7ed9bd5 commit 39b1d38
Show file tree
Hide file tree
Showing 58 changed files with 1,593 additions and 5 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/build-drive-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build Drive App
run-name: Build Drive App On Pull Request

on:
pull_request:
branches: [main]

jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

steps:
- name: 💾 Checking out the repository
uses: actions/checkout@v4
- name: ⚙️ Setting up the MonkJs project
uses: ./.github/actions/monkjs-set-up
- name: 📱 Building the Drive app
run: yarn build:drive-app:staging
59 changes: 59 additions & 0 deletions .github/workflows/deploy-drive-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Deploy Drive App
run-name: Deploy Drive App To Staging After Merge

on:
push:
branches: [ main ]

jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

steps:
- name: 💾 Checking out the repository
uses: actions/checkout@v4
- name: ⚙️ Setting up the MonkJs project
uses: ./.github/actions/monkjs-set-up
- name: 📱 Building the Drive app
run: yarn build:drive-app:staging
- name: 📦 Uploading the artifact
uses: actions/[email protected]
with:
name: build-drive-app-staging
path: apps/drive-app/build

deploy:
name: Deploy
environment: staging
needs:
- build
container:
image: dtzar/helm-kubectl:3.14.2
runs-on: ubuntu-latest
steps:
- name: 🔐 Authenticating to Google Cloud
uses: google-github-actions/[email protected]
with:
credentials_json: "${{ secrets.GKE_SA_KEY }}"
- name: 🔐 Obtaining GKE credentials
uses: google-github-actions/[email protected]
with:
cluster_name: ${{ secrets.GKE_CLUSTER }}
location: ${{ secrets.GKE_ZONE }}
project_id: ${{ secrets.GKE_PROJECT }}
- name: 📦 Downloading the artifact
uses: actions/[email protected]
with:
name: build-drive-app-staging
path: drive-staging
- name: 🧹 Cleaning up previous build
run: |-
kubectl -n poc exec -it $(kubectl get pods -n poc -l app.kubernetes.io/instance=poc-spa --no-headers | awk '{print $1}') -- rm -rf drive-staging
- name: 🌐 Deploying app
run: |-
kubectl -n poc cp drive-staging poc/$(kubectl get pods -n poc -l app.kubernetes.io/instance=poc-spa --no-headers | awk '{print $1}'):/app/
37 changes: 37 additions & 0 deletions apps/drive-app/.env-cmdrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"local": {
"PORT": "17200",
"HTTPS": "true",
"ESLINT_NO_DEV_ERRORS": "true",
"REACT_APP_ENVIRONMENT": "local",
"REACT_APP_API_DOMAIN": "api.preview.monk.ai/v1",
"REACT_APP_AUTH_DOMAIN": "idp.preview.monk.ai",
"REACT_APP_AUTH_AUDIENCE": "https://api.monk.ai/v1/",
"REACT_APP_AUTH_CLIENT_ID": "O7geYcPM6zEJrHw0WvQVzSIzw4WzrAtH",
"REACT_APP_SENTRY_DSN": "https://496e3a7f8e04df38e76d579c27c30e87@o4505669501648896.ingest.us.sentry.io/4507169054326784"
},
"development": {
"REACT_APP_ENVIRONMENT": "development",
"REACT_APP_API_DOMAIN": "api.preview.monk.ai/v1",
"REACT_APP_AUTH_DOMAIN": "idp.preview.monk.ai",
"REACT_APP_AUTH_AUDIENCE": "https://api.monk.ai/v1/",
"REACT_APP_AUTH_CLIENT_ID": "O7geYcPM6zEJrHw0WvQVzSIzw4WzrAtH",
"REACT_APP_SENTRY_DSN": "https://496e3a7f8e04df38e76d579c27c30e87@o4505669501648896.ingest.us.sentry.io/4507169054326784"
},
"staging": {
"REACT_APP_ENVIRONMENT": "staging",
"REACT_APP_API_DOMAIN": "api.preview.monk.ai/v1",
"REACT_APP_AUTH_DOMAIN": "idp.preview.monk.ai",
"REACT_APP_AUTH_AUDIENCE": "https://api.monk.ai/v1/",
"REACT_APP_AUTH_CLIENT_ID": "O7geYcPM6zEJrHw0WvQVzSIzw4WzrAtH",
"REACT_APP_SENTRY_DSN": "https://496e3a7f8e04df38e76d579c27c30e87@o4505669501648896.ingest.us.sentry.io/4507169054326784"
},
"preview": {
"REACT_APP_ENVIRONMENT": "preview",
"REACT_APP_API_DOMAIN": "api.preview.monk.ai/v1",
"REACT_APP_AUTH_DOMAIN": "idp.preview.monk.ai",
"REACT_APP_AUTH_AUDIENCE": "https://api.monk.ai/v1/",
"REACT_APP_AUTH_CLIENT_ID": "O7geYcPM6zEJrHw0WvQVzSIzw4WzrAtH",
"REACT_APP_SENTRY_DSN": "https://496e3a7f8e04df38e76d579c27c30e87@o4505669501648896.ingest.us.sentry.io/4507169054326784"
}
}
1 change: 1 addition & 0 deletions apps/drive-app/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
14 changes: 14 additions & 0 deletions apps/drive-app/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const OFF = 0;
const WARN = 1;
const ERROR = 2;

module.exports = {
extends: ['@monkvision/eslint-config-typescript-react'],
parserOptions: {
project: ['./tsconfig.json'],
},
rules: {
'import/no-extraneous-dependencies': OFF,
'no-console': OFF,
}
}
26 changes: 26 additions & 0 deletions apps/drive-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# builds
build/
lib/
dist/
module/
commonjs/
typescript/
web-build/

# modules
node_modules/
coverage/
.expo/
.docusaurus/

# logs
npm-debug.*
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# cache
.eslintcache

# misc
.DS_Store
32 changes: 32 additions & 0 deletions apps/drive-app/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
The Clear BSD License

Copyright (c) [2022] [Monk](http://monk.ai)
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted (subject to the limitations in the disclaimer
below) provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.

NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
59 changes: 59 additions & 0 deletions apps/drive-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Drive App
This application is a custom capture app designed for Drive.

# Running the App
In order to run the app, you will need to have [NodeJs](https://nodejs.org/en) >= 16 and
[Yarn 3](https://yarnpkg.com/getting-started/install) installed. Then, you'll need to install the required dependencies
using the following command :

```bash
yarn install
```

You then need to copy the local environment configuration available in the `env.txt` file at the root of the directory
into an env file called `.env` :

```bash
cp env.txt .env
```

You can then start the app by running :

```bash
yarn start
```

The application is by default available at `https://localhost:17200/`.

# Building the App
To build the app, you simply need to run the following command :

```bash
yarn build
```

Don't forget to update the environment variables defined in your `.env` file for the target website.

# Testing
## Running the Tests
To run the tests of the app, simply run the following command :

```bash
yarn test
```

To run the tests as well as collecgt coverage, run the following command :

```bash
yarn test:coverage
```

## Analyzing Bundle Size
After building the app using the `yarn build` command, you can analyze the bundle size using the following command :

```bash
yarn analyze
```

This will open a new window on your desktop browser where you'll be able to see the sizes of each module in the final
app.
13 changes: 13 additions & 0 deletions apps/drive-app/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const { react } = require('@monkvision/jest-config');

module.exports = {
...react,
coverageThreshold: {
global: {
branches: 0,
functions: 0,
lines: 0,
statements: 0,
},
},
};
106 changes: 106 additions & 0 deletions apps/drive-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"name": "drive-app",
"version": "4.0.0",
"license": "BSD-3-Clause-Clear",
"packageManager": "[email protected]",
"description": "MonkJs capture app for Drive",
"author": "monkvision",
"private": true,
"scripts": {
"start": "env-cmd -e local react-scripts start",
"build:development": "env-cmd -e development react-scripts build",
"build:staging": "env-cmd -e staging react-scripts build",
"build:preview": "env-cmd -e preview react-scripts build",
"test": "jest",
"test:coverage": "jest --coverage",
"analyze": "source-map-explorer 'build/static/js/*.js'",
"eject": "react-scripts eject",
"prettier": "prettier --check ./src",
"prettier:fix": "prettier --write ./src",
"eslint": "eslint --format=pretty ./src",
"eslint:fix": "eslint --fix --format=pretty ./src",
"lint": "yarn run prettier && yarn run eslint",
"lint:fix": "yarn run prettier:fix && yarn run eslint:fix"
},
"dependencies": {
"@auth0/auth0-react": "^2.2.4",
"@monkvision/common": "4.0.0",
"@monkvision/common-ui-web": "4.0.0",
"@monkvision/inspection-capture-web": "4.0.0",
"@monkvision/monitoring": "4.0.0",
"@monkvision/network": "4.0.0",
"@monkvision/sentry": "4.0.0",
"@monkvision/sights": "4.0.0",
"@monkvision/types": "4.0.0",
"@types/babel__core": "^7",
"@types/jest": "^27.5.2",
"@types/node": "^16.18.18",
"@types/react": "^17.0.2",
"@types/react-dom": "^17.0.2",
"@types/react-router-dom": "^5.3.3",
"@types/sort-by": "^1",
"axios": "^1.5.0",
"i18next": "^23.4.5",
"i18next-browser-languagedetector": "^7.1.0",
"jest-watch-typeahead": "^2.2.2",
"localforage": "^1.10.0",
"match-sorter": "^6.3.4",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-i18next": "^13.2.0",
"react-router-dom": "^6.22.3",
"react-scripts": "5.0.1",
"sort-by": "^1.2.0",
"source-map-explorer": "^2.5.3",
"typescript": "^4.9.5",
"web-vitals": "^2.1.4"
},
"devDependencies": {
"@babel/core": "^7.22.9",
"@monkvision/eslint-config-base": "4.0.0",
"@monkvision/eslint-config-typescript": "4.0.0",
"@monkvision/eslint-config-typescript-react": "4.0.0",
"@monkvision/jest-config": "4.0.0",
"@monkvision/prettier-config": "4.0.0",
"@monkvision/test-utils": "4.0.0",
"@monkvision/typescript-config": "4.0.0",
"@testing-library/dom": "^8.20.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^12.1.5",
"@testing-library/react-hooks": "^8.0.1",
"@testing-library/user-event": "^12.1.5",
"@typescript-eslint/eslint-plugin": "^5.43.0",
"@typescript-eslint/parser": "^5.43.0",
"env-cmd": "^10.1.0",
"eslint": "^8.29.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-formatter-pretty": "^4.1.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^25.3.0",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.27.1",
"eslint-plugin-react-hooks": "^4.3.0",
"eslint-utils": "^3.0.0",
"jest": "^29.3.1",
"prettier": "^2.7.1",
"regexpp": "^3.2.0",
"ts-jest": "^29.0.3"
},
"prettier": "@monkvision/prettier-config",
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Binary file added apps/drive-app/public/favicon.ico
Binary file not shown.
Loading

0 comments on commit 39b1d38

Please sign in to comment.