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
# pull the Node.js Docker image
FROM node:24-trixie AS builder
# ENV API_URL=http://api:80
ENV CI=true
ENV API_URL=https://mawoka.eu
#Ah, I've noticed that!!!
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 package*.json ./
COPY pnpm-lock.yaml ./
COPY pnpm-workspace.yaml ./
# 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 . .
@@ -38,12 +39,13 @@ RUN pnpm run build
### Serve Step
# pull the Node.js Docker image
FROM node:24-trixie-slim
ENV CI=true
# change working directory
WORKDIR /app
COPY --from=builder /usr/src/app/package.json .
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 --from=builder /usr/src/app/build .
COPY --from=builder /usr/src/app/node_modules ./node_modules
+6
View File
@@ -1,5 +1,11 @@
# SPDX-FileCopyrightText: 2023 Marlon W (Mawoka)
#
# SPDX-License-Identifier: MPL-2.0
allowBuilds:
esbuild: true
svelte-preprocess: true
'@parcel/watcher': true
onlyBuiltDependencies:
- svelte-preprocess
+9 -3
View File
@@ -2,7 +2,13 @@
//
// SPDX-License-Identifier: MPL-2.0
export const google_auth_enabled = import.meta.env.VITE_GOOGLE_AUTH_ENABLED === 'true';
export const github_auth_enabled = import.meta.env.VITE_GITHUB_AUTH_ENABLED === 'true';
export const captcha_enabled = import.meta.env.VITE_CAPTCHA_ENABLED === 'true';
// the old prefix: import.meta.env.VITE_
export const google_auth_enabled = import.meta.env.VITE_GOOGLE_AUTH_ENABLED;
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 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 { beforeNavigate } from '$app/navigation';
import { draw, slide } from 'svelte/transition';
import { registration_disabled } from './config';
const tippy = createTippy({
arrow: true,
@@ -93,7 +94,7 @@ SPDX-License-Identifier: MPL-2.0
{#if $signedIn}
<a class="btn-nav" href="/api/v1/users/logout">{$t('words.logout')}</a>
{:else}
{#if !import.meta.env.VITE_REGISTRATION_DISABLED}
{#if registration_disabled}
<a class="btn-nav" href="/account/register">{$t('words.register')}</a>
{/if}
@@ -322,7 +323,7 @@ SPDX-License-Identifier: MPL-2.0
{#if $signedIn}
<a class="btn-nav" href="/api/v1/users/logout">{$t('words.logout')}</a>
{:else}
{#if !import.meta.env.VITE_REGISTRATION_DISABLED}
{#if registration_disabled}
<a class="btn-nav" href="/account/register">{$t('words.register')}</a>
{/if}
+7 -10
View File
@@ -12,6 +12,7 @@ SPDX-License-Identifier: MPL-2.0
import { getLocalization } from '$lib/i18n';
import Cookies from 'js-cookie';
import BrownButton from '$lib/components/buttons/brown.svelte';
import { hcaptcha_site_key, recaptcha_key, sentry_dsn } from '$lib/config';
const { t } = getLocalization();
@@ -30,7 +31,7 @@ SPDX-License-Identifier: MPL-2.0
let custom_field_value = $state();
let captcha_enabled = $state();
let hcaptchaSitekey = import.meta.env.VITE_HCAPTCHA;
let hcaptchaSitekey = hcaptcha_site_key;
let hcaptcha = {
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
});
} catch (e) {
if (import.meta.env.VITE_SENTRY !== null) {
if (sentry_dsn !== null) {
Sentry.captureException(e);
}
/* alertModal.set({
@@ -154,13 +155,11 @@ SPDX-License-Identifier: MPL-2.0
alert('Captcha failed!');
window.location.reload();
}
} else if (import.meta.env.VITE_RECAPTCHA) {
} else if (recaptcha_key) {
// eslint-disable-next-line no-undef
grecaptcha.ready(() => {
// eslint-disable-next-line no-undef
grecaptcha
.execute(import.meta.env.VITE_RECAPTCHA, { action: 'submit' })
.then(function (token) {
grecaptcha.execute(recaptcha_key, { action: 'submit' }).then(function (token) {
socket.emit('join_game', {
username: username,
game_pin: game_pin,
@@ -198,10 +197,8 @@ SPDX-License-Identifier: MPL-2.0
{#if captcha_enabled && hcaptchaSitekey}
<script src="https://js.hcaptcha.com/1/api.js" async defer></script>
{/if}
{#if import.meta.env.VITE_RECAPTCHA && captcha_enabled}
<script
src="https://www.google.com/recaptcha/api.js?render={import.meta.env.VITE_RECAPTCHA}"
></script>
{#if recaptcha_key && captcha_enabled}
<script src="https://www.google.com/recaptcha/api.js?render={recaptcha_key}"></script>
{/if}
</svelte:head>
+1 -1
View File
@@ -13,12 +13,12 @@ SPDX-License-Identifier: MPL-2.0
import { initLocalizationContext } from '$lib/i18n';
import { browser } from '$app/environment';
import CommandPalette from '$lib/components/commandpalette.svelte';
import { plausible_data_url } from '$lib/config';
interface Props {
children?: import('svelte').Snippet;
}
let { children }: Props = $props();
const plausible_data_url = import.meta.env.VITE_PLAUSIBLE_DATA_URL;
if (browser) {
pathname.set(window.location.pathname);
@@ -6,6 +6,7 @@ SPDX-License-Identifier: MPL-2.0
<script lang="ts">
import { github_auth_enabled, google_auth_enabled, custom_oauth_name } from '$lib/config';
console.log(github_auth_enabled);
</script>
{#if google_auth_enabled}