Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from nodejs:main #307

Merged
merged 3 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ cache

# TypeScript
tsconfig.tsbuildinfo

# Sentry Config File
.sentryclirc
4 changes: 2 additions & 2 deletions COLLABORATOR_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
- [Adding new pages](#adding-new-pages)
- [Create the page content](#create-the-page-content)
- [Translating pages](#translating-pages)
- [Creating Components](#creating-components)
- [Creating Components](#creating-react-components)
- [Styling a Component](#styling-a-component)
- [Best practices when creating a Component](#best-practices-when-creating-a-component)
- [How a new Component should look like when freshly created](#how-a-new-component-should-look-like-when-freshly-created)
Expand Down Expand Up @@ -141,7 +141,7 @@ layout: layout-name.hbs
```

> \[!NOTE]\
> A list of currently available Layouts is provided within `providers/layoutProvider` on the `getLegacyProviders` map.\
> A list of currently available Layouts is provided within `components/withLayout` on the `layoutComponents` map.\
> This is a temporary map and this map might change its location and be defined in a different way in the future.

### Translating Pages
Expand Down
4 changes: 2 additions & 2 deletions app/[locale]/[[...path]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export const viewport = DEFAULT_VIEWPORT;

// This generates each page's HTML Metadata
// @see https://nextjs.org/docs/app/api-reference/functions/generate-metadata
export const generateMetadata = async (c: DynamicParams) => {
const { path = [], locale = defaultLocale.code } = c.params;
export const generateMetadata = async ({ params }: DynamicParams) => {
const { path = [], locale = defaultLocale.code } = params;

const pathname = dynamicRouter.getPathname(path);

Expand Down
9 changes: 4 additions & 5 deletions app/sitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@ const sitemap = async (): Promise<MetadataRoute.Sitemap> => {

for (const locale of availableLocaleCodes) {
const routesForLanguage = await dynamicRouter.getRoutesByLanguage(locale);

paths.push(...routesForLanguage.map(route => `${locale}/${route}`));
paths.push(
...routesForLanguage.map(route => `${baseUrlAndPath}/${locale}/${route}`)
);
}

const currentDate = new Date().toISOString();

const appRoutes = paths.sort().map(route => `${baseUrlAndPath}/${route}`);

return [...appRoutes, ...EXTERNAL_LINKS_SITEMAP].map(route => ({
return [...paths, ...EXTERNAL_LINKS_SITEMAP].map(route => ({
url: route,
lastModified: currentDate,
changeFrequency: 'always',
Expand Down
2 changes: 1 addition & 1 deletion client-context.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { cache } from 'react';

import type { ClientSharedServerContext } from './types';
import type { ClientSharedServerContext } from '@/types';

// This allows us to have Server-Side Context's of the shared "contextual" data
// which includes the frontmatter, the current pathname from the dynamic segments
Expand Down
21 changes: 20 additions & 1 deletion next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

import { withSentryConfig } from '@sentry/nextjs';
import withNextIntl from 'next-intl/plugin';

import { BASE_PATH, ENABLE_STATIC_EXPORT } from './next.constants.mjs';
Expand Down Expand Up @@ -67,4 +68,22 @@ const nextConfig = {
},
};

export default withNextIntl()(nextConfig);
// Next.js Config with i18n Configuration
const withIntlConfig = withNextIntl()(nextConfig);

// Next.js Config with Sentry configuration
export default withSentryConfig(
withIntlConfig,
{ silent: true, org: 'nodejs-org', project: 'nodejs-org' },
{
// upload Next.js or third-party code in addition to our code
widenClientFileUpload: true,
// transpile the Sentry code too since we target older browsers in our .browserslistrc
transpileClientSDK: true,
// attempt to circumvent ad blockers
tunnelRoute: ENABLE_STATIC_EXPORT ? undefined : '/monitoring',
// prevent source map comments in built files
hideSourceMaps: false,
disableLogger: true,
}
);
6 changes: 6 additions & 0 deletions next.constants.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,9 @@ export const DEFAULT_VIEWPORT = {
width: 'device-width',
initialScale: 1,
};

/**
* This is the Sentry DSN for the Node.js Website Project
*/
export const SENTRY_DSN =
'https://02884d0745aecaadf5f780278fe5fe70@o4506191161786368.ingest.sentry.io/4506191307735040';
Loading
Loading