Skip to content

Commit

Permalink
Merge branch 'andrew_testing' into feat/crud-tests-for-template-routes
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-bierman authored May 8, 2024
2 parents 3852bfa + e1f25e5 commit 3a875bd
Show file tree
Hide file tree
Showing 526 changed files with 21,336 additions and 9,735 deletions.
38 changes: 38 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 🛎️ For local dev
# 👉 Rename this file to .env.local
# 👉 Fill in the values below.

# MongoDB
MONGODB_URI="Your mongodb URI"

# Client
PUBLIC_CLIENT_URL="Your client url"
PUBLIC_NODE_ENV='development'
PUBLIC_API_URL='Your api url'
PUBLIC_APP="App identifier"

# API Keys
PUBLIC_NPS_API="Your api key"
PUBLIC_GEOAPIFY_KEY="Your api key"
PUBLIC_GOOGLE_PLACES_API_KEY='Your api key'
PUBLIC_MAPBOX_API_KEY="Your api key, starts with pk..."
PUBLIC_OPENWEATHER_KEY="Your api key"
PUBLIC_X_RAPIDAPI_KEY="Your api key"
PUBLIC_MAPBOX_ACCESS_TOKEN="Your api key, starts with pk..."
PUBLIC_MAPBOX_DOWNLOADS_TOKEN="Your api key, starts with sk..."
PUBLIC_MAPBOX_DOWNLOADS_TOKEN2="Your api key, starts with sk..."

# Google OAuth
PUBLIC_WEB_CLIENT_ID="Your Google OAuth web client ID"
PUBLIC_ANDROID_CLIENT_ID="Your Google OAuth Android client ID"
PUBLIC_IOS_CLIENT_ID="Your Google OAuth iOS client ID"
PUBLIC_GOOGLE_ID="Google client ID"

# Firebase
PUBLIC_FIREBASE_API_KEY='Your api key'
PUBLIC_FIREBASE_AUTH_DOMAIN="Your auth domain"
PUBLIC_FIREBASE_PROJECT_ID="Your firebase project id"
PUBLIC_FIREBASE_STORAGE_BUCKET="Your firebase_storage_key_link"
PUBLIC_FIREBASE_MESSAGING_SENDER_ID="Your firebase_messaging_sender_ID"
PUBLIC_FIREBASE_APP_ID="Your firebase app id"
PUBLIC_FIREBASE_MEASUREMENT_ID="Your firebase_measurement_id"
19 changes: 19 additions & 0 deletions .github/actions/install-deps/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: 'Install Dependencies'
description: 'Install Node.js dependencies'
runs:
using: 'composite'
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Cache Yarn packages
uses: actions/cache@v2
with:
path: ~/.yarn/cache
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --immutable
shell: bash
14 changes: 14 additions & 0 deletions .github/actions/set-env-tokens/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: 'Set Environment Tokens'
description: 'Set environment variables for various tokens'
inputs:
mapbox_token:
description: 'Mapbox Downloads Token'
required: false
default: ''
runs:
using: 'composite'
steps:
- name: Set Mapbox Downloads Token
if: inputs.mapbox_token != ''
run: export MAPBOX_DOWNLOADS_TOKEN=${{ inputs.mapbox_token }}
shell: bash
41 changes: 41 additions & 0 deletions .github/actions/setup-eas/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: 'Setup EAS'
description: 'Set up EAS and install dependencies'

inputs:
expo-token:
description: 'Expo token for authentication'
required: true
node-version:
description: 'Node.js version to use'
required: true
default: '20.x'

runs:
using: 'composite'
steps:
- name: Check for EXPO_TOKEN
run: |
if [ -z "${{ inputs.expo-token }}" ]; then
echo "You must provide an EXPO_TOKEN secret linked to this project's Expo account in this repo's secrets. Learn more: https://docs.expo.dev/eas-update/github-actions"
exit 1
fi
shell: bash

- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node-version }}
cache: yarn

- name: Setup EAS
uses: expo/expo-github-action@v8
with:
eas-version: latest
token: ${{ inputs.expo-token }}

- name: Install dependencies
run: yarn install
shell: bash
22 changes: 22 additions & 0 deletions .github/actions/setup-js-runtime/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: 'Setup JS Runtime Environment'
description: 'Sets up Node.js and caches Node modules'
runs:
using: 'composite'
steps:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '20.x'
cache: 'yarn'

- name: Cache Yarn packages
uses: actions/cache@v2
with:
path: ~/.yarn/cache
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --immutable
shell: bash
61 changes: 61 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
root:
- changed-files:
- any-glob-to-any-file: '*'

docs:
- changed-files:
- any-glob-to-any-file: '{docs/**/*,guides/**/*,**/*.md}'

feature:
- head-branch: ['^feature', 'feature']

release:
- base-branch: 'main'

test:
- changed-files:
- any-glob-to-any-file:
- '**/*.spec.ts'
- '**/*.spec.js'
- '**/*.test.ts'
- '**/*.test.js'
- '**/tests/**/*.ts'
- '**/tests/**/*.js'

frontend:
- changed-files:
- any-glob-to-any-file: 'apps/**/*.{ts,js, jsx, tsx}'

backend:
- changed-files:
- any-glob-to-any-file: 'server/**/*.{ts,js}'

AnyChange:
- changed-files:
- any-glob-to-any-file: '*'

client:
- changed-files:
- any-glob-to-any-file: 'apps/**/*'

expo:
- changed-files:
- any-glob-to-any-file: 'apps/expo/**/*'

next:
- changed-files:
- any-glob-to-any-file: 'apps/next/**/*'

vite:
- changed-files:
- any-glob-to-any-file: 'apps/vite/**/*'

api:
- changed-files:
- any-glob-to-any-file:
- 'api/**/*'
- 'server/**/*'

github:
- changed-files:
- any-glob-to-any-file: '.github/**/*'
110 changes: 110 additions & 0 deletions .github/scripts/env.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import * as fs from 'fs-extra';
import * as path from 'path';

const isCI = process.env.CI === 'true';
if (isCI) {
console.log('🏃 CI detected, skipping .env.local generation');
process.exit(0);
}

console.log('🔥 Generating .env.local files');

const autogeneratedComment =
'# This file is autogenerated. To make changes, modify the root level .env.local file and run bun install\n\n';
const outputName = '.env.local';

// Read the .env file
const envFilePath = path.join(__dirname, '..', '..', outputName);
if (!fs.existsSync(envFilePath)) {
console.log('🛑 .env file does not exist');
process.exit(0);
}
const envFileContent = fs.readFileSync(envFilePath, 'utf8');

/**
* Generate Expo .env file content
*/
const expoOutputPath = path.join(
__dirname,
'..',
'..',
'apps',
'expo',
outputName,
);
const expoFileContent = envFileContent
.split('\n')
.map((line) => {
if (line.startsWith('PUBLIC_')) {
return line.replace(/^PUBLIC_/, 'EXPO_PUBLIC_');
}
})
.join('\n');
const expoNoTelemetry = 'EXPO_NO_TELEMETRY=true';
fs.writeFileSync(
expoOutputPath,
`${autogeneratedComment}\n${expoFileContent}\n${expoNoTelemetry}`,
);

/**
* Generate Next.js .env file content
*/
const nextOutputPath = path.join(
__dirname,
'..',
'..',
'apps',
'next',
outputName,
);
const nextFileContent = envFileContent
.split('\n')
.map((line) => {
if (line.startsWith('PUBLIC_')) {
return line.replace(/^PUBLIC_/, 'NEXT_PUBLIC_');
}
})
.join('\n');
fs.writeFileSync(nextOutputPath, `${autogeneratedComment}\n${nextFileContent}`);

/**
* Generate Vite.js .env file content
*/
const viteOutputPath = path.join(
__dirname,
'..',
'..',
'apps',
'vite',
outputName,
);
const viteFileContent = envFileContent
.split('\n')
.map((line) => {
if (line.startsWith('PUBLIC_')) {
return line.replace(/^PUBLIC_/, 'VITE_');
}
})
.join('\n');
fs.writeFileSync(viteOutputPath, `${autogeneratedComment}\n${viteFileContent}`);

// TODO: Add wrangler env generation
/**
* Generate Cloudflare Wrangler .dev.vars file content
*/
// const wranglerOutputPath = path.join(__dirname, '..', '..', 'packages', 'api', '.dev.vars')
// // Remove public variables from output
// const wranglerFileContent = envFileContent
// .split('\n')
// .map((line) => {
// if (line.startsWith('PUBLIC_APP_URL')) return line.replace(/^PUBLIC_APP_URL/, 'APP_URL')
// if (!line.startsWith('PUBLIC_')) {
// return line
// }
// })
// .join('\n')
// const noD1Warning = 'NO_D1_WARNING=true'
// fs.writeFileSync(
// wranglerOutputPath,
// `${autogeneratedComment}\n${wranglerFileContent}\n${noD1Warning}`
// )
2 changes: 2 additions & 0 deletions .github/secrets/.secrets.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
EXPO_TOKEN="your_token_here"
MAPBOX_DOWNLOADS_TOKEN="your_mapbox_token_here"
49 changes: 49 additions & 0 deletions .github/workflows/android-build-manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: android build manual

on:
workflow_dispatch:
inputs:
name:
description: 'Build manually'
default: 'World'
required: true
type: string

jobs:
update:
name: EAS Android Preview Build
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Check for EXPO_TOKEN
run: |
if [ -z "${{ secrets.EXPO_TOKEN }}" ]; then
echo "You must provide an EXPO_TOKEN secret linked to this project's Expo account in this repo's secrets. Learn more: https://docs.expo.dev/eas-update/github-actions"
exit 1
fi
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 20.x
cache: yarn

- name: Setup EAS
uses: expo/expo-github-action@v8
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}

- name: Install dependencies
uses: ./.github/actions/install-deps

- name: Create preview
uses: expo/expo-github-action/preview@v8
with:
working-directory: apps/expo
command: eas build --platform android --profile preview
Loading

0 comments on commit 3a875bd

Please sign in to comment.