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

chore: add formatter #82

Closed
wants to merge 1 commit into from
Closed
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
22 changes: 11 additions & 11 deletions .github/actions/build-docs/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ name: Build Docs
description: Build docs pages inside /docs directory

runs:
using: 'composite'
steps:
- name: Install dependencies
run: bun install
shell: bash
using: "composite"
steps:
- name: Install dependencies
run: bun install
shell: bash

- name: Build with Next.js
run: bun next build
shell: bash
- name: Build with Next.js
run: bun next build
shell: bash

- name: Export static HTML with Next.js
run: bun next export
shell: bash
- name: Export static HTML with Next.js
run: bun next export
shell: bash
16 changes: 16 additions & 0 deletions .github/actions/lint/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Lint codebase
description: Run biome to lint codebase and ensure code quality

runs:
using: "composite"
steps:
- name: Install dependencies
run: bun install
shell: bash

- name: Setup Biome CLI
uses: biomejs/setup-biome@v2.2.1

- name: Run biome
run: biome ci --reporter=github
shell: bash
21 changes: 11 additions & 10 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
name: Validate merge requests

on:
pull_request:
branches:
- main
pull_request:
branches:
- main

jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- uses: ./.github/actions/build-docs
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- uses: ./.github/actions/lint
- uses: ./.github/actions/build-docs
2 changes: 1 addition & 1 deletion .github/workflows/nextjs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ permissions:

# Allow one concurrent deployment
concurrency:
group: 'pages'
group: "pages"
cancel-in-progress: true

jobs:
Expand Down
11 changes: 11 additions & 0 deletions .zed/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"formatter": {
"language_server": {
"name": "biome"
}
},
"code_actions_on_format": {
"source.fixAll.biome": true,
"source.organizeImports.biome": true
}
}
42 changes: 42 additions & 0 deletions biome.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": true },
"files": {
"ignoreUnknown": true
},
"organizeImports": { "enabled": true },
"formatter": {
"enabled": true,
"indentStyle": "space",
"ignore": ["**/package.json"]
},
"css": { "formatter": { "quoteStyle": "single" } },
"linter": {
"enabled": true,
"rules": {
"a11y": {
"all": false
},
"suspicious": {
"noExplicitAny": "off",
"noAssignInExpressions": "off",
"noConfusingVoidType": "off"
},
"style": {
"noNonNullAssertion": "off",
"noParameterAssign": "info",
"noCommaOperator": "info"
},
"complexity": {
"noForEach": "off",
"noBannedTypes": "off"
},
"performance": {
"noDelete": "off"
},
"correctness": {
"noUnusedImports": "error"
}
}
}
}
Binary file modified bun.lockb
Binary file not shown.
4 changes: 1 addition & 3 deletions components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import styles from "../styles/Layout.module.css";
export default function Footer() {
return (
<footer className={styles.footer}>
<span>
Maintained by the OpenNext community
</span>
<span>Maintained by the OpenNext community</span>
<div>
<a target="_blank" href={SITE.github} rel="noopener noreferrer">
GitHub
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
"lint": "biome check",
"lint:fix": "biome check --fix"
},
"dependencies": {
"@types/node": "18.11.9",
Expand All @@ -18,5 +19,8 @@
"react": "18.2.0",
"react-dom": "18.2.0",
"typescript": "4.9.3"
},
"devDependencies": {
"@biomejs/biome": "^1.9.4"
}
}
2 changes: 1 addition & 1 deletion pages/aws/config/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
"full_example": "Full Example",
"nx": "Nx Monorepo",
"overrides": "Overrides"
}
}
2 changes: 1 addition & 1 deletion pages/aws/config/overrides/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
"origin_resolver": "Origin Resolver",
"invoke_function": "Invoke Function for the warmer",
"automatic_cdn_invalidation": "Automatic CDN Invalidation"
}
}
2 changes: 1 addition & 1 deletion pages/aws/contribute/_meta.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"local_run": "Run locally",
"plugin": "Internal plugin system"
}
}
2 changes: 1 addition & 1 deletion pages/aws/inner_workings/components/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"revalidation": "Revalidation",
"warmer": "Warmer",
"initializer": "Initializer"
}
}
2 changes: 1 addition & 1 deletion pages/aws/v2/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"common_issues": "Troubleshooting",
"inner_workings": "Inner Workings",
"advanced": "Advanced"
}
}
2 changes: 1 addition & 1 deletion pages/aws/v2/advanced/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"workaround": "Workaround",
"debugging": "Debugging",
"contribute": "Contribute"
}
}
2 changes: 1 addition & 1 deletion pages/cloudflare/0.2/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"bindings": "",
"caching": "",
"examples": ""
}
}
16 changes: 10 additions & 6 deletions pages/cloudflare/caching.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SITE } from '../../config';
import { Callout } from 'nextra/components';
import { SITE } from "../../config";
import { Callout } from "nextra/components";

## Caching

Expand All @@ -12,7 +12,9 @@ By default, all `fetch()` subrequests made in your Next.js app are cached. Refer
Next.js primes the cache at build time. The build time values are serverd by the [Workers Assets](https://developers.cloudflare.com/workers/static-assets/).

<Callout>
Workers KV is eventually consistent, which means that it can take up to 60 seconds for updates to be reflected globally, when using the default TTL of 60 seconds.
Workers KV is eventually consistent, which means that it can take up to 60
seconds for updates to be reflected globally, when using the default TTL of 60
seconds.
</Callout>

### How to enable caching
Expand Down Expand Up @@ -71,9 +73,10 @@ const config: OpenNextConfig = {
export default config;
```


<Callout>
The `direct` mode for the queue is intended for debugging purposes and is not recommended for use in production. We are actively working on a solution that will be suitable for production.
The `direct` mode for the queue is intended for debugging purposes and is not
recommended for use in production. We are actively working on a solution that
will be suitable for production.
</Callout>

#### On-Demand Revalidation
Expand All @@ -83,7 +86,8 @@ The tag revalidation mechanism uses a [Cloudflare D1](https://developers.cloudfl
To use on-demand revalidation, you should also follow the [ISR setup steps](#incremental-static-regeneration-isr).

<Callout>
If your app **only** uses the pages router, it does not need to have a tag cache and should skip this step.
If your app **only** uses the pages router, it does not need to have a tag
cache and should skip this step.
</Callout>

##### 1. Create a D1 database
Expand Down
5 changes: 2 additions & 3 deletions theme.config.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SITE } from "./config";
import { useConfig } from "nextra-theme-docs";
import { SITE } from "./config";

import Footer from "./components/Footer";
import Logo from "./components/Logo.svg";
Expand Down Expand Up @@ -38,8 +38,7 @@ export default {
},
],
titleTemplate: "%s - OpenNext",
description:
frontMatter.description || "Open-source Next.js adapters",
description: frontMatter.description || "Open-source Next.js adapters",
openGraph: {
titleTemplate: "%s - OpenNext",
images: [
Expand Down
14 changes: 4 additions & 10 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
Expand All @@ -23,10 +19,8 @@
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
"pages/index.mdx",
"theme.config.jsx"
"pages/index.mdx",
"theme.config.jsx"
],
"exclude": [
"node_modules"
]
"exclude": ["node_modules"]
}
Loading