fix: docker build failing due to missing external dependencies in esbuild.js

This commit is contained in:
Nicolas Meienberger 2023-05-17 19:00:07 +02:00 committed by Nicolas Meienberger
parent 75a4e570e2
commit 62848f9705
7 changed files with 50 additions and 19 deletions

View file

@ -18,7 +18,7 @@ const onRebuild = () => {
}
};
const included = ['express', 'pg', '@runtipi/postgres-migrations'];
const included = ['express', 'pg', '@runtipi/postgres-migrations', 'connect-redis', 'express-session'];
const excluded = ['pg-native', '*required-server-files.json'];
const external = Object.keys(pkg.dependencies || {}).filter((dep) => !included.includes(dep));
external.push(...excluded);

View file

@ -1,9 +1,17 @@
import React from 'react';
import { useLocale } from '@/client/hooks/useLocale';
import { LOCALE_OPTIONS, Locale } from '@/shared/internationalization/locales';
import { useTranslations } from 'next-intl';
import { IconExternalLink } from '@tabler/icons-react';
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../ui/Select';
export const LanguageSelector = () => {
type IProps = {
showLabel?: boolean;
};
export const LanguageSelector = (props: IProps) => {
const { showLabel = false } = props;
const t = useTranslations('settings.settings');
const { locale, changeLocale } = useLocale();
const onChange = (value: Locale) => {
@ -12,7 +20,20 @@ export const LanguageSelector = () => {
return (
<Select value={locale} defaultValue={locale} onValueChange={onChange}>
<SelectTrigger className="mb-3" label="">
<SelectTrigger
className="mb-3"
label={
showLabel && (
<span>
{t('language')}&nbsp;
<a href="https://crowdin.com/project/runtipi/invite?h=ae594e86cd807bc075310cab20a4aa921693663" target="_blank" rel="noreferrer">
{t('help-translate')}
<IconExternalLink className="ms-1 mb-1" size={16} />
</a>
</span>
)
}
>
<SelectValue placeholder="test" />
</SelectTrigger>
<SelectContent>

View file

@ -245,7 +245,9 @@
"storage-path": "Storage path",
"storage-path-hint": "Path to the storage directory. Keep empty for default (runtipi/app-data). Make sure it is an absolute path and that it exists",
"submit": "Save",
"user-settings-title": "User settings"
"user-settings-title": "User settings",
"language": "Language",
"help-translate": "Help translate Tipi"
},
"security": {
"tab-title": "Security",

View file

@ -92,7 +92,7 @@ export const SettingsForm = (props: IProps) => {
<IconUser className="me-2" />
<h2 className="text-2xl font-bold">{t('user-settings-title')}</h2>
</div>
<LanguageSelector />
<LanguageSelector showLabel />
<form className="flex flex-col mt-2" onSubmit={handleSubmit(validate)}>
<div className="d-flex">
<IconAdjustmentsAlt className="me-2" />

View file

@ -2,6 +2,7 @@ import React from 'react';
import type { NextPage } from 'next';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { useTranslations } from 'next-intl';
import { useRouter } from 'next/router';
import { Layout } from '../../../../components/Layout';
import { GeneralActions } from '../../containers/GeneralActions';
import { SettingsContainer } from '../../containers/SettingsContainer';
@ -9,14 +10,27 @@ import { SecurityContainer } from '../../containers/SecurityContainer';
export const SettingsPage: NextPage = () => {
const t = useTranslations('settings');
const router = useRouter();
const { tab } = router.query;
const handleTabChange = (newTab: string) => {
router.push(`/settings?tab=${newTab}`);
};
return (
<Layout title={t('title')}>
<div className="card d-flex">
<Tabs defaultValue="actions">
<Tabs defaultValue={(tab as string) || 'actions'}>
<TabsList>
<TabsTrigger value="actions">{t('actions.tab-title')}</TabsTrigger>
<TabsTrigger value="settings">{t('settings.tab-title')}</TabsTrigger>
<TabsTrigger value="security">{t('security.tab-title')}</TabsTrigger>
<TabsTrigger onClick={() => handleTabChange('actions')} value="actions">
{t('actions.tab-title')}
</TabsTrigger>
<TabsTrigger onClick={() => handleTabChange('settings')} value="settings">
{t('settings.tab-title')}
</TabsTrigger>
<TabsTrigger onClick={() => handleTabChange('security')} value="security">
{t('security.tab-title')}
</TabsTrigger>
</TabsList>
<TabsContent value="actions">
<GeneralActions />

View file

@ -1,13 +1,7 @@
/* eslint-disable vars-on-top */
import cron from 'node-cron';
import fs from 'fs-extra';
import { Logger } from '../Logger';
declare global {
// eslint-disable-next-line no-var
var EventDispatcher: EventDispatcher | undefined;
}
export const EVENT_TYPES = {
// System events
RESTART: 'restart',
@ -256,6 +250,4 @@ class EventDispatcher {
}
}
export const EventDispatcherInstance = global.EventDispatcher || EventDispatcher.getInstance();
global.EventDispatcher = EventDispatcherInstance;
export const EventDispatcherInstance = EventDispatcher.getInstance();

View file

@ -2,6 +2,7 @@ export const APP_LOCALES = {
'en-US': 'English',
'fr-FR': 'Français',
'ja-JP': '日本語',
'pl-PL': 'Polski',
'ro-RO': 'Română',
'ru-RU': 'Русский',
'zh-CN': '简体中文',
@ -15,11 +16,12 @@ const FALLBACK_LOCALES = [
{ from: 'ro', to: 'ro-RO' },
{ from: 'ru', to: 'ru-RU' },
{ from: 'zh', to: 'zh-CN' },
{ from: 'pl', to: 'pl-PL' },
];
export type Locale = keyof typeof APP_LOCALES;
export const Locales = Object.keys(APP_LOCALES) as Locale[];
export const Locales = Object.keys(APP_LOCALES);
export const LOCALE_OPTIONS = Object.entries(APP_LOCALES).map(([value, label]) => ({ value, label }));
export const getLocaleFromString = (locale?: string): Locale => {