Skip to content

Commit 06278e2

Browse files
authored
Upgrade deps (#73)
* chore: update Next.js and fix i18n * chore: update rest deps * fix: build * fix: install wget * fix: HOSTNAME
1 parent 33c57e8 commit 06278e2

File tree

55 files changed

+3856
-7773
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+3856
-7773
lines changed

Dockerfile

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
1-
FROM node:18-alpine AS deps
2-
RUN apk add --no-cache libc6-compat
1+
FROM node:24-slim AS deps
2+
ENV PNPM_HOME="/pnpm"
3+
ENV PATH="$PNPM_HOME:$PATH"
4+
RUN corepack enable
35
WORKDIR /app
46

5-
COPY package.json package-lock.json* ./
6-
RUN npm ci
7+
COPY pnpm-lock.yaml package.json ./
8+
RUN pnpm install --frozen-lockfile
79

8-
FROM node:18-alpine AS builder
10+
FROM node:24-slim AS builder
11+
ENV PNPM_HOME="/pnpm"
12+
ENV PATH="$PNPM_HOME:$PATH"
13+
RUN corepack enable
914
WORKDIR /app
1015
COPY --from=deps /app/node_modules ./node_modules
1116
COPY . .
1217

13-
ARG CLUSTER_NAME
14-
ENV NEXT_PUBLIC_CLUSTER_NAME=$CLUSTER_NAME
18+
ENV NEXT_TELEMETRY_DISABLED=1
1519

16-
ENV NEXT_TELEMETRY_DISABLED 1
20+
RUN pnpm run build
1721

18-
RUN npm run build
19-
20-
FROM node:18-alpine AS runner
22+
FROM node:24-slim AS runner
2123
WORKDIR /app
2224

23-
ENV NODE_ENV production
24-
ENV NEXT_TELEMETRY_DISABLED 1
25+
RUN apt update && apt install -y wget
26+
27+
ENV NODE_ENV=production
28+
ENV NEXT_TELEMETRY_DISABLED=1
2529

2630
RUN addgroup --system --gid 1001 nodejs
2731
RUN adduser --system --uid 1001 nextjs
@@ -35,7 +39,8 @@ USER nextjs
3539

3640
EXPOSE 3000
3741

38-
ENV PORT 3000
42+
ENV HOSTNAME="0.0.0.0"
43+
ENV PORT=3000
3944

4045
HEALTHCHECK --timeout=3s --start-period=10s \
4146
CMD wget -nv -t1 --spider http://localhost:3000/ || exit 1

components/cookie-consent/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import useTranslation from 'next-translate/useTranslation'
1+
import { useTranslations } from 'next-intl'
22
import { useEffect, useState } from 'react'
33
import styled from 'styled-components'
44

@@ -53,7 +53,7 @@ const Wrapper = styled.div`
5353
const storageKey = 'cookie_consent_informed'
5454

5555
const CookieConsent = () => {
56-
const { t } = useTranslation('common')
56+
const t = useTranslations('common')
5757
const [visible, setVisible] = useState(false)
5858

5959
useEffect(() => {

components/features/index.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import useTranslationEx from 'hooks/use-translation-ex'
1+
import { RichTagsFunction, useTranslations } from 'next-intl'
22
import Image from 'next/image'
33
import styled from 'styled-components'
44

@@ -145,21 +145,21 @@ const Features = () => {
145145
}
146146
]
147147

148-
const { tE } = useTranslationEx('index')
148+
const t = useTranslations('index')
149149

150-
const componentElements = {
151-
p: <p />,
152-
q: <q />,
153-
strong: <strong />
150+
const componentElements: Record<string, RichTagsFunction> = {
151+
p: (chunks) => <p>{chunks}</p>,
152+
q: (chunks) => <q>{chunks}</q>,
153+
strong: (chunks) => <strong>{chunks}</strong>
154154
}
155155

156156
return (
157157
<Wrapper>
158158
{images.map(({ light, dark }, index) => (
159159
<FeatureWrapper key={index}>
160160
<MaxWidthWrapper $maxWidth={'calc(var(--max-width) / 2)'}>
161-
<Heading>{tE(`features.${index}.title`, null, { componentElements })}</Heading>
162-
<Description>{tE(`features.${index}.description`, null, { componentElements })}</Description>
161+
<Heading>{t.rich(`features.${index}.title`, componentElements)}</Heading>
162+
<Description>{t.rich(`features.${index}.description`, componentElements)}</Description>
163163
</MaxWidthWrapper>
164164

165165
<FeatureImageWrapper>

components/footer/digitalocean-referral-badge.svg

Lines changed: 0 additions & 51 deletions
This file was deleted.

components/footer/index.tsx

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
import useTranslation from 'next-translate/useTranslation'
2-
import Image from 'next/image'
1+
import { useTranslations } from 'next-intl'
32
import styled from 'styled-components'
4-
import { CLUSTER_NAME, isMainlandChinaCluster } from 'utils/config'
53

64
import CookieConsent from 'components/cookie-consent'
75
import MaxWidthWrapper from 'components/max-width-wrapper'
86

9-
import digitalOceanReferralBadge from './digitalocean-referral-badge.svg'
10-
117
const Wrapper = styled.div`
128
padding: 2rem 0;
139
font-size: 0.875rem;
@@ -24,12 +20,6 @@ const Copyright = styled.div`
2420
opacity: 0.8;
2521
`
2622

27-
const ICPLicense = styled.a`
28-
opacity: 0.5;
29-
color: var(--color-text);
30-
text-decoration: none;
31-
`
32-
3323
const Links = styled.ol`
3424
display: flex;
3525
gap: 1rem;
@@ -51,47 +41,24 @@ const Links = styled.ol`
5141
}
5242
`
5343

54-
const DigitalOceanBadge = styled.a`
55-
display: flex;
56-
align-items: center;
57-
`
58-
5944
const Footer = () => {
60-
const { t } = useTranslation('common')
61-
62-
const showDigitalOceanBadge = CLUSTER_NAME === 'digitalocean'
45+
const t = useTranslations('common')
6346

6447
return (
6548
<>
6649
<Wrapper>
6750
<MaxWidthWrapper>
6851
<Copyright>&copy; 2021-{new Date().getFullYear()} LinearMouse</Copyright>
6952

70-
{isMainlandChinaCluster && (
71-
<ICPLicense href="https://beian.miit.gov.cn" target="_blank" rel="noreferrer noopener">
72-
沪ICP备2023003051号
73-
</ICPLicense>
74-
)}
75-
7653
<Links>
7754
<a href="https://crowdin.com/project/linearmouse" target="_blank" rel="noreferrer noopener">
7855
{t('footer.help_translate')}
7956
</a>
8057
<a href="/privacy.html">{t('footer.privacy_policy')}</a>
8158
</Links>
82-
83-
{showDigitalOceanBadge && (
84-
<DigitalOceanBadge
85-
href="https://www.digitalocean.com/?refcode=f272815c14b2&utm_campaign=Referral_Invite&utm_source=LinearMouse"
86-
target="_blank"
87-
rel="noopener"
88-
>
89-
<Image alt="DigitalOcean Referral Badge" width={133} height={43} src={digitalOceanReferralBadge} />
90-
</DigitalOceanBadge>
91-
)}
9259
</MaxWidthWrapper>
9360
</Wrapper>
94-
{!isMainlandChinaCluster && <CookieConsent />}
61+
<CookieConsent />
9562
</>
9663
)
9764
}

components/header/navigation/index.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import useTranslation from 'next-translate/useTranslation'
1+
import { useTranslations } from 'next-intl'
22
import styled from 'styled-components'
3-
import { isMainlandChinaCluster } from 'utils/config'
43

54
import LanguageSelect from 'components/language-select'
65

@@ -30,15 +29,14 @@ const Wrapper = styled.div`
3029
`
3130

3231
const Navigation = () => {
33-
const { t } = useTranslation('common')
32+
const t = useTranslations('common')
3433

3534
return (
3635
<Wrapper role="navigation">
3736
<a href="https://github.com/linearmouse/linearmouse">{t('navigation.github')}</a>
3837
<a href="https://github.com/linearmouse/linearmouse/discussions">{t('navigation.discussions')}</a>
3938

40-
{!isMainlandChinaCluster && <LanguageSelect />}
41-
{isMainlandChinaCluster && <a href="https://linearmouse.app/ncr/">Global</a>}
39+
<LanguageSelect />
4240
</Wrapper>
4341
)
4442
}

components/hero/download/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import useTranslation from 'next-translate/useTranslation'
1+
import { useTranslations } from 'next-intl'
22
import { useCallback, useState } from 'react'
33
import styled from 'styled-components'
44

@@ -29,7 +29,7 @@ const DownloadButton = styled.a`
2929
transition: background-color 0.1s ease;
3030
3131
&::before {
32-
margin-right: 0.625rem;
32+
margin-inline-end: 0.625rem;
3333
content: '';
3434
font-size: 1.2rem;
3535
}
@@ -77,7 +77,7 @@ const Copied = styled.span`
7777
`
7878

7979
const Download = () => {
80-
const { t } = useTranslation('index')
80+
const t = useTranslations('index')
8181

8282
const [copied, setCopied] = useState(false)
8383

components/hero/slogan/index.tsx

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import useTranslationEx from 'hooks/use-translation-ex'
2-
import Trans from 'next-translate/Trans'
1+
import { useTranslations } from 'next-intl'
32
import styled from 'styled-components'
43

54
import Marquee from './marquee'
@@ -42,25 +41,23 @@ const GradientText = styled.span`
4241
`
4342

4443
const Slogan = () => {
45-
const { t, tE } = useTranslationEx('index')
44+
const t = useTranslations('index')
4645

4746
return (
4847
<Wrapper>
49-
{tE('slogan', null, {
50-
componentElements: {
51-
Marquee: (
52-
<Marquee
53-
lines={[
54-
t('slogan_marquee.mouse_and_trackpad'),
55-
t('slogan_marquee.scrolling_direction'),
56-
t('slogan_marquee.pointer_acceleration'),
57-
t('slogan_marquee.pointer_speed'),
58-
t('slogan_marquee.modifier_keys')
59-
]}
60-
/>
61-
),
62-
GradientText: <GradientText />
63-
}
48+
{t.rich('slogan', {
49+
Marquee: () => (
50+
<Marquee
51+
lines={[
52+
t('slogan_marquee.mouse_and_trackpad'),
53+
t('slogan_marquee.scrolling_direction'),
54+
t('slogan_marquee.pointer_acceleration'),
55+
t('slogan_marquee.pointer_speed'),
56+
t('slogan_marquee.modifier_keys')
57+
]}
58+
/>
59+
),
60+
GradientText: (chunks) => <GradientText>{chunks}</GradientText>
6461
})}
6562
</Wrapper>
6663
)

components/language-select/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import useTranslation from 'next-translate/useTranslation'
1+
import { useTranslations } from 'next-intl'
22
import Link from 'next/link'
33
import styled from 'styled-components'
44

@@ -75,11 +75,11 @@ const Wrapper = styled.button`
7575
border-radius: var(--border-radius-md);
7676
transition: opacity 0.15s ease;
7777
box-shadow: var(--shadow-md);
78-
78+
7979
max-height: min(600px, 100vh - 150px);
8080
overflow-y: auto;
8181
overscroll-behavior: contain;
82-
82+
8383
& > div {
8484
column-count: 2;
8585
}
@@ -111,7 +111,7 @@ const LanguageSelect = () => {
111111
document.cookie = `NEXT_LOCALE=${locale}; max-age=${30 * 24 * 3600}; path=/`
112112
}
113113

114-
const { t } = useTranslation('common')
114+
const t = useTranslations('common')
115115

116116
return (
117117
<Wrapper type="button">

hooks/use-translation-ex/index.tsx

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)