Skip to content

Commit

Permalink
Merge branch 'major/website-redesign' into feature-ApiChanges
Browse files Browse the repository at this point in the history
  • Loading branch information
vasanth9 committed May 20, 2023
2 parents 000dec1 + 8105e19 commit 94c3129
Show file tree
Hide file tree
Showing 85 changed files with 3,043 additions and 1,057 deletions.
17 changes: 13 additions & 4 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
build
.next
external
styles
node_modules

# Next.js & Vercel Directories
.next
.turbo
.swc
build

# Files that should not be parsed
CODEOWNERS
.eslintjscache
.eslintmdcache

# Legacy Public Files
public/en/user-survey-report
public/static/documents
public/static/legacy
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
enableCrossOsArchive: true

- name: Build Next.js
run: npx turbo build
run: npx turbo deploy
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
Expand All @@ -66,9 +66,6 @@ jobs:
key: build-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('node_modules/.cache') }}
enableCrossOsArchive: true

- name: Export Next.js static files
run: npx turbo export

- name: Upload Artifact
uses: actions/upload-pages-artifact@v1
with:
Expand Down
13 changes: 7 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
# Commonly ignored Node.js files
node_modules/
node_modules
npm-debug.log
.npm/
.npm

# OSX system files, the bane of our existence
.DS_Store
.AppleDouble
.LSOverride

# Next.js files
# Next.js Build Output
.next
build

# Next.js Generated Files
public/robots.txt
public/sitemap.xml
public/en/feed/*.xml
pages/en/blog/year-[0-9][0-9][0-9][0-9].md
Expand All @@ -26,8 +29,6 @@ coverage
# Storybook
storybook-static

# Vercel Config
# Vercel Files
.vercel

# TurboRepo
.turbo
17 changes: 13 additions & 4 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
build
.next
external
styles
node_modules

# Next.js & Vercel Directories
.next
.turbo
.swc
build

# Files that should not be parsed
CODEOWNERS
.eslintjscache
.eslintmdcache

# Legacy Public Files
public/en/user-survey-report
public/static/documents
public/static/legacy
Expand Down
1 change: 1 addition & 0 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const preview: Preview = {
basePath: '',
},
},
backgrounds: { disable: true },
},
};

Expand Down
3 changes: 3 additions & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Next.js files
.next
.turbo
.swc
build

# Public Folder
Expand Down
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Default rules

- @nodejs/website
* @nodejs/website

# Node.js Release Blog Posts

Expand Down
11 changes: 7 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ Thank you for your interest in contributing to the Node.js Website. Before you p

```bash
git clone git@github.com:<GITHUB_ID>/nodejs.org.git # SSH
gh repo clone <GITHUB_ID>/nodejs.org # GitHub CLI
git clone https://github.com/<GITHUB_ID>/nodejs.org.git # HTTPS
gh repo clone <GITHUB_ID>/nodejs.org # GitHub CLI
```

3. Change into the nodejs.org directory.
Expand All @@ -36,7 +36,9 @@ 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 git@github.com:nodejs/nodejs.org.git
git remote add upstream git@github.com: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.
Expand Down Expand Up @@ -85,8 +87,9 @@ npx turbo format

- `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.
- `npx turbo export` exports the website from the `.next` into a fully static website. The output is by default within `build` folder.
- This is what it's used to deploy the website on our current Node.js servers.
- 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`

#### Other CLI options
Expand Down
23 changes: 23 additions & 0 deletions components/Api/JsonLink/__snapshots__/index.stories.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Api/JsonLink Default smoke-test 1`] = `
<div class="JsonLink_json__0XIkR">
<a href="https://nodejs.org/docs/latest-v18.x/api/documentation.json">
<span>
View as JSON
</span>
<svg stroke="currentColor"
fill="currentColor"
stroke-width="0"
viewbox="0 0 640 512"
class="JsonLink_FaRobotIcon__KvHGw"
height="1em"
width="1em"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M32,224H64V416H32A31.96166,31.96166,0,0,1,0,384V256A31.96166,31.96166,0,0,1,32,224Zm512-48V448a64.06328,64.06328,0,0,1-64,64H160a64.06328,64.06328,0,0,1-64-64V176a79.974,79.974,0,0,1,80-80H288V32a32,32,0,0,1,64,0V96H464A79.974,79.974,0,0,1,544,176ZM264,256a40,40,0,1,0-40,40A39.997,39.997,0,0,0,264,256Zm-8,128H192v32h64Zm96,0H288v32h64ZM456,256a40,40,0,1,0-40,40A39.997,39.997,0,0,0,456,256Zm-8,128H384v32h64ZM640,256V384a31.96166,31.96166,0,0,1-32,32H576V224h32A31.96166,31.96166,0,0,1,640,256Z">
</path>
</svg>
</a>
</div>
`;
29 changes: 29 additions & 0 deletions components/Api/JsonLink/index.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.json {
display: flex;
flex-wrap: wrap;

a {
color: var(--color-text-secondary);
font-family: var(--sans-serif);
font-size: 1.4rem;
font-weight: var(--font-weight-regular);
margin-left: 0;
text-decoration: none !important;
text-transform: uppercase;
vertical-align: middle;

span {
font-weight: var(--font-weight-regular);
vertical-align: middle;
}

&:hover {
color: var(--brand-light);
}

.FaRobotIcon {
margin-left: 0.5rem;
vertical-align: middle;
}
}
}
14 changes: 14 additions & 0 deletions components/Api/JsonLink/index.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import JsonLink from './index';
import type { Meta as MetaObj, StoryObj } from '@storybook/react';

type Story = StoryObj<typeof JsonLink>;
type Meta = MetaObj<typeof JsonLink>;

export const Default: Story = {
args: {
version: 'v18',
fileName: 'documentation',
},
};

export default { component: JsonLink } as Meta;
22 changes: 22 additions & 0 deletions components/Api/JsonLink/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { FormattedMessage } from 'react-intl';
import { FaRobot } from 'react-icons/fa';
import styles from './index.module.scss';
import type { FC } from 'react';

type JsonLinkProps = {
fileName: string;
version: string;
};

const JsonLink: FC<JsonLinkProps> = ({ fileName, version }) => (
<div className={styles.json}>
<a
href={`https://nodejs.org/docs/latest-${version}.x/api/${fileName}.json`}
>
<FormattedMessage id="components.api.jsonLink.title" tagName="span" />
<FaRobot className={styles.FaRobotIcon} />
</a>
</div>
);

export default JsonLink;
10 changes: 10 additions & 0 deletions components/Api/SourceLink/__snapshots__/index.stories.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Api/SourceLink Default smoke-test 1`] = `
<p class="SourceLink_sourceLinkComponent__1vzdY">
Source Code:
<a href="https://github.com/nodejs/node/blob/1.0.0/http://nodejs.org/version/1.0.0">
http://nodejs.org/version/1.0.0
</a>
</p>
`;
5 changes: 5 additions & 0 deletions components/Api/SourceLink/index.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.sourceLinkComponent {
font-size: var(--font-size-body3);
font-weight: var(--font-weight-semibold);
text-transform: uppercase;
}
14 changes: 14 additions & 0 deletions components/Api/SourceLink/index.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import SourceLink from './index';
import type { Meta as MetaObj, StoryObj } from '@storybook/react';

type Story = StoryObj<typeof SourceLink>;
type Meta = MetaObj<typeof SourceLink>;

export const Default: Story = {
args: {
version: '1.0.0',
link: 'http://nodejs.org/version/1.0.0',
},
};

export default { component: SourceLink } as Meta;
20 changes: 20 additions & 0 deletions components/Api/SourceLink/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { FormattedMessage } from 'react-intl';

import styles from './index.module.scss';
import type { FC } from 'react';

type SourceLinkProps = {
link: string;
version: string;
};

const SourceLink: FC<SourceLinkProps> = ({ version, link }) => (
<p className={styles.sourceLinkComponent}>
<FormattedMessage id="components.api.sourceLink" />{' '}
<a href={`https://github.com/nodejs/node/blob/${version}/${link}`}>
{link}
</a>
</p>
);

export default SourceLink;
7 changes: 7 additions & 0 deletions components/Api/Stability/__snapshots__/index.stories.tsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Api/Stability Default smoke-test 1`] = `
<div class="Stability_stability__U0Zm0 Stability_stabilityLevel0__ygvXd">
Stability: 0 - This is an stability index example
</div>
`;
36 changes: 36 additions & 0 deletions components/Api/Stability/index.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
.stability {
border-radius: 4px;
color: #fff;
line-height: 1.5;
margin: 0 0 1rem;
padding: 1rem;

p {
display: inline;
margin: 0;
}

a {
color: #fff;

code {
color: #fff !important;
}
}

&Level0 {
background-color: var(--danger5);
}

&Level1 {
background-color: var(--warning4);
}

&Level2 {
background-color: var(--brand5);
}

&Level3 {
background-color: var(--info5);
}
}
24 changes: 24 additions & 0 deletions components/Api/Stability/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import Stability from './index';
import type { Meta as MetaObj, StoryObj } from '@storybook/react';

type Story = StoryObj<typeof Stability>;
type Meta = MetaObj<typeof Stability>;

export const Default: Story = {
args: {
stability: 0,
children: 'This is an stability index example',
},
argTypes: {
stability: {
control: {
type: 'range',
min: 0,
max: 3,
step: 1,
},
},
},
};

export default { component: Stability } as Meta;
23 changes: 23 additions & 0 deletions components/Api/Stability/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { FormattedMessage } from 'react-intl';
import styles from './index.module.scss';
import type { PropsWithChildren, FC } from 'react';

type StabilityProps = PropsWithChildren<{ stability: number }>;

const getStabilityClass = (stability: number) => {
const style = styles[`stabilityLevel${stability}`];
if (!style) throw new Error(`Unknown stability level: ${stability}`);
return style;
};

const Stability: FC<StabilityProps> = ({ stability, children }) => (
<div className={`${styles.stability} ${getStabilityClass(stability)}`}>
<FormattedMessage
id="components.api.stability"
values={{ level: stability }}
/>
{children}
</div>
);

export default Stability;

0 comments on commit 94c3129

Please sign in to comment.