Skip to content

Commit

Permalink
Merge branch 'main' into expo-build-for-pr
Browse files Browse the repository at this point in the history
  • Loading branch information
paribaker authored Jul 19, 2024
2 parents 79518dc + 60f3f44 commit 0c5da30
Show file tree
Hide file tree
Showing 83 changed files with 1,593 additions and 1,027 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,5 @@ jobs:
eas update --branch="${{ needs.getprnumber.outputs.PR }}" --non-interactive --auto
echo "${{ env.BACKEND_SERVER_URL }} and ${{ needs.getprnumber.outputs.PR }}"
env:
BACKEND_SERVER_URL: "${{ github.event.deployment_status.environment_url }}"
ROLLBAR_ACCESS_TOKEN: "1a19e5da05b2435b802d5a81aba2bbd7"
SENTRY_PROJECT_NAME: "tn-staging"
SENTRY_DSN: "https://a7cea97f07ac42fa9e28800b037997c9@o4504899535962112.ingest.sentry.io/4504906332897280"
SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}"
EXPO_PUBLIC_BACKEND_SERVER_URL: "${{ github.event.deployment_status.environment_url }}"
EXPO_PUBLIC_ROLLBAR_ACCESS_TOKEN: "1a19e5da05b2435b802d5a81aba2bbd7"
42 changes: 23 additions & 19 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ jobs:
- run: pipx install pipenv
- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pipenv'
python-version: "3.10"
cache: "pipenv"
- run: pipenv install --dev --deploy
- name: Run Black
run: pipenv run black --check --exclude \{\{cookiecutter .
Expand All @@ -21,8 +21,8 @@ jobs:
- run: pipx install pipenv
- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pipenv'
python-version: "3.10"
cache: "pipenv"
- run: pipenv install --dev --deploy
- name: Run flake8
run: pipenv run flake8 --extend-exclude server
Expand All @@ -36,8 +36,8 @@ jobs:
- run: pipx install pipenv
- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pipenv'
python-version: "3.10"
cache: "pipenv"
- name: 🐍 Install python dependencies
run: pipenv install --dev --deploy
- run: |
Expand All @@ -58,8 +58,8 @@ jobs:
- run: pipx install pipenv
- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pipenv'
python-version: "3.10"
cache: "pipenv"
- name: 🐍 Install python dependencies
run: pipenv install --dev --deploy
- run: |
Expand All @@ -80,8 +80,8 @@ jobs:
- run: pipx install pipenv
- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pipenv'
python-version: "3.10"
cache: "pipenv"
- name: 🐍 Install python dependencies
run: pipenv install --dev --deploy
- run: |
Expand All @@ -90,14 +90,18 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 18
- name: 📦 Install client dependencies
- name: 📦 Install dependencies
env:
NPM_CONFIG_PRODUCTION: false
working-directory: ./my_project/client
run: npm install
- name: Run ESLint
run: |
npm install
- name: 🆎 TypeCheck
working-directory: ./my_project/client
run: npx eslint --ext .js,.ts,.vue,.jsx,.tsx src
run: npm run tslint
- name: 🚧 ESLint
working-directory: ./my_project/client
run: npm run eslint
Lint_Mobile:
runs-on: ubuntu-latest
steps:
Expand All @@ -106,8 +110,8 @@ jobs:
- run: pipx install pipenv
- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pipenv'
python-version: "3.10"
cache: "pipenv"
- name: 🐍 Install python dependencies
run: pipenv install --dev --deploy
- run: |
Expand All @@ -119,10 +123,10 @@ jobs:
node-version: 18.x
- name: 📦 Install dependencies
working-directory: ./my_project/mobile
run: yarn install
run: npm install
- name: 🆎 TypeCheck
working-directory: ./my_project/mobile
run: yarn run tslint
run: npm run lint:tslint
- name: 🚧 ESLint
working-directory: ./my_project/mobile
run: yarn run eslint
run: npm run lint:eslint
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pytest-instafail = "==0.4.2"
PyYAML = "==6.0.1"
PyGithub = "==1.55"
Jinja2 = "==3.0.1"
jinja2-time = "*"

[dev-packages]

Expand Down
722 changes: 378 additions & 344 deletions Pipfile.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"addons": ["heroku-postgresql:standard-0"],
"environments": {
"review": {
"addons": ["heroku-postgresql:mini"]
"addons": ["heroku-postgresql:essential-0"]
}
},
"buildpacks": [
Expand Down
22 changes: 10 additions & 12 deletions resources/app-bs.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,18 @@ module.exports = {
fallbackToCacheTimeout: 0,
url: 'https://u.expo.dev/ec1b86e2-2582-48cf-8a7a-c6d2772ba4f2', // uuid of app
},
plugins: ['sentry-expo'],
hooks: {
postPublish: [
plugins: [
[
'@sentry/react-native/expo',
{
// this set up assumes you are using one application with multiple projects in sentry
file: 'sentry-expo/upload-sourcemaps',
config: {
organization: 'tn-bootstrapper',
project: process.env.SENTRY_PROJECT_NAME,
authToken: process.env.SENTRY_AUTH_TOKEN, // defined in expo secrets
},
},
organization: 'tn-bootstrapper', // replace with org in sentry
project: process.env.SENTRY_PROJECT_NAME, // see readme for these variables
}
],
},
'expo-build-properties',
'expo-localization',
'expo-font',
],
ios: {
supportsTablet: true,
bundleIdentifier: 'org.thinknimble.expo.bootstrapper',
Expand Down
4 changes: 2 additions & 2 deletions {{cookiecutter.project_slug}}/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ USE_AWS_STORAGE='False'
# AWS_SECRET_ACCESS_KEY IAM User's Secret Access Key from the AWS dashboard.
# AWS_STORAGE_BUCKET_NAME The name of the S3 bucket to use for storage.
# AWS_LOCATION Folder location inside of the S3 storage bucket.
# AWS_S3_REGION_NAME Region name (ex: 'us-east-2') required in order to receive correct
# query authorization mechanism parameters for private URLs.
# AWS_S3_REGION_NAME Region name (ex: 'us-east-2') required in order to receive correct
# query authorization mechanism parameters for private URLs.
#
AWS_ACCESS_KEY_ID=''
AWS_SECRET_ACCESS_KEY=''
Expand Down
4 changes: 2 additions & 2 deletions {{cookiecutter.project_slug}}/.github/workflows/expo-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
run: cd mobile && eas update --branch=staging --non-interactive --auto
env:
# Since expo update replaces code OTA these variables should match the staging variables in eas.json
BACKEND_SERVER_URL: ""
ROLLBAR_ACCESS_TOKEN: ""
EXPO_PUBLIC_BACKEND_SERVER_URL: ""
EXPO_PUBLIC_ROLLBAR_ACCESS_TOKEN: ""


7 changes: 4 additions & 3 deletions {{cookiecutter.project_slug}}/.github/workflows/expo-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ jobs:
- name: 🚀 Publish preview
run: |
cd mobile && eas update --branch={{ "${{ needs.setup.outputs.PR }}" }} --non-interactive --auto
echo "{{ "${{ env.BACKEND_SERVER_URL }}" }} and {{ "${{ needs.setup.outputs.PR }}" }}"
echo "{{ "${{ env.EXPO_PUBLIC_BACKEND_SERVER_URL }}" }} and {{ "${{ needs.setup.outputs.PR }}" }}"
env:
BACKEND_SERVER_URL: {{ "${{ github.event.deployment_status.environment_url }}" }}
ROLLBAR_ACCESS_TOKEN: ""
EXPO_PUBLIC_BACKEND_SERVER_URL: {{ "${{ github.event.deployment_status.environment_url }}" }}
EXPO_PUBLIC_ROLLBAR_ACCESS_TOKEN: ""

4 changes: 2 additions & 2 deletions {{cookiecutter.project_slug}}/.github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ jobs:
run: npm install
- name: 🆎 TypeCheck
working-directory: ./mobile
run: npm run tslint
run: npm run lint:tslint
- name: 🚧 ESLint
working-directory: ./mobile
run: npm run eslint
run: npm run lint:eslint
- name: 🎨 Prettier
working-directory: ./mobile
run: npm run format:check
Expand Down
12 changes: 6 additions & 6 deletions {{cookiecutter.project_slug}}/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,33 @@ verify_ssl = true
name = "pypi"

[packages]
Django = "==3.2.6"
django-extensions = "==3.1.3"
Django = "==4.2.*"
django-extensions = "==3.2.3"
django-filter = "==2.4.0"
django-nose = "==1.4.7"
dj-rest-auth = "*"
dj-database-url = "==0.5.0"
django-storages = "==1.11.1" # https://github.com/jschneier/django-storages
boto3 = "==1.18.26"
djangorestframework = "==3.13.*"
djangorestframework = "==3.15.*"
gunicorn = "==20.1.0"
python-decouple = "*"
pytz = "==2021.1"
requests = "==2.*"
whitenoise = "==5.3.0"
psycopg2-binary = "==2.9.1"
psycopg2-binary = "==2.9.*"
django-cors-headers = "==3.8.0"
django-model-utils = "==4.1.1"
drf-yasg = "==1.20.0"
django-multiselectfield = "==0.1.12"
drf-writable-nested = "==0.6.3"
python-slugify = "==5.0.2"
Pillow = "==9.0"
django-currentuser = "==0.5.3"
django-currentuser = "==0.7.0"
drf-nested-routers = "==0.93.3"
django-anymail = "==8.4" # https://github.com/anymail/django-anymail
rollbar = "==0.16.2"
premailer = "*"
drf-spectacular = "*"

[requires]
python_version = "3.10"
Expand Down
6 changes: 3 additions & 3 deletions {{cookiecutter.project_slug}}/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
},
"addons": [
"heroku-postgresql:standard-0",
"papertrail:Choklad"
"papertrail:choklad"
],
"environments": {
"review": {
"addons": [
"heroku-postgresql:mini",
"papertrail:Choklad"
"heroku-postgresql:essential-0",
"papertrail:choklad"
]
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# These variables are available only when running locally
# You can use this file to override them by prefixing with `EXPO_PUBLIC_`

# BACKEND_SERVER_URL="https://{{ cookiecutter.project_slug }}-staging.herokuapp.com"
# ROLLBAR_ACCESS_TOKEN=''
# SENTRY_PROJECT_NAME=''
# SENTRY_DSN=""
# SENTRY_AUTH_TOKEN=""
# EXPO_PUBLIC_BACKEND_SERVER_URL="https://{{ cookiecutter.project_slug }}-staging.herokuapp.com"
# EXPO_PUBLIC_ROLLBAR_ACCESS_TOKEN=''
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ module.exports = {
'react/react-in-jsx-scope': 'off',
'@typescript-eslint/no-unused-vars': 'warn',
},
ignorePatterns: ['tailwind.config.js', 'metro.config.js'],
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ media/
# will be generated after `expo run:ios` or `expo run:android`
ios/
android/
metro.config.js
react-native.config.js
index.js

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { AppRoot } from '@screens/routes'
import * as Sentry from '@sentry/react-native'
import { useAuth } from '@stores/auth'
import { QueryClientProvider } from '@tanstack/react-query'
import { customFonts } from '@utils/fonts'
Expand All @@ -13,6 +14,7 @@ import React, { useCallback, useEffect, useState } from 'react'
import { flushSync } from 'react-dom'
import { LogBox, StyleSheet } from 'react-native'
import { GestureHandlerRootView } from 'react-native-gesture-handler'
import './global.css'

LogBox.ignoreLogs(['Require'])

Expand All @@ -34,7 +36,7 @@ const styles = StyleSheet.create({

SplashScreen.preventAutoHideAsync()

export default (): JSX.Element => {
export default Sentry.wrap((): JSX.Element => {
const [ready, setReady] = useState(false)
const hasLocalStorageHydratedState = useAuth.use.hasHydrated()

Expand All @@ -60,4 +62,4 @@ export default (): JSX.Element => {
</QueryClientProvider>
</GestureHandlerRootView>
)
}
})
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ declare const Config: {
backendServerUrl: string
logger: Logger['logger']
sentryDSN: string
isExpoGo?: boolean
}

export default Config
34 changes: 20 additions & 14 deletions {{cookiecutter.project_slug}}/clients/mobile/react-native/Config.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,36 @@
import Logger from './logger'
import { BACKEND_SERVER_URL, ROLLBAR_ACCESS_TOKEN, SENTRY_DSN } from '@env'
import Constants, { ExecutionEnvironment } from 'expo-constants'
import { Platform } from 'react-native'
import Constants from 'expo-constants'
import Logger from './logger'

const BACKEND_SERVER_URL = process.env.EXPO_PUBLIC_BACKEND_SERVER_URL
const SENTRY_DSN = process.env.EXPO_PUBLIC_SENTRY_DSN
const ROLLBAR_ACCESS_TOKEN = process.env.EXPO_PUBLIC_ROLLBAR_ACCESS_TOKEN

const { backendServerUrl, buildEnv, rollbarAccessToken, sentryDSN } = Constants?.expoConfig?.extra
const { backendServerUrl, rollbarAccessToken, sentryDSN } = Constants?.expoConfig?.extra

const isExpoGo = Constants.executionEnvironment === ExecutionEnvironment.StoreClient
const isAndroid = Platform.OS === 'android'
let rollbarToken = isAndroid ? undefined : ROLLBAR_ACCESS_TOKEN

const ENV = () => {
if (buildEnv) {
rollbarToken = rollbarAccessToken
if (!isExpoGo) {
let rollbarToken = isAndroid ? undefined : rollbarAccessToken
const logger = new Logger(rollbarToken).logger
return {
backendServerUrl: backendServerUrl,
logger: new Logger(rollbarToken).logger,
sentryDSN: sentryDSN,
backendServerUrl,
logger,
sentryDSN,
}
}

let rollbarToken = isAndroid ? undefined : ROLLBAR_ACCESS_TOKEN
const logger = new Logger(rollbarToken).logger
return {
backendServerUrl: BACKEND_SERVER_URL,
logger: new Logger(rollbarToken).logger,
logger,
sentryDSN: SENTRY_DSN,
isExpoGo,
}
}

Config = { ...ENV() }

export default Config
const Config = { ...ENV() }
export default Config
Loading

0 comments on commit 0c5da30

Please sign in to comment.