Skip to content
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
16 changes: 8 additions & 8 deletions .github/ISSUE_TEMPLATE/01-bug-report.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Report a Technical/Visual Issue on the Node.js Website
description: "Is something not working as expected? Did you encounter a glitch or a bug with the Website?"
description: 'Is something not working as expected? Did you encounter a glitch or a bug with the Website?'
labels: [bug]
body:
- type: markdown
Expand All @@ -11,36 +11,36 @@ body:
for us to fix it when you attach a screenshot as well.
- type: input
attributes:
label: "URL:"
label: 'URL:'
description: The URL of the page you are reporting an issue on.
placeholder: https://nodejs.org/en/
validations:
required: true
- type: input
attributes:
label: "Browser Name:"
label: 'Browser Name:'
description: What kind of browser are you using?
placeholder: Chrome
validations:
required: true
- type: input
attributes:
label: "Browser Version:"
label: 'Browser Version:'
description: What version of browser are you using?
placeholder: "103.0.5060.134"
placeholder: '103.0.5060.134'
validations:
required: true
- type: input
attributes:
label: "Operating System:"
label: 'Operating System:'
description: What kind of operation system are you using
(Write it in full, with version number)?
placeholder: "Windows 10, 21H2, 19044.1826"
placeholder: 'Windows 10, 21H2, 19044.1826'
validations:
required: true
- type: textarea
attributes:
label: "How to reproduce the issue:"
label: 'How to reproduce the issue:'
placeholder: |
1. What I did.
2. What I expected to happen.
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/02-feature-request.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Suggest a new feature or improvement for the Node.js Website
description: "Do you have an idea or a suggestion and you want to share?"
description: 'Do you have an idea or a suggestion and you want to share?'
labels: [feature request]
body:
- type: markdown
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ blank_issues_enabled: true
contact_links:
- name: Report an API Docs Issue on the Node.js Website
url: https://github.com/nodejs/node/issues/new?assignees=&labels=doc&template=3-api-ref-docs-problem.yml
about: "Is something wrong with the API Docs? Did you face a bug with the API Docs?"
about: 'Is something wrong with the API Docs? Did you face a bug with the API Docs?'
- name: Report a Translation Issue on the Node.js Website
url: https://crowdin.com/project/nodejs-website
about: "Is something wrong in a specific translation? Do you believe a language can get improved? Do you have suggestions?"
about: 'Is something wrong in a specific translation? Do you believe a language can get improved? Do you have suggestions?'
- name: Need help with Node.js?
url: https://github.com/nodejs/help/issues/
about: "Struggling with Node.js? You're not sure how to code?"
4 changes: 2 additions & 2 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
os: [ubuntu-latest, windows-latest]

steps:
- name: "Use GNU tar instead BSD tar"
- name: 'Use GNU tar instead BSD tar'
if: matrix.os == 'windows-latest'
shell: cmd
run: echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
os: [ubuntu-latest, windows-latest]

steps:
- name: "Use GNU tar instead BSD tar"
- name: 'Use GNU tar instead BSD tar'
if: matrix.os == 'windows-latest'
shell: cmd
run: echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ build
public/robots.txt
public/sitemap.xml
public/en/feed/*.xml
pages/en/blog/year-[0-9][0-9][0-9][0-9].md

# Jest
coverage
Expand Down
6 changes: 6 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@

DIR=$(cd `dirname $0` && pwd -P)

# resets the node release data file
echo "[]" > $DIR/../public/node-releases-data.json

# resets the blog post data file
echo "{\"pagination\": [],\"categories\": [],\"posts\": []}" > $DIR/../public/blog-posts-data.json

# adds these changes to be part of the current commit
git add --sparse $DIR/../public/node-releases-data.json
git add --sparse $DIR/../public/blog-posts-data.json
19 changes: 5 additions & 14 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import type { Preview } from '@storybook/react';
import NextImage from 'next/image';
import { ThemeProvider } from 'next-themes';
import { NodeReleasesProvider } from '../providers/nodeReleasesProvider';
import { LocaleProvider } from '../providers/localeProvider';
import { openSans } from '../util/nextFonts';
import BaseApp, { setAppFont } from '../next.app';
import BaseApp, { setAppFonts } from '../next.app';

import '../styles/index.scss';

Expand All @@ -26,20 +23,14 @@ const preview: Preview = {
},
};

setAppFont(openSans.style.fontFamily);
setAppFonts([openSans.style.fontFamily]);

export const decorators = [
Story => (
<BaseApp>
<ThemeProvider>
<LocaleProvider>
<NodeReleasesProvider>
<div data-test-id="story-root">
<Story />
</div>
</NodeReleasesProvider>
</LocaleProvider>
</ThemeProvider>
<div data-test-id="story-root">
<Story />
</div>
</BaseApp>
),
];
Expand Down
2 changes: 1 addition & 1 deletion COLLABORATOR_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,4 +235,4 @@ export default { component: NameOfComponent } as Meta;
[`react-intl`]: https://formatjs.io/docs/react-intl/
[Next.js]: https://nextjs.org/
[MDX]: https://mdxjs.com/
[SCSS]: https://sass-lang.com/
[SCSS]: https://sass-lang.com/
110 changes: 54 additions & 56 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,22 @@ Note that regular contributors do not need to become "Collaborators". Any contri
is a formality that comes with obligations.

If you're an active contributor seeking to become a member we recommend reaching out to one of the existing Team Members for guidance.

<details>
<summary><b>What's the process for becoming a Collaborator?</b></summary>

- You must be actively contributing to this repository.
- Contributions must include significant code reviews or code contributions.
- A nomination must be done by an existing Team Member of the Website Team with an Issue
- The Issue must explain and describe why the nominated person is a good addition to the team
- The Issue must contain links to relevant contributions through:
- Code Reviews
- Comments on Issues and PRs
- Authoring of PRs or Issues
- Comments or Authoring of Discussions
- The nomination must have at least 3 existing members of the Website Team to be in agreement with the nomination.
- This can be done through commenting with "agreement" (showing support) or reacting to the Issue with a :+1: (Thumbs-up Emoji)
- The Issue must be open for at least 72 hours without an objection from an existing member of the Website Team
- The nomination cannot pass until all open discordances/objections are resolved.
- Objections coming from the TSC or Core Collaborators are also counted as valid objections.
- You must be actively contributing to this repository.
- Contributions must include significant code reviews or code contributions.
- A nomination must be done by an existing Team Member of the Website Team with an Issue
- The Issue must explain and describe why the nominated person is a good addition to the team
- The Issue must contain links to relevant contributions through:
- Code Reviews
- Comments on Issues and PRs
- Authoring of PRs or Issues
- Comments or Authoring of Discussions
- The nomination must have at least 3 existing members of the Website Team to be in agreement with the nomination.
- This can be done through commenting with "agreement" (showing support) or reacting to the Issue with a :+1: (Thumbs-up Emoji)
- The Issue must be open for at least 72 hours without an objection from an existing member of the Website Team - The nomination cannot pass until all open discordances/objections are resolved. - Objections coming from the TSC or Core Collaborators are also counted as valid objections.
</details>

# Getting started
Expand All @@ -60,60 +58,60 @@ for getting things done and landing your contribution.
1. Click the fork button in the top right to clone the [nodejs.org repository](https://github.com/nodejs/nodejs.org/fork)
2. Clone your fork using SSH, GitHub CLI, or HTTPS.

```bash
git clone [email protected]:<YOUR_GITHUB_USERNAME>/nodejs.org.git # SSH
git clone https://github.com/<GITHUB_ID>/nodejs.org.git # HTTPS
gh repo clone <GITHUB_ID>/nodejs.org # GitHub CLI
```
```bash
git clone [email protected]:<YOUR_GITHUB_USERNAME>/nodejs.org.git # SSH
git clone https://github.com/<YOUR_GITHUB_USERNAME>/nodejs.org.git # HTTPS
gh repo clone <YOUR_GITHUB_USERNAME>/nodejs.org # GitHub CLI
```

3. Change into the nodejs.org directory.

```bash
cd nodejs.org
```
```bash
cd nodejs.org
```

4. Create a remote for keeping your fork as well as your local clone up-to-date.

```bash
git remote add upstream [email protected]:nodejs/nodejs.org.git # SSH
git remote add upstream https://github.com/nodejs/nodejs.org.git # HTTPS
gh repo sync nodejs/nodejs.org # GitHub CLI
```
```bash
git remote add upstream [email protected]:nodejs/nodejs.org.git # SSH
git remote add upstream https://github.com/nodejs/nodejs.org.git # HTTPS
gh repo sync nodejs/nodejs.org # GitHub CLI
```

5. Create a new branch for your work.

```bash
git checkout -b name-of-your-branch
```
```bash
git checkout -b name-of-your-branch
```

6. Run the following to install the dependencies and start a local preview of your work.

```bash
npm ci # installs this project's dependencies
npx turbo serve # starts a preview of your local changes
```
```bash
npm ci # installs this project's dependencies
npx turbo serve # starts a preview of your local changes
```

7. Perform a merge to sync your current branch with the upstream branch.

```bash
git fetch upstream
git merge upstream/main
```
```bash
git fetch upstream
git merge upstream/main
```

8. Run `npx turbo format` to confirm that linting, and formatting are passing.

```bash
npx turbo format
```
```bash
npx turbo format
```

9. Once you're happy with your changes, add and commit them to your branch, then push the branch to your fork.
9. Once you're happy with your changes, add and commit them to your branch, then push the branch to your fork.

```bash
cd ~/nodejs.org
git add .
git commit -m "some message"
git push -u origin name-of-your-branch
```
```bash
cd ~/nodejs.org
git add .
git commit -m "some message"
git push -u origin name-of-your-branch
```

10. Create a Pull Request.

Expand All @@ -126,12 +124,12 @@ This repository contains several scripts and commands for performing numerous ta
<details>
<summary>Commands for Running & Building the Website</summary>

- `npx turbo serve` runs Next.js's Local Development Server, listening by default on `http://localhost:3000/`.
- `npx turbo build` builds the Application on Production mode. The output is by default within `.next` folder.
- This is used for the Node.js Vercel Deployments (Preview & Production)
- `npx turbo deploy` builds the Application on Export Production Mode. The output is by default within `build` folder.
- This is used for the Node.js Legacy Website Server (DigitalOcean)
- `npx turbo start` starts a web server running serving the built content from `npx turbo build`
- `npx turbo serve` runs Next.js's Local Development Server, listening by default on `http://localhost:3000/`.
- `npx turbo build` builds the Application on Production mode. The output is by default within `.next` folder.
- This is used for the Node.js Vercel Deployments (Preview & Production)
- `npx turbo deploy` builds the Application on Export Production Mode. The output is by default within `build` folder.
- This is used for the Node.js Legacy Website Server (DigitalOcean)
- `npx turbo start` starts a web server running serving the built content from `npx turbo build`
</details>

<details>
Expand Down Expand Up @@ -186,7 +184,7 @@ We recommend a read on our [Collaborator Guide](COLLABORATOR_GUIDE.md#accepting-
- The person that is fast-tracking the PR (adding the label) must also comment on the PR that they're requesting the PR to be fast-tracked
- The comment must mention `@nodejs/website` and must have at least one 👍 (or any other sort of approval reaction) if the person fast-tracking the PR is the author of the PR.
- Fast-tracking is only allowed for small bug fixes, small feature changes, localisation changes, or other sorts of non-critical/highly-impacting changes that are not covered by the previous rule that allows PRs to be merged immediately.
- Fast-tracking cannot be used for updates on the `COLLABORATOR_GUIDE.md`, CONTRIBUTING.md` guide, `CODEOWNERS`, GitHub Actions or any security-impacting file or document that changes the governing policies of this repository.
- Fast-tracking cannot be used for updates on the `COLLABORATOR_GUIDE.md`, `CONTRIBUTING.md` guide, `CODEOWNERS`, GitHub Actions, or any security-impacting file or document that changes the governing policies of this repository.
- There must be no objections after a 48-hour period (Or 72 hours if the PR was authored on the weekend).
- At least one approval is required for any PR to be merged.
- Tests must be included in Pull Requests for new features or bug fixes. If any test(s) are failing, you are responsible for fixing them.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</p>

<p align="center">
<a href="https://nodejs.org">nodejs.org</a> website built using Nextra (Next.js) with TypeScript, SCSS and MDXv2
<a href="https://nodejs.org">nodejs.org</a> website built using Next.js with TypeScript, SCSS and MDXv2
</p>

<p align="center">
Expand All @@ -31,7 +31,7 @@

## What is this repo?

[Nodejs.org](https://nodejs.org/) by the [OpenJS Foundation](https://openjsf.org/) is the official website for the Node.js® JavaScript runtime. This repo is the source code for the website. It is build using [Nextra](https://nextra.site), a Next.js based static site generator.
[Nodejs.org](https://nodejs.org/) by the [OpenJS Foundation](https://openjsf.org/) is the official website for the Node.js® JavaScript runtime. This repo is the source code for the website. It is build using [Next.js](https://nextjs.org) a React Framework.

### Quick-Start Locally

Expand Down
21 changes: 21 additions & 0 deletions app/en/feed/[feed]/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { basename } from 'node:path';
import { NextResponse } from 'next/server';
import * as nextJson from '@/next.json.mjs';
import * as nextData from '@/next-data/index.mjs';

// loads all the data from the blog-posts-data.json file
const websiteFeeds = nextData.generateWebsiteFeeds(nextJson.blogData);

export async function GET(request: Request) {
const { pathname } = new URL(request.url);

const feed = basename(pathname);

if (websiteFeeds.has(feed)) {
return new NextResponse(websiteFeeds.get(feed)?.rss2(), {
headers: { 'Content-Type': 'application/xml' },
});
}

return new NextResponse(null, { status: 404 });
}
2 changes: 1 addition & 1 deletion components/Blog/BlogCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { FC } from 'react';
const getBlogCategoryUrl = (category: string): string =>
`${navigation.blog.link}/${category}/`;

type BlogCardProps = Omit<BlogPost, 'file'>;
type BlogCardProps = BlogPost & { readingTime: string };

const BlogCard: FC<BlogCardProps> = ({
title,
Expand Down
6 changes: 3 additions & 3 deletions components/Downloads/PrimaryDownloadMatrix.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import classNames from 'classnames';
import semVer from 'semver';
import LocalizedLink from '../LocalizedLink';
import { useDetectOS } from '../../hooks/useDetectOS';
import { useNextraContext } from '../../hooks/useNextraContext';
import { useLayoutContext } from '../../hooks/useLayoutContext';
import type { LegacyDownloadsFrontMatter, NodeRelease } from '../../types';
import type { FC } from 'react';

Expand All @@ -14,11 +14,11 @@ const PrimaryDownloadMatrix: FC<NodeRelease> = ({
isLts,
npm,
}) => {
const nextraContext = useNextraContext();
const { frontMatter } = useLayoutContext();

const { bitness } = useDetectOS();

const { downloads } = nextraContext.frontMatter as LegacyDownloadsFrontMatter;
const { downloads } = frontMatter as LegacyDownloadsFrontMatter;
const hasWindowsArm64 = semVer.satisfies(version, '>= 19.9.0');

const getIsVersionClassName = (isCurrent: boolean) =>
Expand Down
Loading