chore: deliberate dependency upgrades; drop legacy-peer-deps; Capacitor 8.6.2 (shell build 2)
Platform-v2 step 2.99c. - Both apps on the same current versions: React 19.3.1, react-query 5.107.1, router 7.18.5, axios 1.21.1, zustand 5.1, vite 8.3.8, plugin-react 6.3; manager lucide-react 1.14 -> 1.73, recharts 3.8 -> 3.10. - i18next 27.1.1 + react-i18next 18.0.1 (exact pins). Shared options moved to packages/i18n/src/options.js with returnEmptyString: true (27 shows the key for an empty text otherwise); tests/instance.test.mjs guards it, plus fallback, code casing and plurals. - vite-plugin-pwa 2.0 lists Vite 8 as a peer: .npmrc (legacy-peer-deps) removed, `npm install` resolves without it. - Native (CS-10): @capacitor/core/android/cli 8.6.2, @capacitor/app 8.1.2, @capgo/capacitor-updater 8.54.2; versionCode 2 / versionName 1.1.0 and MIN_SHELL_BUILD 2. capacitor-updater 8.54 refuses plain-HTTP downloads by default, which broke every bundle check in the stacks suite: httpsOnly: false in capacitor.config.json (venues have no domains; zips are sha256-checked). - npm audit: 6 left, all in workbox-build 7.4.1 (build time). Full run-all incl. Android passes (Android re-run after the httpsOnly fix). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -14,8 +14,8 @@
|
||||
"check": "node scripts/check-i18n.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"i18next": "26.7.2",
|
||||
"react-i18next": "17.1.13"
|
||||
"i18next": "27.1.1",
|
||||
"react-i18next": "18.0.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^19.0.0"
|
||||
|
||||
@@ -2,6 +2,7 @@ import i18next from 'i18next'
|
||||
import { initReactI18next } from 'react-i18next'
|
||||
import { FALLBACK_LANGUAGE, SUPPORTED_LANGUAGES, normalizeLanguage } from './locale.js'
|
||||
import { NAMESPACES, resources } from './resources.js'
|
||||
import { BASE_OPTIONS } from './options.js'
|
||||
|
||||
const DEV = typeof import.meta !== 'undefined' && !!import.meta.env?.DEV
|
||||
|
||||
@@ -21,14 +22,9 @@ export function createI18n({ language = FALLBACK_LANGUAGE, defaultNS = 'common',
|
||||
i18n.use(initReactI18next).init({
|
||||
resources: mergeResources(resources, extra),
|
||||
lng: normalizeLanguage(language) || FALLBACK_LANGUAGE,
|
||||
fallbackLng: FALLBACK_LANGUAGE,
|
||||
supportedLngs: SUPPORTED_LANGUAGES,
|
||||
...BASE_OPTIONS,
|
||||
ns: NAMESPACES,
|
||||
defaultNS,
|
||||
fallbackNS: 'common',
|
||||
interpolation: { escapeValue: false }, // React escapes already
|
||||
returnNull: false,
|
||||
initAsync: false,
|
||||
saveMissing: DEV,
|
||||
missingKeyHandler: DEV ? (lngs, ns, key) => console.warn(`[i18n] missing key "${ns}:${key}" (${lngs.join(', ')})`) : undefined,
|
||||
react: { useSuspense: false },
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
// The i18next options every app shares (createI18n in i18n.js adds resources, language and
|
||||
// namespaces). Kept apart from the locale files so node tests can import it (tests/instance.test.mjs).
|
||||
import { FALLBACK_LANGUAGE, SUPPORTED_LANGUAGES } from './locale.js'
|
||||
|
||||
export const BASE_OPTIONS = {
|
||||
fallbackLng: FALLBACK_LANGUAGE,
|
||||
supportedLngs: SUPPORTED_LANGUAGES,
|
||||
fallbackNS: 'common',
|
||||
interpolation: { escapeValue: false }, // React escapes already
|
||||
returnNull: false,
|
||||
returnEmptyString: true, // i18next 27 made '' fall back like a missing key; a few texts are '' on purpose (e.g. an untitled column)
|
||||
initAsync: false,
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// The shared i18next options (src/options.js) on i18next itself. Guards what i18next 27
|
||||
// changed (plan step 2.99c): empty texts, fallback language, language code casing, plurals.
|
||||
import assert from 'node:assert/strict'
|
||||
import { test } from 'node:test'
|
||||
import i18next from 'i18next'
|
||||
import { BASE_OPTIONS } from '../src/options.js'
|
||||
|
||||
const make = (lng, resources) => {
|
||||
const i18n = i18next.createInstance()
|
||||
i18n.init({ ...BASE_OPTIONS, lng, resources, ns: ['common'], defaultNS: 'common' })
|
||||
return i18n
|
||||
}
|
||||
const RES = {
|
||||
en: { common: { empty: '', onlyEn: 'Only English', times_one: '{{count}} time', times_other: '{{count}} times' } },
|
||||
el: { common: { empty: '', times_one: '{{count}} φορά', times_other: '{{count}} φορές' } },
|
||||
}
|
||||
|
||||
test('an empty text stays empty (i18next 27 alone would show the key)', () => {
|
||||
assert.equal(make('en', RES).t('empty'), '')
|
||||
})
|
||||
|
||||
test('a key Greek lacks falls back to English', () => {
|
||||
assert.equal(make('el', RES).t('onlyEn'), 'Only English')
|
||||
})
|
||||
|
||||
test('language code casing and plurals', () => {
|
||||
assert.equal(make('EN', RES).language, 'en')
|
||||
assert.equal(make('en', RES).t('times', { count: 1 }), '1 time')
|
||||
assert.equal(make('el', RES).t('times', { count: 3 }), '3 φορές')
|
||||
})
|
||||
Reference in New Issue
Block a user