Skip to content

Commit

Permalink
Rewrite frontend in Remix / Bootstrap (#2)
Browse files Browse the repository at this point in the history
* Refactor Mutation.createAuthToken* into Query.authToken

* Rewrite frontend in Remix

* Update Dockerfiles

* Update workflows

* Update docs and root scripts

* Build sdk in tests workflow

* Update GoogleAuthService test

* 1.0.0

* Change Config.mediaDataLimit to Float

* 1.0.1
  • Loading branch information
aldahick authored Jul 1, 2024
1 parent 9e7f1c2 commit 45b8b32
Show file tree
Hide file tree
Showing 183 changed files with 6,189 additions and 7,229 deletions.
1 change: 0 additions & 1 deletion .github/workflows/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,4 @@ jobs:
uses: ./.github/workflows/publish.yml
with:
directory: api
dockerfile: api/Dockerfile
imageName: ghcr.io/aldahick/rex-api
6 changes: 2 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ name: Publish
on:
workflow_call:
inputs:
dockerfile:
required: true
type: string
directory:
required: true
type: string
Expand All @@ -31,6 +28,7 @@ jobs:
with:
node-version-file: .nvmrc
- run: npm i --no-save @athenajs/react-utils
if: ${{ inputs.directory == 'web' }}
- uses: docker/setup-qemu-action@v3
if: ${{ matrix.platform != 'amd64' }}
with:
Expand All @@ -49,7 +47,7 @@ jobs:
id: build
uses: docker/build-push-action@v5
with:
file: ${{ inputs.dockerfile }}
file: ${{ inputs.directory }}/Dockerfile
context: .
platforms: linux/${{ matrix.platform }}
outputs: type=image,name=${{ inputs.imageName }},push-by-digest=true,name-canonical=true,push=true
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ jobs:
version: 9
- run: pnpm install
working-directory: ${{ inputs.directory }}
- run: pnpm build
- name: Build sdk
run: pnpm build
working-directory: sdk
- name: Build ${{ inputs.directory }}
run: pnpm build
working-directory: ${{ inputs.directory }}
- run: pnpm lint
working-directory: ${{ inputs.directory }}
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,4 @@ jobs:
uses: ./.github/workflows/publish.yml
with:
directory: web
dockerfile: node_modules/@athenajs/react-utils/Dockerfile
imageName: ghcr.io/aldahick/rex-web
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.cache
.env
*.log
api/media
build
coverage
dist
google-cloud-credentials.json
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ See the README files in [`api`](./api/README.md) and [`web`](./web/README.md) fo

### Changing GraphQL schema

To generate new TypeScript types based on changes to the [GraphQL schema](./gql/), do `pnpm generate`. You can run this in either package directory, or the root (which runs it for both `api` and `web`).
To generate new TypeScript types based on changes to the [GraphQL schema](./gql/), do `pnpm generate` in `./sdk`.

## Deployment

Expand Down
14 changes: 11 additions & 3 deletions api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@ FROM node:20-alpine AS base
WORKDIR /rex
RUN npm i -g pnpm@latest
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY sdk/package.json ./sdk/
COPY api/package.json ./api/

FROM base AS builder

RUN pnpm install --frozen-lockfile

WORKDIR /rex/sdk
COPY sdk/tsconfig.json ./
COPY sdk/src src
RUN pnpm build:ci

WORKDIR /rex/api
COPY api/tsconfig.json ./
COPY api/src src
Expand All @@ -19,8 +25,10 @@ FROM base AS server

RUN pnpm install --prod --frozen-lockfile

WORKDIR /rex/api
COPY --from=builder /rex/api/dist dist
COPY --from=builder /rex/sdk/dist sdk/dist
COPY --from=builder /rex/api/dist api/dist
COPY gql gql
ENV GRAPHQL_SCHEMA_DIRS=/rex/api/gql
ENV GRAPHQL_SCHEMA_DIRS=/rex/gql

WORKDIR /rex/api
CMD node --enable-source-maps dist/main.js
5 changes: 3 additions & 2 deletions api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aldahick/rex-api",
"version": "0.5.0",
"version": "1.0.1",
"description": "Personal API server",
"main": "dist/main.js",
"type": "module",
Expand All @@ -27,7 +27,8 @@
},
"homepage": "https://github.com/aldahick/rex#readme",
"dependencies": {
"@athenajs/core": "^1.2.2",
"@aldahick/rex-sdk": "workspace:*",
"@athenajs/core": "^1.2.3",
"@google-cloud/run": "^1.3.0",
"axios": "^1.7.2",
"bcrypt": "^5.1.1",
Expand Down
22 changes: 2 additions & 20 deletions api/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,9 @@ export class RexConfig extends BaseConfig {
readonly graphqlSchemaDirs = this.required("GRAPHQL_SCHEMA_DIRS").split(",");

readonly google = {
cloud: {
projectId: this.optional("GOOGLE_CLOUD_PROJECT_ID"),
credentialsPath: this.optional("GOOGLE_CLOUD_CREDENTIALS_PATH"),
},
oauth: {
mobile: {
clientId: this.optional("GOOGLE_CLIENT_ID_MOBILE"),
clientSecret: this.optional("GOOGLE_CLIENT_SECRET_MOBILE"),
},
web: {
clientId: this.optional("GOOGLE_CLIENT_ID_WEB"),
clientSecret: this.optional("GOOGLE_CLIENT_SECRET_WEB"),
},
clientId: this.optional("GOOGLE_CLIENT_ID"),
clientSecret: this.optional("GOOGLE_CLIENT_SECRET"),
},
};

Expand All @@ -49,14 +39,6 @@ export class RexConfig extends BaseConfig {
this.optional("MEDIA_SHAREX_URL") ?? `${this.http.url}/v1/sharex`,
};

readonly mzk = {
runner: {
dir: this.optional("MZK_RUNNER_DIR"),
image: this.optional("MZK_RUNNER_IMAGE"),
platform: this.required("MZK_RUNNER_PLATFORM"),
},
};

readonly postgresUrl = this.required("POSTGRES_URL");

readonly redisUrl = this.required("REDIS_URL");
Expand Down
Loading

0 comments on commit 45b8b32

Please sign in to comment.