Skip to content

Commit

Permalink
Removed turborepo, cleaned up API server, bumped dependencies, added …
Browse files Browse the repository at this point in the history
…run-p script in place of turbo
  • Loading branch information
Timothy Miller committed Nov 1, 2023
1 parent b083f4b commit 6fdd61c
Show file tree
Hide file tree
Showing 14 changed files with 69 additions and 126 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ jobs:
name: Deploy to Cloudflare Workers
runs-on: ubuntu-latest
timeout-minutes: 10
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}

steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ jobs:
permissions:
contents: read
deployments: write
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}

steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down
18 changes: 9 additions & 9 deletions apps/expo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,33 @@
"expo": "^49.0.16",
"expo-apple-authentication": "~6.1.2",
"expo-constants": "~14.4.2",
"expo-crypto": "~12.4.1",
"expo-crypto": "~12.6.0",
"expo-dev-client": "~2.4.11",
"expo-font": "~11.6.0",
"expo-image": "~1.5.1",
"expo-linear-gradient": "~12.5.0",
"expo-linking": "6.0.0",
"expo-router": "^2.0.9",
"expo-router": "^2.0.10",
"expo-splash-screen": "^0.22.0",
"expo-status-bar": "~1.7.1",
"expo-system-ui": "^2.6.0",
"expo-updates": "^0.18.16",
"expo-web-browser": "~12.3.2",
"expo-updates": "^0.18.17",
"expo-web-browser": "~12.5.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-native": "^0.72.6",
"react-native-gesture-handler": "~2.13.3",
"react-native-gesture-handler": "~2.13.4",
"react-native-mmkv": "^2.10.2",
"react-native-safe-area-context": "4.7.2",
"react-native-screens": "^3.26.0",
"react-native-safe-area-context": "4.7.4",
"react-native-screens": "^3.27.0",
"react-native-svg": "^13.14.0"
},
"devDependencies": {
"@babel/core": "^7.23.2",
"@expo/metro-config": "^0.10.7",
"@tamagui/babel-plugin": "1.75.5",
"@tamagui/babel-plugin": "1.75.9",
"babel-plugin-transform-inline-environment-variables": "^0.4.4",
"metro-minify-terser": "^0.79.1",
"metro-minify-terser": "^0.80.0",
"react-native-dotenv": "^3.4.9",
"typescript": "^5.2.2"
}
Expand Down
8 changes: 8 additions & 0 deletions apps/next/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ module.exports = function () {
optimizeCss,
forceSwcTransforms: true,
scrollRestoration: true,
swcPlugins: [
[
'next-superjson-plugin',
{
excluded: [],
},
],
],
},
compiler: {
removeConsole: disableBrowserLogs
Expand Down
18 changes: 9 additions & 9 deletions apps/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@
},
"dependencies": {
"@ducanh2912/next-pwa": "^9.7.2",
"@supabase/auth-helpers-nextjs": "^0.8.3",
"@supabase/auth-helpers-nextjs": "^0.8.4",
"@supabase/auth-helpers-react": "^0.4.2",
"@t4/ui": "*",
"@tamagui/next-theme": "1.75.5",
"@tsndr/cloudflare-worker-jwt": "^2.2.2",
"@tamagui/next-theme": "1.75.9",
"@tsndr/cloudflare-worker-jwt": "^2.2.5",
"app": "*",
"million": "2.6.4",
"next": "13.5.6",
"next": "14.0.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-native": "^0.72.6",
"react-native-web-lite": "1.75.5",
"react-native-web-lite": "1.75.9",
"webpack": "^5.88.2"
},
"devDependencies": {
"@tamagui/next-plugin": "1.75.5",
"@types/react": "^18.2.21",
"@tamagui/next-plugin": "1.75.9",
"@types/react": "^18.2.33",
"dotenv-cli": "^7.3.0",
"eslint-config-next": "^13.5.6",
"vercel": "^32.4.1"
"eslint-config-next": "^14.0.1",
"vercel": "^32.5.0"
}
}
Binary file modified bun.lockb
Binary file not shown.
27 changes: 12 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
"license": "MIT",
"version": "3.0.0",
"scripts": {
"dev": "turbo dev --parallel --filter={next-app,@t4/api}",
"dev": "run-p api web",
"ios": "cd apps/expo && bun ios",
"android": "cd apps/expo && bun android",
"web": "cd apps/next && bun run dev",
"api": "cd packages/api && bun dev",
"notes": "cd apps/docs && bun dev",
"generate": "cd packages/api && bun generate",
"migrate:local": "cd packages/api && bun migrate:local",
"seed:local": "cd packages/api && bun seed:local",
"migrate": "cd packages/api && bun migrate",
"seed": "cd packages/api && bun seed",
"native": "cd apps/expo && bun dev",
"studio": "cd packages/api && bun studio",
"native:prod": "cd apps/expo && bun dev:prod",
Expand All @@ -20,17 +24,12 @@
"build:ios:preview": "cd apps/expo && bun build:ios:preview",
"build:android:preview": "cd apps/expo && bun build:android:preview",
"submit:android": "cd apps/expo && eas submit --platform android --path ./app-release.aab",
"generate": "cd packages/api && bun generate",
"migrate:local": "cd packages/api && bun migrate:local",
"seed:local": "cd packages/api && bun seed:local",
"migrate": "cd packages/api && bun migrate",
"seed": "cd packages/api && bun seed",
"check-deps": "check-dependency-version-consistency .",
"check-types": "tsc --noEmit",
"fix": "manypkg fix",
"postinstall": "bun run build",
"postinstall": "bun run build && bun run check-deps",
"clean": "git clean -xdf node_modules && rm bun.lockb",
"clean:workspaces": "turbo clean"
"clean:all": "npm-run-all clean"
},
"workspaces": [
"apps/*",
Expand All @@ -40,17 +39,15 @@
"@babel/runtime": "^7.23.2",
"@manypkg/cli": "^0.21.0",
"@nderscore/tamagui-typescript-plugin": "^0.6.0",
"@supabase/supabase-js": "^2.38.2",
"@supabase/supabase-js": "^2.38.4",
"check-dependency-version-consistency": "^4.1.0",
"cross-env": "^7.0.3",
"eslint": "^8.52.0",
"next-superjson-plugin": "^0.5.9",
"npm-run-all": "^4.1.5",
"prettier": "^3.0.3",
"react-native-url-polyfill": "^2.0.0",
"turbo": "latest",
"typescript": "^5.2.2",
"workerd": "1.20231025.0"
},
"engines": {
"node": ">=18.16.1"
"workerd": "1.20231030.0"
}
}
8 changes: 4 additions & 4 deletions packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
"@tsndr/cloudflare-worker-jwt": "^2.2.5",
"drizzle-orm": "^0.28.6",
"drizzle-valibot": "^0.1.1",
"hono": "^3.9.0",
"miniflare": "3.20231025.0",
"superjson": "^1.13.1",
"valibot": "^0.19.0"
"hono": "^3.9.1",
"miniflare": "3.20231025.1",
"superjson": "^2.2.0",
"valibot": "^0.20.0"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20231025.0",
Expand Down
8 changes: 3 additions & 5 deletions packages/api/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,14 @@ interface ApiContextProps {
export const createContext = async (
d1: D1Database,
JWT_VERIFICATION_KEY: string,
opts: FetchCreateContextFnOptions,
isBunTime?: boolean,
databaseId?: string
opts: FetchCreateContextFnOptions
): Promise<ApiContextProps> => {
const db = createDb(d1, isBunTime, databaseId)
const db = createDb(d1)

async function getUser() {
const sessionToken = opts.req.headers.get('authorization')?.split(' ')[1]

if (sessionToken) {
if (sessionToken !== undefined && sessionToken !== 'undefined') {
if (!JWT_VERIFICATION_KEY) {
console.error('JWT_VERIFICATION_KEY is not set')
return null
Expand Down
11 changes: 1 addition & 10 deletions packages/api/src/db/client.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
import { drizzle } from 'drizzle-orm/d1'
// import { drizzle as drizzleBun, BunSQLiteDatabase } from 'drizzle-orm/bun-sqlite'
// import { Database } from 'bun:sqlite'

export const createDb = (d1: D1Database, isBunTime?: boolean, databaseId?: string) => {
// if (isBunTime === true) {
// const pathSQLite = './.wrangler/state/v3/d1/' + databaseId + '/db.sqlite'
// const sqlite = new Database(pathSQLite)
// const db: BunSQLiteDatabase = drizzleBun(sqlite)
// return db
// }
export const createDb = (d1: D1Database) => {
return drizzle(d1)
}
12 changes: 1 addition & 11 deletions packages/api/src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@ type Bindings = {
DB: D1Database
JWT_VERIFICATION_KEY: string
APP_URL: string
// For local development
IS_BUN_TIME?: boolean
DATABASE_ID?: string
}

console.log('hello')
const app = new Hono<{ Bindings: Bindings }>()

// Setup CORS for the frontend
Expand All @@ -32,13 +28,7 @@ app.use('/trpc/*', async (c, next) => {
return await trpcServer({
router: appRouter,
createContext: async (opts) => {
return await createContext(
c.env.DB,
c.env.JWT_VERIFICATION_KEY,
opts,
c.env.IS_BUN_TIME,
c.env.DATABASE_ID
)
return await createContext(c.env.DB, c.env.JWT_VERIFICATION_KEY, opts)
},
})(c, next)
})
Expand Down
20 changes: 10 additions & 10 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
"dependencies": {
"@shopify/flash-list": "^1.6.2",
"@t4/ui": "*",
"@tamagui/animations-react-native": "1.75.5",
"@tamagui/colors": "1.75.5",
"@tamagui/font-inter": "1.75.5",
"@tamagui/lucide-icons": "1.75.5",
"@tamagui/shorthands": "1.75.5",
"@tamagui/themes": "1.75.5",
"@tanstack/react-query": "^4.35.3",
"@tamagui/animations-react-native": "1.75.9",
"@tamagui/colors": "1.75.9",
"@tamagui/font-inter": "1.75.9",
"@tamagui/lucide-icons": "1.75.9",
"@tamagui/shorthands": "1.75.9",
"@tamagui/themes": "1.75.9",
"@tanstack/react-query": "^4.36.1",
"@trpc/client": "^10.43.0",
"@trpc/next": "^10.43.0",
"@trpc/react-query": "^10.43.0",
Expand All @@ -27,10 +27,10 @@
"expo-linking": "6.0.0",
"expo-secure-store": "^12.5.0",
"react-native-mmkv": "^2.10.2",
"react-native-safe-area-context": "4.7.3",
"solito": "^4.1.2"
"react-native-safe-area-context": "4.7.4",
"solito": "^4.1.3"
},
"devDependencies": {
"@types/react": "^18.2.30"
"@types/react": "^18.2.33"
}
}
21 changes: 10 additions & 11 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,19 @@
},
"dependencies": {
"@shopify/flash-list": "^1.6.2",
"@supabase/supabase-js": "^2.38.2",
"@supabase/supabase-js": "^2.38.4",
"@t4/api": "*",
"@tamagui/animations-react-native": "1.75.5",
"@tamagui/font-inter": "1.75.5",
"@tamagui/react-native-media-driver": "1.75.5",
"@tamagui/shorthands": "1.75.5",
"@tamagui/themes": "1.75.5",
"@tamagui/toast": "1.75.5",
"@tanstack/react-table": "^8.10.0",
"@tanstack/react-virtual": "3.0.0-beta.54",
"@tamagui/animations-react-native": "1.75.9",
"@tamagui/font-inter": "1.75.9",
"@tamagui/react-native-media-driver": "1.75.9",
"@tamagui/shorthands": "1.75.9",
"@tamagui/themes": "1.75.9",
"@tamagui/toast": "1.75.9",
"@tanstack/react-virtual": "3.0.0-beta.68",
"jotai": "^2.5.0",
"tamagui": "1.75.5"
"tamagui": "1.75.9"
},
"devDependencies": {
"@tamagui/build": "1.75.5"
"@tamagui/build": "1.75.9"
}
}
36 changes: 0 additions & 36 deletions turbo.json

This file was deleted.

1 comment on commit 6fdd61c

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔ EAS production build completed

  • 🤖 Android build failed ❌
  • 🍏 IOS build failed ❌
Android QR IOS QR

Please sign in to comment.