Enable Typescript in sync-server (#4887)

* attempt at running with typescript

* release notes

* working jest tests for TS files

* working docker image build

* remaining docker images

* cleanup

* ensure vitest is working

* get tests passing in ci

* less strict

* update release notes

* use tsc compiled assets in the published package

* scripts

* update yarn.lock

* Use build path for electron app

* PR feedback: move sync-server build out of bin/build-browser

* PR feedback: undo moduleResolution change

* extend main tsconfig and fix types

* PR feedback on scripts and when the sync-server build runs

* fix lint (unrelated change)

---------

Co-authored-by: alecbakholdin <alecbakholdin@gmail.com>
This commit is contained in:
Roger Goldfinger
2025-05-05 20:45:49 -07:00
committed by GitHub
parent 4a7439da5e
commit 090345bd95
22 changed files with 71 additions and 64 deletions

View File

@@ -1,4 +1,4 @@
FROM node:18-bookworm as deps
FROM node:18-bookworm AS deps
# Install required packages
RUN apt-get update && apt-get install -y openssl
@@ -21,12 +21,12 @@ COPY ./bin/package-browser ./bin/package-browser
RUN yarn install
FROM deps as builder
FROM deps AS builder
WORKDIR /app
COPY packages/ ./packages/
RUN yarn build:browser
RUN yarn build:server
# Focus the workspaces in production mode (including @actual-app/web you just built)
RUN yarn workspaces focus @actual-app/sync-server --production
@@ -38,7 +38,7 @@ RUN rm -rf ./node_modules/@actual-app/web ./node_modules/@actual-app/sync-server
COPY ./packages/desktop-client/package.json ./node_modules/@actual-app/web/package.json
RUN cp -r ./packages/desktop-client/build ./node_modules/@actual-app/web/build
FROM node:18-bookworm-slim as prod
FROM node:18-bookworm-slim AS prod
# Minimal runtime dependencies
RUN apt-get update && apt-get install -y tini && apt-get clean -y && rm -rf /var/lib/apt/lists/*
@@ -56,10 +56,9 @@ ENV NODE_ENV=production
# Pull in only the necessary artifacts (built node_modules, server files, etc.)
COPY --from=builder /app/node_modules /app/node_modules
COPY --from=builder /app/packages/sync-server/package.json /app/packages/sync-server/app.js ./
COPY --from=builder /app/packages/sync-server/src ./src
COPY --from=builder /app/packages/sync-server/migrations ./migrations
COPY --from=builder /app/packages/sync-server/package.json ./
COPY --from=builder /app/packages/sync-server/build ./build
ENTRYPOINT ["/usr/bin/tini", "-g", "--"]
EXPOSE 5006
CMD ["node", "app.js"]
CMD ["node", "build/app.js"]