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

feat!: react-query and supplementary improvements #147

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions .changeset/moody-beds-invite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"with-next-auth": major
"frontend-only": major
"@farcaster/auth-kit": major
"@farcaster/auth-client": minor
"@farcaster/auth-relay": patch
---

Moves `auth-kit` to `react-query`, forcing users to wrap it with `QueryClientProvider` and introduces API changes within hooks and components, to provide options to queries and mutations.
49 changes: 34 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,56 +17,75 @@ jobs:
timeout-minutes: 10
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20]
pnpm-version: [8.6.2]

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
- uses: pnpm/[email protected]
with:
node-version: "20"
version: ${{ matrix.pnpm-version }}

- name: Restore cached dependencies for Node modules.
id: module-cache
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
cache: 'pnpm'
node-version: ${{ matrix.node-version }}
env:
# https://github.com/actions/setup-node/issues/772
FORCE_COLOR: 0

- name: Cache pnpm
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/node_modules
key: ${{ runner.os }}--node--${{ hashFiles('**/yarn.lock') }}
path: ~/.pnpm-store
key: ${{ runner.os }}--node--${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: pnpm-

- name: Install dependencies
run: yarn install
run: pnpm install

- name: Run build
run: yarn build
run: pnpm build

- name: Run linter
run: yarn lint:ci
run: pnpm lint:ci

test:
timeout-minutes: 10
runs-on: "ubuntu-latest"

strategy:
matrix:
node_version: [18, 20]
pnpm-version: [8.6.2]
node-version: [18, 20]

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
env:
# https://github.com/actions/setup-node/issues/772
FORCE_COLOR: 0

- name: Restore cached dependencies for Node modules.
id: module-cache
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/node_modules
key: ${{ runner.os }}--node--${{ matrix.node_version}}--${{ hashFiles('**/yarn.lock') }}
key: ${{ runner.os }}--node--${{ matrix.node-version}}--${{ hashFiles('**/pnpm-lock.yaml') }}

- name: Install dependencies
run: yarn install
run: pnpm install

- name: Run build
run: yarn build
run: pnpm build

- name: Log in to Docker Hub to avoid rate limiting
uses: docker/login-action@v2
Expand All @@ -79,7 +98,7 @@ jobs:
run: docker compose -f ./apps/relay/docker-compose.yml up --build --detach redis

- name: Run tests
run: yarn test:ci
run: pnpm test:ci

- name: Upload coverage results
uses: codecov/codecov-action@v3
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Logs
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
dalechyn marked this conversation as resolved.
Show resolved Hide resolved
pnpm-error.log*

.DS_Store
**/.DS_Store
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint-staged
pnpm lint-staged
1 change: 0 additions & 1 deletion .yarnrc

This file was deleted.

12 changes: 6 additions & 6 deletions Dockerfile.relay
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ WORKDIR /home/node/app

# Run turbo prune to create a pruned version of monorepo
COPY --chown=node:node ./package.json ./package.json
RUN yarn global add turbo@$(node -e "console.log(require('./package.json').devDependencies.turbo)")
RUN pnpm global add turbo@$(node -e "console.log(require('./package.json').devDependencies.turbo)")
dalechyn marked this conversation as resolved.
Show resolved Hide resolved
COPY --chown=node:node . .
RUN /home/node/.yarn/bin/turbo prune --scope=@farcaster/auth-relay --docker
RUN pnpm turbo prune --scope=@farcaster/auth-relay --docker

###############################################################################
############## Stage 2: Build the code using a full node image ################
Expand All @@ -41,20 +41,20 @@ ENV RUSTFLAGS="-C target-feature=-crt-static"

# Copy dependency information and install all dependencies
COPY --chown=node:node --from=prune /home/node/app/out/json/ .
COPY --chown=node:node --from=prune /home/node/app/out/yarn.lock ./yarn.lock
COPY --chown=node:node --from=prune /home/node/app/out/pnpm-lock.yaml ./pnpm-lock.yaml

RUN yarn install --frozen-lockfile --network-timeout 1800000
RUN pnpm install --frozen-lockfile --network-timeout 1800000

# Copy source code (and all other relevant files)
COPY --chown=node:node --from=prune /home/node/app/out/full/ .
# turbo prune doesn't include global tsconfig.json (https://github.com/vercel/turbo/issues/2177)
COPY --chown=node:node tsconfig.json tsconfig.json

# Build code
RUN yarn build
RUN pnpm build

# Purge dev dependencies and only install production dependencies
RUN rm -rf node_modules && yarn install --production --ignore-scripts --prefer-offline --force --frozen-lockfile
RUN rm -rf node_modules && pnpm install --production --ignore-scripts --prefer-offline --force --frozen-lockfile

###############################################################################
########## Stage 3: Copy over the built code to a leaner alpine image #########
Expand Down
4 changes: 4 additions & 0 deletions apps/relay/.env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CORS_ORIGIN="*"
REDIS_URL=redis://127.0.0.1:6379
CHANNEL_TTL=3600
AUTH_KEY=super_dev_key
1 change: 0 additions & 1 deletion apps/relay/.env.test
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
AUTH_KEY="some-shared-secret"
LOG_LEVEL="error"
1 change: 0 additions & 1 deletion apps/relay/.gitignore

This file was deleted.

2 changes: 1 addition & 1 deletion apps/relay/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @farcaster/auth-relay
# @farcaster/relay

## 0.0.10

Expand Down
6 changes: 3 additions & 3 deletions apps/relay/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `@farcaster/auth-relay`
# `@farcaster/relay`

Farcaster Auth HTTP relay server.

Expand All @@ -7,7 +7,7 @@ Farcaster Auth HTTP relay server.
Install dependencies:

```sh
yarn install
pnpm install
```

Start a Redis container:
Expand All @@ -19,7 +19,7 @@ docker compose up
Run the server:

```sh
yarn start
pnpm start
```

## About
Expand Down
21 changes: 0 additions & 21 deletions apps/relay/biome.json

This file was deleted.

12 changes: 0 additions & 12 deletions apps/relay/fastify.d.ts

This file was deleted.

45 changes: 31 additions & 14 deletions apps/relay/package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
{
"name": "@farcaster/auth-relay",
"version": "0.0.10",
"name": "@farcaster/relay",
"description": "Farcaster Auth relay server",
"private": true,
"type": "commonjs",
"version": "0.0.9",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/farcasterxyz/auth-monorepo.git",
"directory": "apps/relay"
},
"scripts": {
"build": "tsc --project ./tsconfig.json",
"lint": "biome format src/ --write && biome check src/ --apply",
"lint:ci": "biome ci src/",
"test": "yarn build && DOTENV_CONFIG_PATH=.env.test jest",
"test:ci": "yarn build && ENVIRONMENT=test NODE_OPTIONS=\"--max-old-space-size=4096\" DOTENV_CONFIG_PATH=.env.test jest --ci --forceExit --coverage",
"start": "yarn build && node build/app.js start"
"dev": "dotenv -e .env -c development tsx watch src/index.ts",
"build": "pnpm run clean && pnpm run build:esm+types",
"build:esm+types": "tsc --project tsconfig.build.json --outDir ./dist/esm --declaration --declarationMap --declarationDir ./dist/types",
"clean": "rimraf dist tsconfig.tsbuildinfo actions clients contracts errors utils",
"test": "pnpm build && dotenv -e .env -c test jest",
"typecheck": "tsc --noEmit",
"test:build": "publint --strict",
"test:ci": "pnpm build && ENVIRONMENT=test NODE_OPTIONS=\"--max-old-space-size=4096\" DOTENV_CONFIG_PATH=.env.test jest --ci --forceExit --coverage",
"start": "pnpm build && node build/app.js start"
},
"sideEffects": false,
"type": "module",
"main": "./dist/esm/exports/index.js",
"types": "./dist/types/exports/index.d.ts",
"typings": "./dist/types/exports/index.d.ts",
"engines": {
"node": ">=18"
},
Expand All @@ -24,11 +36,16 @@
"ethers": "^6.0.8",
"fastify": "^4.24.3",
"ioredis": "^5.3.2",
"neverthrow": "^6.1.0",
"siwe": "^2.1.4",
"viem": "^2.5.0"
"undici": "^6.13.0",
"viem": "^2.9.0",
"zod": "^3.22.4",
"zod-validation-error": "^3.0.3"
},
"devDependencies": {
"jest": "^29.7.0"
}
"dotenv-cli": "^7.4.1",
"jest": "^29.7.0",
"tsx": "^4.7.1"
},
"keywords": ["farcaster", "sign-in", "sign-in with farcaster", "siwe", "auth-client"]
}
Loading
Loading