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: setup website for docs #97

Merged
merged 16 commits into from
Sep 1, 2021
33 changes: 33 additions & 0 deletions .github/workflows/docs-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: docs-pr

on:
pull_request:
paths:
- docs/**

defaults:
run:
working-directory: docs

jobs:
prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Install Dependencies
run: yarn --frozen-lockfile
- run: yarn -s format:check

eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Install Dependencies
run: yarn --frozen-lockfile
- run: yarn -s lint:check
23 changes: 23 additions & 0 deletions .github/workflows/docs-trunk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: docs-trunk

on:
push:
branches: [main]

defaults:
run:
working-directory: docs

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 16.x
- run: yarn --frozen-lockfile
- run: yarn -s build
- run: yarn -s export
- run: gh-pages --dist=out
24 changes: 24 additions & 0 deletions docs/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": ["tsconfig.json", "tests/tsconfig.json"]
},
"plugins": ["@typescript-eslint", "only-warn"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"prettier"
],
"overrides": [],
"rules": {
// They are great actually
"@typescript-eslint/no-namespace": "off",
// TypeScript makes these safe & effective
"no-case-declarations": "off",
// Same approach used by TypeScript noUnusedLocals
"@typescript-eslint/no-unused-vars": ["warn", { "varsIgnorePattern": "^_", "argsIgnorePattern": "^_" }]
}
}
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
out/
2 changes: 2 additions & 0 deletions docs/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.next/
out/
3 changes: 3 additions & 0 deletions docs/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
...require('@prisma-labs/prettier-config'),
}
3 changes: 3 additions & 0 deletions docs/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />
26 changes: 26 additions & 0 deletions docs/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* eslint-disable */

const remarkGfm = require('remark-gfm')
const withNextra = require('nextra')

module.exports = withNextra('nextra-theme-docs', './theme.config.js')(withRemarkGFM())

/**
* Use Remark GFM in MDX Webpack Loader.
* Can be removed once shuding/nextra#184 is released.
*
* @returns {import('next').NextConfig}
* @see https://github.com/shuding/nextra/pull/184/
*/
function withRemarkGFM() {
return {
webpack(config, options) {
const markdownRule = config.module.rules.find((rule) => rule.test?.toString() === '/\\.mdx?$/')
const mdxLoaderConfig = markdownRule.use.find(({ loader }) => loader === '@mdx-js/loader')
mdxLoaderConfig.options = {
remarkPlugins: [remarkGfm],
}
return config
},
}
}
29 changes: 24 additions & 5 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,34 @@
"author": "Prisma Data Inc.",
"license": "MIT",
"scripts": {
"dev": "next",
"start": "next start",
"build": "next build"
"dev": "next dev",
"build": "next build",
"export": "next export",
"format": "prettier --write .",
"format:check": "prettier --check .",
"lint": "eslint . --ext .ts,.tsx --fix",
"lint:check": "eslint . --ext .ts,.tsx --max-warnings 0"
},
"dependencies": {
"next": "^11.1.0",
"next": "^11.1.2",
"nextra": "^1.1.0",
"nextra-theme-docs": "^1.2.6",
"react": "^17.0.2",
"react-dom": "^17.0.2"
"react-dom": "^17.0.2",
"remark-gfm": "^1.0.0"
},
"prettier": "@prisma-labs/prettier-config",
"devDependencies": {
"@prisma-labs/prettier-config": "^0.1.0",
"@types/react": "^17.0.14",
"@typescript-eslint/eslint-plugin": "^4.28.0",
"@typescript-eslint/parser": "^4.28.0",
"eslint": "^7.29.0",
"eslint-config-next": "^11.0.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-only-warn": "^1.0.2",
"gh-pages": "^3.2.3",
"prettier": "^2.3.2",
"typescript": "^4.3.5"
}
}
10 changes: 10 additions & 0 deletions docs/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { FC } from 'react'
import { AppProps } from 'next/app'
import 'nextra-theme-docs/style.css'

const App: FC<AppProps> = ({ Component, pageProps }) => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return <Component {...pageProps} />
}

export default App
Loading