Update pnpm and move all prebuilt env into single file

This commit is contained in:
Mawoka
2026-06-14 17:47:52 +02:00
parent da7bf6e3fe
commit 6682edfc5a
7 changed files with 38 additions and 25 deletions
+5 -3
View File
@@ -5,7 +5,7 @@
### Build Step ### Build Step
# pull the Node.js Docker image # pull the Node.js Docker image
FROM node:24-trixie AS builder FROM node:24-trixie AS builder
# ENV API_URL=http://api:80 ENV CI=true
ENV API_URL=https://mawoka.eu ENV API_URL=https://mawoka.eu
#Ah, I've noticed that!!! #Ah, I've noticed that!!!
ENV REDIS_URL=redis://localhost:6379 ENV REDIS_URL=redis://localhost:6379
@@ -25,9 +25,10 @@ WORKDIR /usr/src/app
# copy the package.json files from local machine to the workdir in container # copy the package.json files from local machine to the workdir in container
COPY package*.json ./ COPY package*.json ./
COPY pnpm-lock.yaml ./ COPY pnpm-lock.yaml ./
COPY pnpm-workspace.yaml ./
# run npm install in our local machine # run npm install in our local machine
RUN corepack enable && corepack prepare pnpm@10.14.0 --activate && pnpm i RUN corepack enable && corepack prepare pnpm@11.6 --activate && pnpm ci --ignore-scripts
# copy the generated modules and all other files to the container # copy the generated modules and all other files to the container
COPY . . COPY . .
@@ -38,12 +39,13 @@ RUN pnpm run build
### Serve Step ### Serve Step
# pull the Node.js Docker image # pull the Node.js Docker image
FROM node:24-trixie-slim FROM node:24-trixie-slim
ENV CI=true
# change working directory # change working directory
WORKDIR /app WORKDIR /app
COPY --from=builder /usr/src/app/package.json . COPY --from=builder /usr/src/app/package.json .
COPY --from=builder /usr/src/app/pnpm-lock.yaml . COPY --from=builder /usr/src/app/pnpm-lock.yaml .
RUN corepack enable && corepack prepare pnpm@10.14.0 --activate && pnpm i RUN corepack enable && corepack prepare pnpm@11.6 --activate && pnpm ci --ignore-scripts
# copy files from previous step # copy files from previous step
COPY --from=builder /usr/src/app/build . COPY --from=builder /usr/src/app/build .
COPY --from=builder /usr/src/app/node_modules ./node_modules COPY --from=builder /usr/src/app/node_modules ./node_modules
+6
View File
@@ -1,5 +1,11 @@
# SPDX-FileCopyrightText: 2023 Marlon W (Mawoka) # SPDX-FileCopyrightText: 2023 Marlon W (Mawoka)
# #
# SPDX-License-Identifier: MPL-2.0 # SPDX-License-Identifier: MPL-2.0
allowBuilds:
esbuild: true
svelte-preprocess: true
'@parcel/watcher': true
onlyBuiltDependencies: onlyBuiltDependencies:
- svelte-preprocess - svelte-preprocess
+9 -3
View File
@@ -2,7 +2,13 @@
// //
// SPDX-License-Identifier: MPL-2.0 // SPDX-License-Identifier: MPL-2.0
export const google_auth_enabled = import.meta.env.VITE_GOOGLE_AUTH_ENABLED === 'true'; // the old prefix: import.meta.env.VITE_
export const github_auth_enabled = import.meta.env.VITE_GITHUB_AUTH_ENABLED === 'true'; export const google_auth_enabled = import.meta.env.VITE_GOOGLE_AUTH_ENABLED;
export const captcha_enabled = import.meta.env.VITE_CAPTCHA_ENABLED === 'true'; export const github_auth_enabled = import.meta.env.VITE_GITHUB_AUTH_ENABLED;
export const captcha_enabled = import.meta.env.VITE_CAPTCHA_ENABLED;
export const custom_oauth_name = import.meta.env.VITE_CUSTOM_OAUTH_NAME; export const custom_oauth_name = import.meta.env.VITE_CUSTOM_OAUTH_NAME;
export const registration_disabled = import.meta.env.VITE_REGISTRATION_DISABLED;
export const hcaptcha_site_key = import.meta.env.VITE_HCAPTCHA;
export const sentry_dsn = import.meta.env.VITE_SENTRY;
export const recaptcha_key = import.meta.env.VITE_RECAPTCHA;
export const plausible_data_url = import.meta.env.VITE_PLAUSIBLE_DATA_URL;
+3 -2
View File
@@ -13,6 +13,7 @@ SPDX-License-Identifier: MPL-2.0
import { browser } from '$app/environment'; import { browser } from '$app/environment';
import { beforeNavigate } from '$app/navigation'; import { beforeNavigate } from '$app/navigation';
import { draw, slide } from 'svelte/transition'; import { draw, slide } from 'svelte/transition';
import { registration_disabled } from './config';
const tippy = createTippy({ const tippy = createTippy({
arrow: true, arrow: true,
@@ -93,7 +94,7 @@ SPDX-License-Identifier: MPL-2.0
{#if $signedIn} {#if $signedIn}
<a class="btn-nav" href="/api/v1/users/logout">{$t('words.logout')}</a> <a class="btn-nav" href="/api/v1/users/logout">{$t('words.logout')}</a>
{:else} {:else}
{#if !import.meta.env.VITE_REGISTRATION_DISABLED} {#if registration_disabled}
<a class="btn-nav" href="/account/register">{$t('words.register')}</a> <a class="btn-nav" href="/account/register">{$t('words.register')}</a>
{/if} {/if}
@@ -322,7 +323,7 @@ SPDX-License-Identifier: MPL-2.0
{#if $signedIn} {#if $signedIn}
<a class="btn-nav" href="/api/v1/users/logout">{$t('words.logout')}</a> <a class="btn-nav" href="/api/v1/users/logout">{$t('words.logout')}</a>
{:else} {:else}
{#if !import.meta.env.VITE_REGISTRATION_DISABLED} {#if registration_disabled}
<a class="btn-nav" href="/account/register">{$t('words.register')}</a> <a class="btn-nav" href="/account/register">{$t('words.register')}</a>
{/if} {/if}
+13 -16
View File
@@ -12,6 +12,7 @@ SPDX-License-Identifier: MPL-2.0
import { getLocalization } from '$lib/i18n'; import { getLocalization } from '$lib/i18n';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
import BrownButton from '$lib/components/buttons/brown.svelte'; import BrownButton from '$lib/components/buttons/brown.svelte';
import { hcaptcha_site_key, recaptcha_key, sentry_dsn } from '$lib/config';
const { t } = getLocalization(); const { t } = getLocalization();
@@ -30,7 +31,7 @@ SPDX-License-Identifier: MPL-2.0
let custom_field_value = $state(); let custom_field_value = $state();
let captcha_enabled = $state(); let captcha_enabled = $state();
let hcaptchaSitekey = import.meta.env.VITE_HCAPTCHA; let hcaptchaSitekey = hcaptcha_site_key;
let hcaptcha = { let hcaptcha = {
execute: async (_a, _b) => ({ response: '' }), // eslint-disable-line @typescript-eslint/no-unused-vars execute: async (_a, _b) => ({ response: '' }), // eslint-disable-line @typescript-eslint/no-unused-vars
@@ -143,7 +144,7 @@ SPDX-License-Identifier: MPL-2.0
custom_field: custom_field ? custom_field_value : undefined custom_field: custom_field ? custom_field_value : undefined
}); });
} catch (e) { } catch (e) {
if (import.meta.env.VITE_SENTRY !== null) { if (sentry_dsn !== null) {
Sentry.captureException(e); Sentry.captureException(e);
} }
/* alertModal.set({ /* alertModal.set({
@@ -154,20 +155,18 @@ SPDX-License-Identifier: MPL-2.0
alert('Captcha failed!'); alert('Captcha failed!');
window.location.reload(); window.location.reload();
} }
} else if (import.meta.env.VITE_RECAPTCHA) { } else if (recaptcha_key) {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
grecaptcha.ready(() => { grecaptcha.ready(() => {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
grecaptcha grecaptcha.execute(recaptcha_key, { action: 'submit' }).then(function (token) {
.execute(import.meta.env.VITE_RECAPTCHA, { action: 'submit' }) socket.emit('join_game', {
.then(function (token) { username: username,
socket.emit('join_game', { game_pin: game_pin,
username: username, captcha: token,
game_pin: game_pin, custom_field: custom_field ? custom_field_value : undefined
captcha: token,
custom_field: custom_field ? custom_field_value : undefined
});
}); });
});
}); });
} }
} else { } else {
@@ -198,10 +197,8 @@ SPDX-License-Identifier: MPL-2.0
{#if captcha_enabled && hcaptchaSitekey} {#if captcha_enabled && hcaptchaSitekey}
<script src="https://js.hcaptcha.com/1/api.js" async defer></script> <script src="https://js.hcaptcha.com/1/api.js" async defer></script>
{/if} {/if}
{#if import.meta.env.VITE_RECAPTCHA && captcha_enabled} {#if recaptcha_key && captcha_enabled}
<script <script src="https://www.google.com/recaptcha/api.js?render={recaptcha_key}"></script>
src="https://www.google.com/recaptcha/api.js?render={import.meta.env.VITE_RECAPTCHA}"
></script>
{/if} {/if}
</svelte:head> </svelte:head>
+1 -1
View File
@@ -13,12 +13,12 @@ SPDX-License-Identifier: MPL-2.0
import { initLocalizationContext } from '$lib/i18n'; import { initLocalizationContext } from '$lib/i18n';
import { browser } from '$app/environment'; import { browser } from '$app/environment';
import CommandPalette from '$lib/components/commandpalette.svelte'; import CommandPalette from '$lib/components/commandpalette.svelte';
import { plausible_data_url } from '$lib/config';
interface Props { interface Props {
children?: import('svelte').Snippet; children?: import('svelte').Snippet;
} }
let { children }: Props = $props(); let { children }: Props = $props();
const plausible_data_url = import.meta.env.VITE_PLAUSIBLE_DATA_URL;
if (browser) { if (browser) {
pathname.set(window.location.pathname); pathname.set(window.location.pathname);
@@ -6,6 +6,7 @@ SPDX-License-Identifier: MPL-2.0
<script lang="ts"> <script lang="ts">
import { github_auth_enabled, google_auth_enabled, custom_oauth_name } from '$lib/config'; import { github_auth_enabled, google_auth_enabled, custom_oauth_name } from '$lib/config';
console.log(github_auth_enabled);
</script> </script>
{#if google_auth_enabled} {#if google_auth_enabled}