Skip to content

Commit

Permalink
Use pnpm workspace features
Browse files Browse the repository at this point in the history
  • Loading branch information
aldahick committed May 25, 2024
1 parent 4fc0842 commit 5446fc4
Show file tree
Hide file tree
Showing 27 changed files with 4,020 additions and 6,691 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build-package
name: build
on:
workflow_call:
inputs:
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: publish-image
name: publish
on:
workflow_call:
inputs:
Expand Down Expand Up @@ -30,9 +30,6 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- if: ${{ inputs.directory == 'web' }}
run: npm i @athenajs/react-utils
- run: cp -r gql api/gql
- uses: docker/setup-qemu-action@v3
if: ${{ matrix.platform != 'amd64' }}
with:
Expand All @@ -57,6 +54,8 @@ jobs:
outputs: type=image,name=${{ inputs.imageName }},push-by-digest=true,name-canonical=true,push=true
push: true
labels: ${{ steps.meta.outputs.labels }}
build-args: |
WEB_DIR=web
- name: Export digest
run: |
mkdir -p /tmp/digests
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.env
*.log
api/gql
api/media
coverage
dist
Expand Down
3 changes: 0 additions & 3 deletions api/.gitignore

This file was deleted.

19 changes: 12 additions & 7 deletions api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
# Make sure to build this image using the root context, not "api" context
FROM node:20-alpine AS base

RUN npm i -g pnpm
COPY package.json pnpm-lock.yaml ./
WORKDIR /rex
RUN npm i -g pnpm@latest
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY api/package.json ./api/

FROM base AS builder

RUN pnpm install --frozen-lockfile

COPY tsconfig.json ./
COPY src src
WORKDIR /rex/api
COPY api/tsconfig.json ./
COPY api/src src
RUN pnpm build

FROM base AS server

RUN pnpm install --prod --frozen-lockfile

COPY --from=builder dist dist
COPY gql /gql
ENV GRAPHQL_SCHEMA_DIRS=/gql
WORKDIR /rex/api
COPY --from=builder /rex/api/dist dist
COPY gql gql
ENV GRAPHQL_SCHEMA_DIRS=/rex/api/gql
CMD node --enable-source-maps dist/main.js
33 changes: 33 additions & 0 deletions api/codegen.graphql.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import type { CodegenConfig } from "@graphql-codegen/cli";

const config: CodegenConfig = {
schema: "../gql/*.gql",
config: {
maybeValue: "T | undefined",
typesPrefix: "I",
scalars: {
DateTime: "Date",
},
},
hooks: {
afterAllFileWrite: "biome check --apply-unsafe",
},
generates: {
"src/graphql.ts": {
plugins: ["typescript", "typescript-operations"],
},
"src/graphql.sdk.ts": {
documents: "src/**/*.sdk.gql",
plugins: [
"typescript",
"typescript-operations",
"typescript-graphql-request",
],
config: {
noExport: true,
gqlImport: "graphql-request#gql",
},
},
},
};
export default config;
13 changes: 0 additions & 13 deletions api/codegen.graphql.yml

This file was deleted.

28 changes: 6 additions & 22 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"dev": "tsc-watch --onSuccess \"node --enable-source-maps dist/main\"",
"build": "tsc",
"lint": "biome check src",
"generate": "graphql-codegen --config codegen.graphql.yml",
"db": "tsx src/util/orchid.ts",
"generate": "graphql-codegen --config codegen.graphql.ts",
"db": "tsx src/service/database/database.migration.ts",
"test": "tsx --enable-source-maps --test src"
},
"engines": {
Expand All @@ -27,15 +27,15 @@
},
"homepage": "https://github.com/aldahick/rex#readme",
"dependencies": {
"@athenajs/core": "1.1.3",
"@athenajs/utils": "1.1.3",
"@athenajs/core": "^1.2.0",
"@google-cloud/run": "^1.2.0",
"axios": "^1.6.8",
"bcrypt": "^5.1.1",
"discord.js": "^14.15.2",
"dockerode": "^4.0.2",
"googleapis": "^137.1.0",
"graphql": "^16.8.1",
"graphql-request": "6.1.0",
"jsonwebtoken": "^9.0.2",
"mime": "^4.0.3",
"orchid-orm": "^1.27.4",
Expand All @@ -46,30 +46,14 @@
"remeda": "^1.61.0"
},
"devDependencies": {
"@biomejs/biome": "^1.7.3",
"@graphql-codegen/cli": "^5.0.2",
"@graphql-codegen/typescript": "^4.0.7",
"@graphql-codegen/typescript-operations": "^4.2.1",
"@graphql-codegen/typescript-graphql-request": "^6.2.0",
"@types/bcrypt": "^5.0.2",
"@types/dockerode": "^3.3.29",
"@types/jsonwebtoken": "^9.0.6",
"@types/node": "^20.12.12",
"@types/pg": "^8.11.6",
"@types/pluralize": "^0.0.33",
"rake-db": "^2.20.5",
"tsc-watch": "^6.2.0",
"tsx": "^4.10.5",
"typescript": "^5.4.5"
},
"pnpm": {
"overrides": {
"undici@<=5.28.2": ">=5.28.3",
"express@<4.19.2": ">=4.19.2",
"jose@>=3.0.0 <=4.15.4": ">=4.15.5",
"@babel/traverse@<7.23.2": ">=7.23.2",
"undici@<5.28.4": ">=5.28.4",
"tar@<6.2.1": ">=6.2.1",
"protobufjs@>=7.0.0 <7.2.5": ">=7.2.5"
}
"tsc-watch": "^6.2.0"
}
}
Loading

0 comments on commit 5446fc4

Please sign in to comment.