Skip to content

Commit 57f2489

Browse files
committed
Fix sourcemaps and analytics
1 parent 0ba576a commit 57f2489

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

Dockerfile

+4-6
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,16 @@ RUN pnpm deploy --filter=@boilerplate/prisma --prod /prod/database
2525

2626
# Extract sourcemaps for client
2727
RUN mkdir -p /sourcemaps-client
28-
RUN cp -R /prod/client/dist/assets/*.map /sourcemaps-client
28+
RUN cp -R /prod/client/dist /sourcemaps-client
2929
RUN rm /prod/client/dist/assets/*.map
30-
30+
RUN find /prod/client/dist/assets -name "index-*.js" -exec sed -i '/\/\/# sourceMappingURL=.*\.map/d' {} \;
3131
# Extract sourcemaps for server
3232
RUN mkdir -p /sourcemaps-server
33-
RUN cp -R /prod/server/dist/*.map /sourcemaps-server
34-
RUN rm /prod/server/dist/*.map
33+
RUN cp -R /prod/server/dist /sourcemaps-server
34+
3535

3636
# Production stage
3737
FROM node:20-alpine3.20 AS production
38-
#RUN apt-get update -y && apt-get install -y openssl
3938
WORKDIR /apps
4039

4140
# Copy server build
@@ -52,7 +51,6 @@ COPY --from=build /sourcemaps-client /sourcemaps-client
5251
COPY --from=build /sourcemaps-server /sourcemaps-server
5352

5453
# Set environment variables
55-
ENV PORT=3000
5654
EXPOSE 3000
5755

5856
# Set the Prisma schema path explicitly

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ This application includes a dedicated endpoint to serve the privacy policy in di
4646

4747
### Initial Setup
4848

49-
The data protection policy files live in the `server/src/assets/privacy-policy/files` directory. On startup tries to read files of supported languages. Supported languages are defined in the `prisma.schema` file in the Language enum. For example, if `Language.DE` is defined you should have a `de.md` file in the `server/src/assets/privacy-policy/files` directory. By default the application will serve the `en.md` version if the requested language could not be loaded.
49+
The data protection policy files live in the `apps/server/dist/assets/privacy-policy/files` directory. On startup tries to read files of supported languages. Supported languages are defined in the `prisma.schema` file in the Language enum. For example, if `Language.DE` is defined you should have a `de.md` file in the `server/src/assets/privacy-policy/files` directory. By default the application will serve the `en.md` version if the requested language could not be loaded.
5050

5151
### During Development
5252

53-
- Place your `.md` files in the `server/src/assets/privacy-policy/files` directory.
53+
- Place your `.md` files in the `apps/server/dist/assets/privacy-policy/files` directory.
5454
- Example: `de.md` for German, `en.md` for English.
5555
- Note: The filenames should be in lowercase and match the language codes.
5656

apps/client/src/Analytics.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const Analytics = () => {
1515
if (!config.PUBLIC_URL || !config.PLAUSIBLE_HOST_URL) return;
1616

1717
plausible.current = Plausible({
18-
domain: config.PUBLIC_URL,
18+
domain: new URL(config.PUBLIC_URL).hostname,
1919
apiHost: config.PLAUSIBLE_HOST_URL ?? undefined,
2020
trackLocalhost: true,
2121
});

apps/server/src/util/middleware/frontend.middleware.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ const staticFiles = (() => {
1010
try {
1111
return readdirSync(rootDir).map((file) => `/${file}`);
1212
} catch (error) {
13-
console.log(`Error reading static files from ${rootDir}`, error);
13+
if (process.env.NODE_ENV === 'production') {
14+
console.log(`Error reading static files from ${rootDir}`, error);
15+
}
1416
return [];
1517
}
1618
})();

0 commit comments

Comments
 (0)