Skip to content

Commit

Permalink
chore: deps (#307)
Browse files Browse the repository at this point in the history
* chore: deps

* chore: use corepack

* chore: upgrade payload

* chore: cleanup

* chore: lockfile maintenance

* fix: await header-based methods

* chore: update playwright

* chore: dockerfile warnings
  • Loading branch information
mvarendorff authored Oct 5, 2024
1 parent af03979 commit f6705e1
Show file tree
Hide file tree
Showing 23 changed files with 3,988 additions and 7,801 deletions.
4 changes: 1 addition & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
node_modules
.yarn/cache/
.yarn/build-state.yml
.yarn/install-state.gz
.yarn

packages/server/dist
15 changes: 6 additions & 9 deletions .github/actions/install-yarn/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@ description: Installs and caches yarn dependencies
runs:
using: "composite"
steps:
- name: Get yarn cache directory path
id: yarn-cache-dir-path
- name: 'Enable corepack'
shell: bash
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
run: corepack enable

- uses: actions/cache@v3
id: yarn-cache
- name: 'Setup node'
uses: actions/setup-node@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
node-version: 20.9
cache: yarn

# This step should prefer the cached dependencies and restore node_modules
- name: Install dependencies
Expand Down
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,6 @@ modules.xml
# Yarn 2
.yarn/*
!.yarn/patches
!.yarn/releases
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
.pnp.*

# Env
*.env
893 changes: 0 additions & 893 deletions .yarn/releases/yarn-4.0.2.cjs

This file was deleted.

4 changes: 0 additions & 4 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
compressionLevel: mixed

enableGlobalCache: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.0.2.cjs
2 changes: 1 addition & 1 deletion docker-compose.e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ services:
- "typesense-data:/data"

playwright:
image: mcr.microsoft.com/playwright:v1.46.1-focal
image: mcr.microsoft.com/playwright:v1.47.2-focal
entrypoint: "/bin/bash"
command: "./wait-for-it.sh -t 30 --strict server:5000 -- ./install-and-run.sh"
working_dir: /e2e
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"react-test-renderer": "18.2.0",
"ts-node": "10.9.1"
},
"packageManager": "yarn@4.0.2"
"packageManager": "yarn@4.5.0+sha512.837566d24eec14ec0f5f1411adb544e892b3454255e61fdef8fd05f3429480102806bac7446bc9daff3896b01ae4b62d00096c7e989f1596f2af10b927532f39"
}
10 changes: 5 additions & 5 deletions packages/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"name": "@yestheory.family/e2e",
"devDependencies": {
"@atmina/linting": "^2.2.0",
"@playwright/test": "^1.43.1",
"@types/eslint": "^8.56.10",
"@types/node": "^20.12.7",
"@playwright/test": "^1.47.2",
"@types/eslint": "^8.56.12",
"@types/node": "^22.7.3",
"dotenv": "^16.4.5",
"eslint": "^8.56.0",
"prettier": "^3.2.5"
"eslint": "^8.57.1",
"prettier": "^3.3.3"
},
"scripts": {
"lint": "yarn run eslint:fix && yarn run prettier:fix",
Expand Down
12 changes: 6 additions & 6 deletions packages/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
},
"devDependencies": {
"@atmina/linting": "^2.2.0",
"@types/cli-progress": "^3.11.5",
"@types/eslint": "^8.56.10",
"eslint": "^8.56.0",
"prettier": "^3.2.5",
"tsx": "^4.8.2",
"typescript": "^5.4.5"
"@types/cli-progress": "^3.11.6",
"@types/eslint": "^8.56.12",
"eslint": "^8.57.1",
"prettier": "^3.3.3",
"tsx": "^4.19.1",
"typescript": "^5.6.2"
},
"prettier": "@atmina/linting/prettier"
}
23 changes: 11 additions & 12 deletions packages/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,41 +1,40 @@
# syntax=docker/dockerfile:1.2
FROM node:20.9-alpine AS base
RUN apk add --no-cache libc6-compat && \
corepack enable

# Install dependencies only when needed
FROM node:20.9-alpine AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
FROM base AS deps
WORKDIR /app

# Copy yarn data
COPY .yarn/ ./.yarn/
COPY .yarnrc.yml ./
COPY yarn.lock package.json ./

# Copy package.jsons of all related packages
COPY packages/server/package.json ./packages/server/
COPY packages/server/prisma ./packages/server/prisma

# Install dependencies for the workspace
WORKDIR /app/packages/server
RUN yarn workspaces focus

# Rebuild the source code only when needed
FROM node:20.9-alpine AS builder
FROM base AS builder
WORKDIR /app

# Copy node_modules and other side products from deps
COPY --from=deps /app/packages/server /app/packages/server
COPY --from=deps /app/node_modules /app/node_modules

# Copy dependency information and source, then build
COPY yarn.lock .
COPY package.json .
COPY yarn.lock package.json .yarnrc.yml ./
COPY packages/server /app/packages/server
WORKDIR /app/packages/server

RUN yarn prisma generate && yarn build
RUN yarn build

# Build the actual running server
FROM node:20.9-alpine
FROM base
WORKDIR /app

RUN apk add curl --no-cache
Expand All @@ -50,8 +49,8 @@ COPY ./packages/server/docker-entrypoint.sh /app/docker-entrypoint.sh

# Set environment data, export and launch
ARG BACKEND_PORT=5000
ENV BACKEND_PORT=$BACKEND_PORT
ENV NODE_ENV="production"
ENV BACKEND_PORT $BACKEND_PORT
ENV NODE_ENV "production"

EXPOSE $BACKEND_PORT

Expand Down
38 changes: 19 additions & 19 deletions packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@
},
"dependencies": {
"@answeroverflow/discordjs-mock": "^0.0.13",
"@apollo/server": "^4.10.4",
"@apollo/server": "^4.11.0",
"@as-integrations/koa": "^1.1.1",
"@discordjs/rest": "2.2.0",
"@graphql-tools/delegate": "^10.0.7",
"@graphql-tools/executor-http": "^1.0.9",
"@graphql-tools/stitch": "^9.2.4",
"@discordjs/rest": "2.4.0",
"@graphql-tools/delegate": "^10.0.21",
"@graphql-tools/executor-http": "^1.1.6",
"@graphql-tools/stitch": "^9.2.10",
"@graphql-tools/wrap": "^10.0.5",
"@koa/cors": "^5.0.0",
"@koa/router": "12.0.1",
"@prisma/client": "5.13.0",
"discord.js": "14.14.1",
"@koa/router": "13.1.0",
"@prisma/client": "5.20.0",
"discord.js": "14.16.3",
"dotenv": "16.4.5",
"glob": "10.3.12",
"grant": "5.4.22",
"graphql": "^16.8.1",
"glob": "11.0.0",
"grant": "5.4.23",
"graphql": "^16.9.0",
"graphql-fields": "2.0.3",
"graphql-scalars": "1.23.0",
"graphql-type-json": "0.3.2",
Expand All @@ -42,31 +42,31 @@
"reflect-metadata": "0.2.2",
"type-graphql": "2.0.0-beta.3",
"typedi": "0.10.0",
"winston": "3.13.0"
"winston": "3.14.2"
},
"devDependencies": {
"@atmina/linting": "^2.2.0",
"@nestjs/class-validator": "0.13.4",
"@types/eslint": "^8.56.10",
"@types/eslint": "^8.56.12",
"@types/graphql-fields": "1.3.9",
"@types/koa": "2.15.0",
"@types/koa-bodyparser": "4.3.12",
"@types/koa-mount": "4.0.5",
"@types/koa-session": "6.4.5",
"@types/koa__cors": "5.0.0",
"@types/koa__router": "12.0.4",
"@types/node": "^20.12.7",
"@types/node": "^22.7.3",
"@types/node-cron": "3.0.11",
"@types/node-fetch": "2.6.11",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"eslint": "^8.56.0",
"prettier": "^3.2.5",
"prisma": "5.13.0",
"eslint": "^8.57.1",
"prettier": "^3.3.3",
"prisma": "5.20.0",
"ts-node": "10.9.2",
"ts-node-dev": "2.0.0",
"typegraphql-prisma": "0.27.2",
"typescript": "^5.4.5"
"typegraphql-prisma": "0.28.0",
"typescript": "^5.6.2"
},
"prettier": "@atmina/linting/prettier"
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ export class MatchingCron {

private static async explainUnfortunateCircumstances(firstMessage: Message) {
await firstMessage.delete();
if (!firstMessage.channel.isSendable()) return;

await firstMessage.channel.send(
'Right, this one is going to be disappointing... I had already matched you ' +
'but your match had their DMs disabled, so I had to rollback everything.\n\n' +
Expand Down
20 changes: 9 additions & 11 deletions packages/web/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# syntax=docker/dockerfile:1.2
FROM node:20.9-alpine AS base
RUN apk add --no-cache libc6-compat && \
corepack enable

# Install dependencies only when needed
FROM node:20.9-alpine AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
FROM base AS deps
WORKDIR /app

# Copy yarn data
COPY .yarn/ ./.yarn/
COPY .yarnrc.yml ./
COPY yarn.lock package.json ./

Expand All @@ -18,26 +17,25 @@ WORKDIR /app/packages/web
RUN yarn workspaces focus

# Rebuild the source code only when needed
FROM node:20.9-alpine AS builder
FROM base AS builder
WORKDIR /app

ARG NEXT_PUBLIC_FRONTEND_URL
ENV NEXT_PUBLIC_FRONTEND_URL=$NEXT_PUBLIC_FRONTEND_URL
ENV NEXT_PUBLIC_FRONTEND_URL $NEXT_PUBLIC_FRONTEND_URL

# Copy node_modules and other side products from deps
COPY --from=deps /app/packages/web/ ./packages/web/
COPY --from=deps /app/node_modules/ ./node_modules/

# Copy dependency information and source, then build
COPY yarn.lock .
COPY package.json .
COPY package.json yarn.lock .yarnrc.yml ./
COPY packages/web/ ./packages/web
WORKDIR /app/packages/web

RUN yarn build

# Production image, copy all the files and run next
FROM node:20.9-alpine AS runner
FROM base AS runner
WORKDIR /app

ENV NODE_ENV production
Expand All @@ -50,7 +48,7 @@ COPY --from=builder /app/packages/web/public/ ./packages/web/public/
COPY --from=builder /app/packages/web/build/ ./packages/web/build/
COPY --from=builder /app/packages/web/package.json ./packages/web/

COPY yarn.lock package.json ./
COPY yarn.lock .yarnrc.yml package.json ./

EXPOSE 3000

Expand Down
2 changes: 1 addition & 1 deletion packages/web/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
Loading

0 comments on commit f6705e1

Please sign in to comment.