658bdf3e57
## Summary Follow-up to the Cloudflare/OpenNext migration (#20741). Now that the legacy `twenty-website` package was already removed in #20270, the `-new` suffix on the marketing site package is no longer meaningful. ## What changes - **Directory rename**: `git mv packages/twenty-website-new packages/twenty-website` (1213 files moved, no content change) - **Package + nx config**: `package.json` and `project.json` name fields updated, `sourceRoot` repointed - **Source refs**: `load-local-articles.ts` and `load-local-release-notes.ts` had a hardcoded `'twenty-website-new'` segment in their monorepo-root fallback path; `app/[locale]/releases/page.tsx` had display strings showing where to add content - **External refs**: root `package.json` workspaces, root `CLAUDE.md` / `README.md`, `twenty-sdk` + `create-twenty-app` READMEs, `.vscode/twenty.code-workspace`, `.cursor/rules/changelog-process.mdc`, Crowdin config + the three `website-i18n-*` CI workflows + `ci-website.yaml` - **Docker cleanup**: `packages/twenty-docker/twenty-website-new/Dockerfile` deleted; the two Makefile targets (`prod-website-new-build` / `prod-website-new-run`) that referenced it removed — EKS deploy was retired in the Cloudflare migration - **`yarn.lock`** regenerated against the new workspace path ## What's deliberately not in this PR The dev hostname `website-new.twenty-main.com` in `wrangler.jsonc` stays for now. Migrating it to `website.twenty-main.com` needs coordinated DNS deletion (current CNAME points at the legacy Docusaurus NLB and serves 503s) and removal of the matching legacy `website` Helm chart in `twenty-infra`. Flagged as a separate cleanup. Companion infra PR: https://github.com/twentyhq/twenty-infra/pull/682 (workflow paths + Terraform ECR + docs) ## Test plan - [x] `yarn install --immutable` resolves clean against the new path - [x] `npx nx typecheck twenty-website` passes - [x] `npx nx lint twenty-website` passes - [ ] CI on this PR confirms the same on a fresh checkout - [ ] After merge: trigger `Deploy Website` workflow against `environment=dev` to confirm the renamed working-directory deploys correctly
235 lines
6.8 KiB
TypeScript
235 lines
6.8 KiB
TypeScript
import path from 'path';
|
|
import { initOpenNextCloudflareForDev } from '@opennextjs/cloudflare';
|
|
import withLinaria, { type LinariaConfig } from 'next-with-linaria';
|
|
import { APP_LOCALES } from 'twenty-shared/translations';
|
|
|
|
// Locale URL segments that are actually served (others are normalised away).
|
|
// Mirrors LOCALE_BY_URL_SEGMENT keys in src/lib/i18n/utils/website-locale-segments.ts.
|
|
const DEPLOYED_LOCALE_URL_SEGMENTS = ['en', 'fr'] as const;
|
|
|
|
// Raw locale codes (e.g. fr-FR, de-DE) that should redirect to the un-prefixed
|
|
// path. Excludes pseudo-* locales and the deployed URL segments themselves.
|
|
const RAW_LOCALE_PREFIXES_TO_STRIP = (
|
|
Object.values(APP_LOCALES) as string[]
|
|
).filter(
|
|
(locale) =>
|
|
!locale.startsWith('pseudo-') &&
|
|
!(DEPLOYED_LOCALE_URL_SEGMENTS as readonly string[]).includes(locale),
|
|
);
|
|
|
|
const SECURITY_HEADERS = [
|
|
{
|
|
key: 'Strict-Transport-Security',
|
|
value: 'max-age=63072000; includeSubDomains; preload',
|
|
},
|
|
{ key: 'X-Content-Type-Options', value: 'nosniff' },
|
|
{ key: 'Referrer-Policy', value: 'strict-origin-when-cross-origin' },
|
|
{
|
|
key: 'Permissions-Policy',
|
|
value: 'camera=(), microphone=(), geolocation=(), payment=()',
|
|
},
|
|
{ key: 'X-Frame-Options', value: 'DENY' },
|
|
{ key: 'Content-Security-Policy', value: "frame-ancestors 'none'" },
|
|
] as const;
|
|
|
|
const nextConfig: LinariaConfig = {
|
|
images: {
|
|
formats: ['image/avif', 'image/webp'],
|
|
remotePatterns: [
|
|
{
|
|
hostname: 'avatars.githubusercontent.com',
|
|
pathname: '/**',
|
|
protocol: 'https',
|
|
},
|
|
{
|
|
hostname: 'twenty-icons.com',
|
|
pathname: '/**',
|
|
protocol: 'https',
|
|
},
|
|
],
|
|
},
|
|
linaria: {
|
|
configFile: path.resolve(__dirname, 'wyw-in-js.config.cjs'),
|
|
},
|
|
reactCompiler: true,
|
|
experimental: {
|
|
swcPlugins: [
|
|
[
|
|
'@lingui/swc-plugin',
|
|
{
|
|
runtimeModules: {
|
|
i18n: ['@lingui/core', 'i18n'],
|
|
trans: ['@lingui/react', 'Trans'],
|
|
},
|
|
},
|
|
],
|
|
],
|
|
},
|
|
async headers() {
|
|
return [
|
|
{
|
|
source: '/:path*',
|
|
headers: SECURITY_HEADERS.map((h) => ({ ...h })),
|
|
},
|
|
{
|
|
source: '/(images|illustrations|lottie)/:path*',
|
|
headers: [
|
|
{
|
|
key: 'Cache-Control',
|
|
value: 'public, max-age=31536000, immutable',
|
|
},
|
|
],
|
|
},
|
|
];
|
|
},
|
|
async rewrites() {
|
|
return {
|
|
beforeFiles: [
|
|
// Root rewrites to the source locale.
|
|
{ source: '/', destination: '/en' },
|
|
// Any path that isn't already locale-prefixed (en/, fr/), an internal
|
|
// Next.js path, a static asset folder, or a file with an extension
|
|
// rewrites to the source locale prefix. Mirrors proxy.ts Rule 4.
|
|
{
|
|
source:
|
|
'/:rest((?!en$|en/|fr$|fr/|api|_next/static|_next/image|favicon\\.ico|robots\\.txt|sitemap\\.xml|illustrations|lottie|fonts|.+\\..+).+)',
|
|
destination: '/en/:rest',
|
|
},
|
|
],
|
|
};
|
|
},
|
|
async redirects() {
|
|
return [
|
|
// Canonicalise www → apex. Host-based; fires before any locale logic.
|
|
{
|
|
source: '/:path*',
|
|
has: [{ type: 'host', value: 'www.twenty.com' }],
|
|
destination: 'https://twenty.com/:path*',
|
|
permanent: true,
|
|
},
|
|
// Strip the source-locale prefix: /en/foo → /foo (301). Mirrors proxy.ts Rule 1.
|
|
{ source: '/en', destination: '/', statusCode: 301 },
|
|
{ source: '/en/:path*', destination: '/:path*', statusCode: 301 },
|
|
// Normalise raw locale codes that aren't deployed URL segments
|
|
// (e.g. /fr-FR/foo → /foo, /de-DE/foo → /foo). Mirrors proxy.ts Rule 3.
|
|
...RAW_LOCALE_PREFIXES_TO_STRIP.flatMap((locale) => [
|
|
{ source: `/${locale}`, destination: '/', permanent: true },
|
|
{
|
|
source: `/${locale}/:path*`,
|
|
destination: '/:path*',
|
|
permanent: true,
|
|
},
|
|
]),
|
|
{
|
|
source: '/user-guide',
|
|
destination: 'https://docs.twenty.com/user-guide/introduction',
|
|
permanent: true,
|
|
},
|
|
{
|
|
source: '/user-guide/section/:folder/:slug*',
|
|
destination: 'https://docs.twenty.com/user-guide/:folder/:slug*',
|
|
permanent: true,
|
|
},
|
|
{
|
|
source: '/user-guide/:folder/:slug*',
|
|
destination: 'https://docs.twenty.com/user-guide/:folder/:slug*',
|
|
permanent: true,
|
|
},
|
|
{
|
|
source: '/developers',
|
|
destination: 'https://docs.twenty.com/developers/introduction',
|
|
permanent: true,
|
|
},
|
|
{
|
|
source: '/developers/section/:folder/:slug*',
|
|
destination: 'https://docs.twenty.com/developers/:folder/:slug*',
|
|
permanent: true,
|
|
},
|
|
{
|
|
source: '/developers/:folder/:slug*',
|
|
destination: 'https://docs.twenty.com/developers/:folder/:slug*',
|
|
permanent: true,
|
|
},
|
|
{
|
|
source: '/developers/:slug',
|
|
destination: 'https://docs.twenty.com/developers/:slug',
|
|
permanent: true,
|
|
},
|
|
{
|
|
source: '/twenty-ui',
|
|
destination: 'https://docs.twenty.com/twenty-ui/introduction',
|
|
permanent: true,
|
|
},
|
|
{
|
|
source: '/twenty-ui/section/:folder/:slug*',
|
|
destination: 'https://docs.twenty.com/twenty-ui/:folder/:slug*',
|
|
permanent: true,
|
|
},
|
|
{
|
|
source: '/twenty-ui/:folder/:slug*',
|
|
destination: 'https://docs.twenty.com/twenty-ui/:folder/:slug*',
|
|
permanent: true,
|
|
},
|
|
{
|
|
source: '/twenty-ui/:slug',
|
|
destination: 'https://docs.twenty.com/twenty-ui/:slug',
|
|
permanent: true,
|
|
},
|
|
{
|
|
source: '/resources/why-twenty',
|
|
destination: '/why-twenty',
|
|
permanent: true,
|
|
},
|
|
{
|
|
source: '/story',
|
|
destination: '/why-twenty',
|
|
permanent: true,
|
|
},
|
|
{
|
|
source: '/legal/privacy',
|
|
destination: '/privacy-policy',
|
|
permanent: true,
|
|
},
|
|
{
|
|
source: '/legal/terms',
|
|
destination: '/terms',
|
|
permanent: true,
|
|
},
|
|
{
|
|
source: '/legal/dpa',
|
|
destination: '/terms',
|
|
permanent: true,
|
|
},
|
|
{
|
|
source: '/case-studies/9-dots-story',
|
|
destination: '/customers/9dots',
|
|
permanent: true,
|
|
},
|
|
{
|
|
source: '/case-studies/act-immi-story',
|
|
destination: '/customers/act-education',
|
|
permanent: true,
|
|
},
|
|
{
|
|
source: '/case-studies/:slug*',
|
|
destination: '/customers',
|
|
permanent: true,
|
|
},
|
|
{
|
|
source: '/implementation-services',
|
|
destination: '/partners',
|
|
permanent: true,
|
|
},
|
|
{
|
|
source: '/onboarding-packages',
|
|
destination: '/partners',
|
|
permanent: true,
|
|
},
|
|
];
|
|
},
|
|
};
|
|
|
|
initOpenNextCloudflareForDev();
|
|
|
|
module.exports = withLinaria(nextConfig);
|