Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expo 52 #1248

Closed
wants to merge 13 commits into from
Closed

Expo 52 #1248

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/expo/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nativewind-env.d.ts
30 changes: 22 additions & 8 deletions apps/expo/app.config.ts
Original file line number Diff line number Diff line change
@@ -7,25 +7,25 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
scheme: "expo",
version: "0.1.0",
orientation: "portrait",
icon: "./assets/icon.png",
icon: "./assets/icon-light.png",
userInterfaceStyle: "automatic",
splash: {
image: "./assets/icon.png",
resizeMode: "contain",
backgroundColor: "#1F104A",
},
updates: {
fallbackToCacheTimeout: 0,
},
assetBundlePatterns: ["**/*"],
ios: {
bundleIdentifier: "your.bundle.identifier",
supportsTablet: true,
icon: {
light: "./assets/icon-light.png",
dark: "./assets/icon-dark.png",
// tinted: "",
},
},
android: {
package: "your.bundle.identifier",
adaptiveIcon: {
foregroundImage: "./assets/icon.png",
foregroundImage: "./assets/icon-light.png",
backgroundColor: "#1F104A",
},
},
@@ -38,5 +38,19 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
tsconfigPaths: true,
typedRoutes: true,
},
plugins: ["expo-router"],
plugins: [
"expo-router",
"expo-secure-store",
[
"expo-splash-screen",
{
backgroundColor: "#E4E4E7",
image: "./assets/icon-light.png",
dark: {
backgroundColor: "#18181B",
image: "./assets/icon-dark.png",
},
},
],
],
});
Binary file added apps/expo/assets/icon-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/expo/assets/icon-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed apps/expo/assets/icon.png
Binary file not shown.
5 changes: 3 additions & 2 deletions apps/expo/eas.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"cli": {
"version": ">= 4.1.2"
"version": ">= 4.1.2",
"appVersionSource": "remote"
},
"build": {
"base": {
"node": "20.16.0",
"pnpm": "9.7.0",
"pnpm": "9.14.2",
"ios": {
"resourceClass": "m-medium"
}
36 changes: 5 additions & 31 deletions apps/expo/metro.config.js
Original file line number Diff line number Diff line change
@@ -3,15 +3,13 @@ const { getDefaultConfig } = require("expo/metro-config");
const { FileStore } = require("metro-cache");
const { withNativeWind } = require("nativewind/metro");

const path = require("path");
const path = require("node:path");

const config = withTurborepoManagedCache(
withMonorepoPaths(
withNativeWind(getDefaultConfig(__dirname), {
input: "./src/styles.css",
configPath: "./tailwind.config.ts",
}),
),
withNativeWind(getDefaultConfig(__dirname), {
input: "./src/styles.css",
configPath: "./tailwind.config.ts",
}),
);

// XXX: Resolve our exports in workspace packages
@@ -20,30 +18,6 @@ config.resolver.unstable_enablePackageExports = true;

module.exports = config;

/**
* Add the monorepo paths to the Metro config.
* This allows Metro to resolve modules from the monorepo.
*
* @see https://docs.expo.dev/guides/monorepos/#modify-the-metro-config
* @param {import('expo/metro-config').MetroConfig} config
* @returns {import('expo/metro-config').MetroConfig}
*/
function withMonorepoPaths(config) {
const projectRoot = __dirname;
const workspaceRoot = path.resolve(projectRoot, "../..");

// #1 - Watch all files in the monorepo
config.watchFolders = [workspaceRoot];

// #2 - Resolve modules within the project's `node_modules` first, then all monorepo modules
config.resolver.nodeModulesPaths = [
path.resolve(projectRoot, "node_modules"),
path.resolve(workspaceRoot, "node_modules"),
];

return config;
}

/**
* Move the Metro cache to the `.cache/metro` folder.
* If you have any environment variables, you can configure Turborepo to invalidate it when needed.
3 changes: 3 additions & 0 deletions apps/expo/nativewind-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/// <reference types="nativewind/types" />

// NOTE: This file should not be edited and should be committed with your source code. It is generated by NativeWind.
39 changes: 19 additions & 20 deletions apps/expo/package.json
Original file line number Diff line number Diff line change
@@ -10,36 +10,35 @@
"dev:ios": "expo start --ios",
"android": "expo run:android",
"ios": "expo run:ios",
"format": "prettier --check . --ignore-path ../../.gitignore",
"format": "prettier --check . --ignore-path ../../.gitignore --ignore-path .prettierignore",
"lint": "eslint",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@bacons/text-decoder": "^0.0.0",
"@expo/metro-config": "^0.18.11",
"@shopify/flash-list": "1.7.1",
"@expo/metro-config": "^0.19.9",
"@shopify/flash-list": "1.7.2",
"@tanstack/react-query": "catalog:",
"@trpc/client": "catalog:",
"@trpc/react-query": "catalog:",
"@trpc/server": "catalog:",
"expo": "~51.0.38",
"expo-constants": "~16.0.2",
"expo-dev-client": "~4.0.28",
"expo-linking": "~6.3.1",
"expo-router": "~3.5.23",
"expo-secure-store": "^13.0.2",
"expo-splash-screen": "~0.27.6",
"expo-status-bar": "~1.12.1",
"expo-web-browser": "^13.0.3",
"nativewind": "~4.0.36",
"expo": "~52.0.27",
"expo-constants": "~17.0.4",
"expo-dev-client": "~5.0.10",
"expo-linking": "~7.0.4",
"expo-router": "~4.0.17",
"expo-secure-store": "^14.0.1",
"expo-splash-screen": "~0.29.21",
"expo-status-bar": "~2.0.1",
"expo-web-browser": "^14.0.2",
"nativewind": "~4.1.23",
"react": "catalog:react18",
"react-dom": "catalog:react18",
"react-native": "~0.74.6",
"react-native-css-interop": "~0.0.36",
"react-native-gesture-handler": "~2.20.0",
"react-native-reanimated": "~3.15.5",
"react-native-safe-area-context": "~4.11.1",
"react-native-screens": "~3.34.0",
"react-native": "0.78.0-rc.1",
"react-native-css-interop": "~0.1.22",
"react-native-gesture-handler": "~2.22.1",
"react-native-reanimated": "~3.16.7",
"react-native-safe-area-context": "~5.2.0-beta.0",
"react-native-screens": "~4.5.0",
"superjson": "2.2.1"
},
"devDependencies": {
2 changes: 0 additions & 2 deletions apps/expo/src/app/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import "@bacons/text-decoder/install";

import { Stack } from "expo-router";
import { StatusBar } from "expo-status-bar";
import { useColorScheme } from "nativewind";
1 change: 0 additions & 1 deletion apps/expo/src/types/nativewind-env.d.ts

This file was deleted.

4 changes: 2 additions & 2 deletions apps/expo/src/utils/auth.ts
Original file line number Diff line number Diff line change
@@ -25,8 +25,8 @@ export const signIn = async () => {
};

export const useUser = () => {
const { data: session } = api.auth.getSession.useQuery();
return session?.user ?? null;
const { data: user } = api.auth.getSession.useQuery();
return user;
};

export const useSignIn = () => {
10 changes: 8 additions & 2 deletions apps/expo/tsconfig.json
Original file line number Diff line number Diff line change
@@ -6,10 +6,16 @@
"~/*": ["./src/*"]
},
"jsx": "react-native",
"types": ["nativewind/types"],
"checkJs": false,
"moduleSuffixes": [".ios", ".android", ".native", ""]
},
"include": ["src", "*.ts", "*.js", ".expo/types/**/*.ts", "expo-env.d.ts"],
"include": [
"src",
"*.ts",
"*.js",
".expo/types/**/*.ts",
"expo-env.d.ts",
"nativewind-env.d.ts"
],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion apps/nextjs/package.json
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@
"@trpc/react-query": "catalog:",
"@trpc/server": "catalog:",
"geist": "^1.3.1",
"next": "^14.2.15",
"next": "^15.1.6",
"react": "catalog:react18",
"react-dom": "catalog:react18",
"superjson": "2.2.1",
7 changes: 4 additions & 3 deletions apps/nextjs/src/app/api/auth/[...nextauth]/route.ts
Original file line number Diff line number Diff line change
@@ -35,15 +35,16 @@ export const GET = async (
) => {
// First step must be to correct the request URL.
const req = rewriteRequestUrlInDevelopment(_req);
const jar = await cookies();

const nextauthAction = props.params.nextauth[0];
const isExpoSignIn = req.nextUrl.searchParams.get("expo-redirect");
const isExpoCallback = cookies().get(EXPO_COOKIE_NAME);
const isExpoCallback = jar.get(EXPO_COOKIE_NAME);

if (nextauthAction === "signin" && !!isExpoSignIn) {
// set a cookie we can read in the callback
// to know to send the user back to expo
cookies().set({
jar.set({
name: EXPO_COOKIE_NAME,
value: isExpoSignIn,
maxAge: 60 * 10, // 10 min
@@ -52,7 +53,7 @@ export const GET = async (
}

if (nextauthAction === "callback" && !!isExpoCallback) {
cookies().delete(EXPO_COOKIE_NAME);
jar.delete(EXPO_COOKIE_NAME);

// Run original handler, then extract the session token from the response
// Send it back via a query param in the Expo deep link. The Expo app
2 changes: 1 addition & 1 deletion apps/nextjs/src/trpc/server.ts
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ import { createQueryClient } from "./query-client";
* handling a tRPC call from a React Server Component.
*/
const createContext = cache(async () => {
const heads = new Headers(headers());
const heads = new Headers(await headers());
heads.set("x-trpc-source", "rsc");

return createTRPCContext({
9 changes: 8 additions & 1 deletion packages/api/src/router/auth.ts
Original file line number Diff line number Diff line change
@@ -6,7 +6,14 @@ import { protectedProcedure, publicProcedure } from "../trpc";

export const authRouter = {
getSession: publicProcedure.query(({ ctx }) => {
return ctx.session;
const user = ctx.session?.user;
if (!user) return null;

return {
id: user.id,
name: user.name ?? null,
image: user.image ?? null,
};
}),
getSecretMessage: protectedProcedure.query(() => {
return "you can see this secret message!";
12 changes: 7 additions & 5 deletions packages/api/src/router/post.ts
Original file line number Diff line number Diff line change
@@ -30,11 +30,13 @@ export const postRouter = {

create: protectedProcedure
.input(CreatePostSchema)
.mutation(({ ctx, input }) => {
return ctx.db.insert(Post).values(input);
.mutation(async ({ ctx, input }) => {
await ctx.db.insert(Post).values(input);
}),

delete: protectedProcedure.input(z.string()).mutation(({ ctx, input }) => {
return ctx.db.delete(Post).where(eq(Post.id, input));
}),
delete: protectedProcedure
.input(z.string())
.mutation(async ({ ctx, input }) => {
await ctx.db.delete(Post).where(eq(Post.id, input));
}),
} satisfies TRPCRouterRecord;
3 changes: 2 additions & 1 deletion packages/auth/package.json
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@
"@auth/core": "0.37.2",
"@auth/drizzle-adapter": "1.7.4",
"@t3-oss/env-nextjs": "^0.11.1",
"next": "^14.2.15",
"next": "^15.1.6",
"next-auth": "5.0.0-beta.25",
"react": "catalog:react18",
"react-dom": "catalog:react18",
@@ -32,6 +32,7 @@
"@acme/eslint-config": "workspace:*",
"@acme/prettier-config": "workspace:*",
"@acme/tsconfig": "workspace:*",
"@types/react": "catalog:react18",
"eslint": "catalog:",
"prettier": "catalog:",
"typescript": "catalog:"
1 change: 1 addition & 0 deletions packages/auth/src/index.rsc.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// <reference types="react/canary" />
import { cache } from "react";
import NextAuth from "next-auth";

4 changes: 1 addition & 3 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -28,12 +28,10 @@
},
"dependencies": {
"@hookform/resolvers": "^3.9.1",
"@radix-ui/react-dropdown-menu": "^2.1.2",
"@radix-ui/react-icons": "^1.3.2",
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-slot": "^1.1.0",
"class-variance-authority": "^0.7.0",
"next-themes": "^0.4.3",
"radix-ui": "^1.1.2",
"react-hook-form": "^7.53.2",
"sonner": "^1.7.0",
"tailwind-merge": "^2.5.4"
4 changes: 2 additions & 2 deletions packages/ui/src/button.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { VariantProps } from "class-variance-authority";
import * as React from "react";
import { Slot } from "@radix-ui/react-slot";
import { Slot } from "radix-ui";
import { cva } from "class-variance-authority";

import { cn } from "@acme/ui";
@@ -43,7 +43,7 @@ interface ButtonProps

const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button";
const Comp = asChild ? Slot.Slot : "button";
return (
<Comp
className={cn(buttonVariants({ variant, size, className }))}
2 changes: 1 addition & 1 deletion packages/ui/src/dropdown-menu.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"use client";

import * as React from "react";
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
import {
CheckIcon,
ChevronRightIcon,
DotFilledIcon,
} from "@radix-ui/react-icons";
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";

import { cn } from "@acme/ui";

10 changes: 5 additions & 5 deletions packages/ui/src/form.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import type * as LabelPrimitive from "@radix-ui/react-label";
import type { Label as LabelPrimitive } from "radix-ui";
import type {
ControllerProps,
FieldPath,
@@ -10,7 +10,7 @@ import type {
import type { ZodType, ZodTypeDef } from "zod";
import * as React from "react";
import { zodResolver } from "@hookform/resolvers/zod";
import { Slot } from "@radix-ui/react-slot";
import { Slot } from "radix-ui";
import {
useForm as __useForm,
Controller,
@@ -127,14 +127,14 @@ const FormLabel = React.forwardRef<
FormLabel.displayName = "FormLabel";

const FormControl = React.forwardRef<
React.ElementRef<typeof Slot>,
React.ComponentPropsWithoutRef<typeof Slot>
React.ElementRef<typeof Slot.Slot>,
React.ComponentPropsWithoutRef<typeof Slot.Slot>
>(({ ...props }, ref) => {
const { error, formItemId, formDescriptionId, formMessageId } =
useFormField();

return (
<Slot
<Slot.Slot
ref={ref}
id={formItemId}
aria-describedby={
2 changes: 1 addition & 1 deletion packages/ui/src/label.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { VariantProps } from "class-variance-authority";
import * as React from "react";
import * as LabelPrimitive from "@radix-ui/react-label";
import { cva } from "class-variance-authority";
import { Label as LabelPrimitive } from "radix-ui";

import { cn } from "@acme/ui";

5,525 changes: 3,151 additions & 2,374 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ catalog:

catalogs:
react18:
react: 18.3.1
react-dom: 18.3.1
"@types/react": ^18.3.11
"@types/react-dom": ^18.3.1
react: 19.0.0
react-dom: 19.0.0
"@types/react": ^19.0.0
"@types/react-dom": ^19.0.0
3 changes: 2 additions & 1 deletion tooling/eslint/package.json
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
},
"dependencies": {
"@eslint/compat": "^1.2.3",
"@next/eslint-plugin-next": "^14.2.15",
"@next/eslint-plugin-next": "^15.1.6",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-react": "^7.37.2",
@@ -27,6 +27,7 @@
"@acme/prettier-config": "workspace:*",
"@acme/tsconfig": "workspace:*",
"@types/eslint__js": "8.42.3",
"@types/node": "^20.17.7",
"eslint": "catalog:",
"prettier": "catalog:",
"typescript": "catalog:"
2 changes: 1 addition & 1 deletion tooling/prettier/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fileURLToPath } from "url";
import { fileURLToPath } from "node:url";

/** @typedef {import("prettier").Config} PrettierConfig */
/** @typedef {import("prettier-plugin-tailwindcss").PluginOptions} TailwindConfig */
1 change: 1 addition & 0 deletions tooling/prettier/package.json
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@
},
"devDependencies": {
"@acme/tsconfig": "workspace:*",
"@types/node": "^20.17.7",
"typescript": "catalog:"
},
"prettier": "@acme/prettier-config"
1 change: 1 addition & 0 deletions tooling/tailwind/package.json
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
"@acme/eslint-config": "workspace:*",
"@acme/prettier-config": "workspace:*",
"@acme/tsconfig": "workspace:*",
"@types/node": "^20.17.7",
"eslint": "catalog:",
"prettier": "catalog:",
"typescript": "catalog:"