Skip to content

Commit

Permalink
fix(langs): Language bundles are not included in the distributive
Browse files Browse the repository at this point in the history
Typescript does not process JSON files, so we have to copy them manually.
I will do it with docker but will iterate and write a script to build the
application properly
  • Loading branch information
n0th1ng-else committed Aug 5, 2024
1 parent 88e2ae1 commit 81ad4ff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ COPY ./video-temp $APP_DIR/video-temp
COPY ./src $APP_DIR/src

RUN pnpm run build
COPY $APP_DIR/src/text/translations/bundles $APP_DIR/dist/text/translations/bundles

FROM node:20.14-slim

Expand Down Expand Up @@ -47,7 +48,6 @@ RUN npm pkg delete scripts.prepare
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile

COPY --from=builder $APP_DIR/dist $APP_DIR/dist
COPY --from=builder $APP_DIR/src/text/translations/bundles $APP_DIR/dist/text/translations/bundles

USER node

Expand Down
5 changes: 5 additions & 0 deletions src/text/translations/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ export const initializeTranslationsForLocale = (
if (!existsSync(fullPath)) {
throw new Error(
`the translations file does not exists for "${lang}" locale`,
{
cause: {
translationFile: fullPath,
},
},
);
}
const content = readFileSync(fullPath, { encoding: "utf-8" });
Expand Down

0 comments on commit 81ad4ff

Please sign in to comment.