Skip to content

Commit

Permalink
format imports, package.json fields with prettier (#1902)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimaMachina committed May 24, 2023
1 parent 86b8bcc commit 2bdb7f9
Show file tree
Hide file tree
Showing 220 changed files with 3,611 additions and 2,079 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/nextjs-bundle-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ jobs:
# entry in your package.json file.
- name: Compare with Base Branch Bundle
if: success() && github.event.number
run: ls -laR examples/swr-site/.next/analyze/base && cd examples/swr-site && npx -p nextjs-bundle-analysis compare
run:
ls -laR examples/swr-site/.next/analyze/base && cd examples/swr-site
&& npx -p nextjs-bundle-analysis compare

- name: Get Comment Body
id: get-comment-body
Expand Down
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ pnpm-lock.yaml
packages/nextra-theme-blog/style.css
packages/nextra-theme-docs/style.css

# process.env assignement should be first
packages/nextra/__test__/locale-with-base-path.test.ts

# bellow files are broken since prettier doesn't support MDX2
examples/swr-site/pages/remote/graphql-eslint/\[\[...slug\]\].mdx
docs/pages/docs/blog-theme/start.mdx
Expand Down
37 changes: 18 additions & 19 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
nationality, personal appearance, race, religion, or sexual identity and
orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
Expand All @@ -22,17 +22,17 @@ community include:
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
- Focusing on what is best not just for us as individuals, but for the
overall community
- Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior include:

- The use of sexualized language or imagery, and sexual attention or
advances of any kind
- The use of sexualized language or imagery, and sexual attention or advances of
any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
- Publishing others' private information, such as a physical or email address,
without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

Expand All @@ -59,9 +59,8 @@ representative at an online or offline event.
## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
g@shud.in.
All complaints will be reviewed and investigated promptly and fairly.
reported to the community leaders responsible for enforcement at g@shud.in. All
complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
Expand All @@ -82,15 +81,15 @@ behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series
of actions.
**Community Impact**: A violation through a single incident or series of
actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
like social media. Violating these terms may lead to a temporary or permanent
ban.

### 3. Temporary Ban

Expand All @@ -109,17 +108,17 @@ Violating these terms may lead to a permanent ban.
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
the community.
**Consequence**: A permanent ban from any sort of public interaction within the
community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

Expand Down
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Nextra

Simple, powerful and flexible site generation framework with everything you love from Next.js.
Simple, powerful and flexible site generation framework with everything you love
from Next.js.

## Documentation

Expand All @@ -10,7 +11,9 @@ Simple, powerful and flexible site generation framework with everything you love

### Installation

The Nextra repository uses [PNPM Workspaces](https://pnpm.io/workspaces) and [Turborepo](https://github.com/vercel/turborepo). To install dependencies, run `pnpm install` in the project root directory.
The Nextra repository uses [PNPM Workspaces](https://pnpm.io/workspaces) and
[Turborepo](https://github.com/vercel/turborepo). To install dependencies, run
`pnpm install` in the project root directory.

### Build Nextra Core

Expand All @@ -36,7 +39,8 @@ pnpm build

### Development

You can also debug them together with a website locally. For instance, to start examples/docs locally, run
You can also debug them together with a website locally. For instance, to start
examples/docs locally, run

```bash
cd examples/docs
Expand All @@ -45,4 +49,5 @@ pnpm dev

Any change to example/docs will be re-rendered instantly.

If you update the core or theme packages, a rebuild is required. Or you can use the watch mode for both nextra and the theme in separated terminals.
If you update the core or theme packages, a rebuild is required. Or you can use
the watch mode for both nextra and the theme in separated terminals.
5 changes: 2 additions & 3 deletions docs/components/features/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type { ReactNode } from 'react'
import Link from 'next/link'
import cn from 'clsx'
import { motion } from 'framer-motion'

import Link from 'next/link'
import type { ReactNode } from 'react'
import styles from './style.module.css'

export function Feature({
Expand Down
8 changes: 4 additions & 4 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "docs",
"author": "Shu Ding",
"license": "MIT",
"private": true,
"scripts": {
"build": "next build",
"dev": "next",
"start": "next start",
"build": "next build"
"start": "next start"
},
"author": "Shu Ding",
"license": "MIT",
"dependencies": {
"@vercel/og": "^0.5.0",
"clsx": "^1.2.1",
Expand Down
17 changes: 14 additions & 3 deletions docs/pages/about.mdx
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
# About Nextra

Nextra was initially created by [Vercel](https://vercel.com) members [Shu Ding](https://twitter.com/shuding_) and [Paco Coursey](https://twitter.com/pacocoursey) in 2020. Since 2021, [Yixuan Xu](https://twitter.com/yixuanxu94) contributed tremendously to the project. In 2022, [Dimitri Postolov](https://twitter.com/B2o5T) from [The Guild](https://the-guild.dev) joined the core team to help with the development of 2.0.
Nextra was initially created by [Vercel](https://vercel.com) members
[Shu Ding](https://twitter.com/shuding_) and
[Paco Coursey](https://twitter.com/pacocoursey) in 2020. Since 2021,
[Yixuan Xu](https://twitter.com/yixuanxu94) contributed tremendously to the
project. In 2022, [Dimitri Postolov](https://twitter.com/B2o5T) from
[The Guild](https://the-guild.dev) joined the core team to help with the
development of 2.0.

## Team

Currently, the project is maintained by [Shu Ding](https://twitter.com/shuding_) and [Dimitri Postolov](https://twitter.com/B2o5T). You can check out the full list of contributors on [GitHub](https://github.com/shuding/nextra/graphs/contributors).
Currently, the project is maintained by [Shu Ding](https://twitter.com/shuding_)
and [Dimitri Postolov](https://twitter.com/B2o5T). You can check out the full
list of contributors on
[GitHub](https://github.com/shuding/nextra/graphs/contributors).

## Credits

Expand All @@ -27,7 +36,9 @@ Nextra is powered by these incredible open source projects:

## Design Assets

Feel free to use the Nextra logo and other assets in your project. But please don't modify the logo, and don't use the logo to represent your project or product.
Feel free to use the Nextra logo and other assets in your project. But please
don't modify the logo, and don't use the logo to represent your project or
product.

| Name | Description | Preview |
| :---------: | :----------------------------------------------: | :--------------------------: |
Expand Down
43 changes: 28 additions & 15 deletions docs/pages/docs/custom-theme.mdx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { Callout, Steps } from 'nextra-theme-docs'
import { Screenshot } from 'components/screenshot'
import { Callout, Steps } from 'nextra-theme-docs'

# Custom Theme

A theme in Nextra works like a layout, that will be rendered as a wrapper for all pages.
This docs will walk you through the process of creating a custom theme.
A theme in Nextra works like a layout, that will be rendered as a wrapper for
all pages. This docs will walk you through the process of creating a custom
theme.

Optionally, you can deploy an example and build further on it by following the below steps:
Optionally, you can deploy an example and build further on it by following the
below steps:

[![](https://vercel.com/button)](https://vercel.com/new/clone?s=https%3A%2F%2Fgithub.com%2Fshuding%2Fnextra-example&showOptionalTeamCreation=false)

Expand All @@ -15,8 +17,9 @@ Optionally, you can deploy an example and build further on it by following the b
<Steps>
### Configure Nextra to Use the Theme

First, you need to tell Nextra to use your custom theme file instead of official ones.
In your Next.js config, you can pass the path to your theme file to the Nextra plugin:
First, you need to tell Nextra to use your custom theme file instead of official
ones. In your Next.js config, you can pass the path to your theme file to the
Nextra plugin:

```js {2} filename="next.config.js"
const withNextra = require('nextra')({
Expand All @@ -31,7 +34,8 @@ module.exports = withNextra({

### Create a Basic Theme

You can now start working on your theme! In your root directory, create the corresponding `theme.tsx` file with basic content:
You can now start working on your theme! In your root directory, create the
corresponding `theme.tsx` file with basic content:

```tsx filename="theme.tsx" /children/
import type { NextraThemeLayoutProps } from 'nextra'
Expand All @@ -46,20 +50,24 @@ export default function Layout({ children }: NextraThemeLayoutProps) {
}
```

It accepts a `children` prop, which is the MDX content of the current page, and wraps some other elements around the content.
After creating the theme, you can simply add a MDX file as `pages/index.mdx` and see the result:
It accepts a `children` prop, which is the MDX content of the current page, and
wraps some other elements around the content. After creating the theme, you can
simply add a MDX file as `pages/index.mdx` and see the result:

import customThemeImage from '../../public/assets/docs/custom-theme.png'

<Screenshot src={customThemeImage} alt="Custom theme" />

<br />

Inside your theme layout, you can use CSS imports or other ways to style it. Next.js hooks such as `useRouter`, `Head` are also available.
Inside your theme layout, you can use CSS imports or other ways to style it.
Next.js hooks such as `useRouter`, `Head` are also available.

### Render Metadata for the Active Page

Other than `children`, some other useful props are passed to the theme layout too. With the `pageOpts` props, the theme can access the page’s meta information.
Other than `children`, some other useful props are passed to the theme layout
too. With the `pageOpts` props, the theme can access the page’s meta
information.

For example, let’s implement these features:

Expand All @@ -68,8 +76,8 @@ For example, let’s implement these features:
- Add a meta tag for `og:image` via the front matter

```tsx filename="theme.tsx" /pageOpts/
import type { NextraThemeLayoutProps } from 'nextra'
import Head from 'next/head'
import type { NextraThemeLayoutProps } from 'nextra'

export default function Layout({ children, pageOpts }: NextraThemeLayoutProps) {
const { title, frontMatter, headings } = pageOpts
Expand All @@ -95,9 +103,12 @@ export default function Layout({ children, pageOpts }: NextraThemeLayoutProps) {

### Use Page Map of the Entire Site

Now, if you want to render something like a sidebar or a navigation bar, which relies on information of not only the current page but also other pages, you can use the `pageMap` value.
Now, if you want to render something like a sidebar or a navigation bar, which
relies on information of not only the current page but also other pages, you can
use the `pageMap` value.

For example, we can render a simple navigation list with all the pages in the top level:
For example, we can render a simple navigation list with all the pages in the
top level:

```tsx filename="theme.tsx" /pageMap/
import Link from 'next/link'
Expand Down Expand Up @@ -125,7 +136,9 @@ export default function Layout({ children, pageOpts }: NextraThemeLayoutProps) {
}
```

There are other item kinds such as `Folder` (for directories) and `Meta` (for `_meta.json` files). All the items are typed so you can easily know the properties.
There are other item kinds such as `Folder` (for directories) and `Meta` (for
`_meta.json` files). All the items are typed so you can easily know the
properties.

</Steps>

Expand Down
3 changes: 2 additions & 1 deletion docs/pages/docs/docs-theme/built-ins.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import { Card, Cards } from 'nextra-theme-docs'

The Docs Theme includes a couple of built-in components that you can use to better style your documentation:
The Docs Theme includes a couple of built-in components that you can use to
better style your documentation:

<Cards>
<Card
Expand Down
6 changes: 4 additions & 2 deletions docs/pages/docs/docs-theme/built-ins/steps.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { Steps } from 'nextra-theme-docs'

# Step Component

A built-in component of the Docs Theme to turn a numbered list into a visual representation of steps.
A built-in component of the Docs Theme to turn a numbered list into a visual
representation of steps.

## Example

Expand All @@ -23,7 +24,8 @@ This is the third step description.

## Usage

Wrap a set of markdown h3 headings with the `Steps` component to turn them into visual steps.
Wrap a set of markdown h3 headings with the `Steps` component to turn them into
visual steps.

<Steps>

Expand Down

1 comment on commit 2bdb7f9

@vercel
Copy link

@vercel vercel bot commented on 2bdb7f9 May 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.