Skip to content

Commit 7698b90

Browse files
authored
Adds analytics build secrets and guards script (#269)
1 parent ccd69d6 commit 7698b90

File tree

4 files changed

+73
-61
lines changed

4 files changed

+73
-61
lines changed

Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ COPY . .
1212
RUN pnpm install --frozen-lockfile
1313

1414
RUN --mount=type=secret,id=SD_BACKEND_URL,env=SD_BACKEND_URL \
15-
--mount=type=secret,id=SD_CLIENT_ID,env=SD_CLIENT_ID \
16-
--mount=type=secret,id=SD_AUTHORITY_URL,env=SD_AUTHORITY_URL \
17-
pnpm run build
15+
--mount=type=secret,id=SD_CLIENT_ID,env=SD_CLIENT_ID \
16+
--mount=type=secret,id=SD_AUTHORITY_URL,env=SD_AUTHORITY_URL \
17+
--mount=type=secret,id=SD_ANALYTICS_URL,env=SD_ANALYTICS_URL \
18+
--mount=type=secret,id=SD_ANALYTICS_ID,env=SD_ANALYTICS_ID \
19+
pnpm run build
1820

1921
FROM nginx:stable-alpine
2022

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@
4343
"globals": "^16.5.0",
4444
"postcss": "^8.5.6",
4545
"react-refresh": "^0.18.0",
46-
"tailwindcss": "3.4.17",
46+
"tailwindcss": "3.4.18",
4747
"tailwindcss-scoped-preflight": "^3.5.3",
4848
"typescript-eslint": "^8.46.3"
4949
},
50-
"packageManager": "pnpm@10.18.1"
50+
"packageManager": "pnpm@10.20.0"
5151
}

pnpm-lock.yaml

Lines changed: 60 additions & 51 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ dayjs.extend(utc);
1212
dayjs.extend(timezone);
1313
defineCustomElements();
1414

15-
const s = document.createElement("script");
16-
s.async = true;
17-
s.src = process.env.SD_ANALYTICS_URL || "";
18-
s.setAttribute("data-website-id", process.env.SD_ANALYTICS_ID || "");
15+
const src = process.env.SD_ANALYTICS_URL || "";
1916

20-
if (s.src) {
17+
if (src) {
18+
const s = document.createElement("script");
19+
s.async = true;
20+
s.src = src;
21+
s.setAttribute("data-website-id", process.env.SD_ANALYTICS_ID || "");
2122
document.head.appendChild(s);
2223
}
2324

0 commit comments

Comments
 (0)