Merge branch 'prepare-next' into migrate-to-next-web-17

This commit is contained in:
Marcus Blättermann 2022-12-20 17:50:56 +01:00
commit b4fc5a5c4c
No known key found for this signature in database
GPG Key ID: A1E1F04008AC450D
17 changed files with 19179 additions and 26917 deletions

3
website/.eslintrc.json Normal file
View File

@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}

39
website/.gitignore vendored Normal file
View File

@ -0,0 +1,39 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
# local env files
.env*.local
# vercel
.vercel
# typescript
*.tsbuildinfo
next-env.d.ts
!.vscode/extensions.json
!public

View File

@ -1 +1 @@
10
18

1
website/.prettierignore Normal file
View File

@ -0,0 +1 @@
.next

View File

@ -20,12 +20,11 @@
}
},
{
"files": "*.md",
"files": ["package.json", "package-lock.json"],
"options": {
"tabWidth": 2,
"tabWidth": 4,
"printWidth": 80,
"proseWrap": "always",
"htmlWhitespaceSensitivity": "strict"
"proseWrap": "always"
}
},
{

8
website/.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,8 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"unifiedjs.vscode-mdx",
"esbenp.prettier-vscode",
"syler.sass-indented"
]
}

View File

@ -0,0 +1,9 @@
const Layout = (args) => {
return (
<>
<div>{args.children}</div>
</>
)
}
export default Layout

View File

@ -0,0 +1,3 @@
const mdxComponents = {}
export default mdxComponents

29
website/next.config.mjs Normal file
View File

@ -0,0 +1,29 @@
import MDX from '@next/mdx'
import remarkPlugins from './plugins/index.mjs'
const withMDX = MDX({
extension: /\.mdx?$/,
options: {
remarkPlugins,
providerImportSource: '@mdx-js/react',
},
experimental: {
mdxRs: true,
},
})
/** @type {import('next').NextConfig} */
const nextConfig = withMDX({
reactStrictMode: true,
swcMinify: true,
pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'md', 'mdx'],
eslint: {
ignoreDuringBuilds: true,
},
typescript: {
ignoreBuildErrors: true,
},
})
export default nextConfig

45772
website/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,86 +1,30 @@
{
"name": "spacy-io",
"name": "next-blog",
"version": "0.1.0",
"private": true,
"description": "spaCy website",
"version": "3.0.0",
"author": "Explosion <contact@explosion.ai>",
"license": "MIT",
"dependencies": {
"@jupyterlab/outputarea": "^0.19.1",
"@jupyterlab/rendermime": "^0.19.1",
"@mdx-js/mdx": "^0.17.5",
"@mdx-js/tag": "^0.17.5",
"@phosphor/widgets": "^1.6.0",
"@rehooks/online-status": "^1.0.0",
"@svgr/webpack": "^4.1.0",
"autoprefixer": "^9.4.7",
"classnames": "^2.2.6",
"codemirror": "^5.43.0",
"gatsby": "^2.11.1",
"gatsby-image": "^2.0.29",
"gatsby-mdx": "^0.3.6",
"gatsby-plugin-catch-links": "^2.0.11",
"gatsby-plugin-manifest": "^2.0.17",
"gatsby-plugin-offline": "^2.0.24",
"gatsby-plugin-plausible": "0.0.6",
"gatsby-plugin-react-helmet": "^3.0.6",
"gatsby-plugin-react-svg": "^2.0.0",
"gatsby-plugin-robots-txt": "^1.5.1",
"gatsby-plugin-sass": "^2.0.10",
"gatsby-plugin-sharp": "^2.0.20",
"gatsby-plugin-sitemap": "^2.0.5",
"gatsby-plugin-svgr": "^2.0.1",
"gatsby-remark-copy-linked-files": "^2.0.9",
"gatsby-remark-find-replace": "^0.3.0",
"gatsby-remark-images": "^3.0.4",
"gatsby-remark-prismjs": "^3.2.4",
"gatsby-remark-smartypants": "^2.0.8",
"gatsby-remark-unwrap-images": "^1.0.1",
"gatsby-source-filesystem": "^2.0.24",
"gatsby-transformer-remark": "^2.2.5",
"gatsby-transformer-sharp": "^2.1.13",
"html-to-react": "^1.3.4",
"intersection-observer": "^0.5.1",
"jinja-to-js": "^3.2.3",
"node-sass": "^4.11.0",
"parse-numeric-range": "0.0.2",
"prismjs": "^1.15.0",
"prismjs-bibtex": "^1.1.0",
"prop-types": "^15.7.2",
"react": "^16.8.2",
"react-dom": "^16.8.2",
"react-github-btn": "^1.2.0",
"react-helmet": "^5.2.0",
"react-intersection-observer": "^8.0.1",
"remark-react": "^5.0.1"
},
"scripts": {
"build": "npm run python:install && npm run python:setup && gatsby build",
"dev": "npm run python:setup && gatsby develop",
"dev:nightly": "BRANCH=nightly.spacy.io npm run dev",
"dev:legacy": "SPACY_LEGACY=1 npm run dev",
"lint": "eslint **",
"clear": "rm -rf .cache",
"test": "echo \"Write tests! -> https://gatsby.app/unit-testing\"",
"python:install": "pip install -r setup/requirements.txt",
"python:setup": "cd setup && sh setup.sh"
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"prettier": "prettier . --write"
},
"devDependencies": {
"@sindresorhus/slugify": "^0.8.0",
"browser-monads": "^1.0.0",
"md-attr-parser": "^1.2.1",
"prettier": "^1.16.4",
"raw-loader": "^1.0.0",
"unist-util-visit": "^1.4.0"
"dependencies": {
"@mdx-js/loader": "^2.1.5",
"@mdx-js/react": "^2.1.5",
"@next/mdx": "^13.0.2",
"@types/node": "18.11.9",
"@types/react": "18.0.25",
"@types/react-dom": "18.0.8",
"eslint": "8.27.0",
"eslint-config-next": "13.0.2",
"next": "13.0.2",
"next-mdx-remote": "^4.2.0",
"prettier": "^2.7.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"sass": "^1.56.1",
"typescript": "4.8.4"
},
"repository": {
"type": "git",
"url": "https://github.com/explosion/spaCy"
},
"bugs": {
"url": "https://github.com/explosion/spaCy/issues"
},
"engines": {
"node": "10"
}
"engine": 18
}

View File

@ -0,0 +1,81 @@
import type { GetStaticPaths, GetStaticProps } from 'next'
import { serialize } from 'next-mdx-remote/serialize'
import fs from 'fs'
import { MDXRemote, MDXRemoteSerializeResult } from 'next-mdx-remote'
import path from 'path'
import Layout from '../components/layout'
import remarkPlugins from '../plugins/index.mjs'
type PropsPage = {
mdx: MDXRemoteSerializeResult
}
const PostPage = ({ mdx: mdx }: PropsPage) => {
return (
<Layout>
<MDXRemote {...mdx} />
</Layout>
)
}
export default PostPage
type ParsedUrlQuery = {
listPathPage: Array<string>
}
export const getStaticPaths: GetStaticPaths<ParsedUrlQuery> = async () => {
// This function needs to be defined inside `getStaticPath` to be executed in executed in the correct context
const loadFolder = (pathBase: Array<string> = []): Array<{ params: ParsedUrlQuery }> =>
fs
.readdirSync(path.join('docs', ...pathBase), { withFileTypes: true })
.flatMap((dirent: fs.Dirent) => {
if (dirent.isDirectory()) {
return loadFolder([...pathBase, dirent.name])
}
if (!dirent.name.includes('.mdx')) {
return []
}
return {
params: {
listPathPage:
dirent.name === 'index.mdx'
? pathBase
: [...pathBase, dirent.name.replace('.mdx', '')],
},
}
})
return {
paths: loadFolder(),
fallback: false,
}
}
const getPathFileWithExtension = (listPathFile: ReadonlyArray<string>) =>
`${path.join(...listPathFile)}.mdx`
export const getStaticProps: GetStaticProps<PropsPage, ParsedUrlQuery> = async (args) => {
if (!args.params) {
return { notFound: true }
}
const listPathFile = ['docs', ...args.params.listPathPage]
const isIndex = fs.existsSync(getPathFileWithExtension(listPathFile)) !== true
const listPathFileWithIndex = isIndex ? [...listPathFile, 'index'] : listPathFile
const listPathFileWithIndexAndExtension = getPathFileWithExtension(listPathFileWithIndex)
const mdx = await serialize(fs.readFileSync(listPathFileWithIndexAndExtension, 'utf-8'), {
parseFrontmatter: true,
mdxOptions: {
remarkPlugins,
},
})
return {
props: {
mdx,
},
}
}

11
website/pages/_app.tsx Normal file
View File

@ -0,0 +1,11 @@
import type { AppProps } from 'next/app'
import { MDXProvider } from '@mdx-js/react'
import mdxComponents from '../components/mdxComponents'
export default function App({ Component, pageProps }: AppProps) {
return (
<MDXProvider components={mdxComponents}>
<Component {...pageProps} />
</MDXProvider>
)
}

View File

@ -0,0 +1,3 @@
const remarkPlugins = []
export default remarkPlugins

BIN
website/public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -0,0 +1,4 @@
<svg width="283" height="64" viewBox="0 0 283 64" fill="none"
xmlns="http://www.w3.org/2000/svg">
<path d="M141.04 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.46 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM248.72 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.45 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM200.24 34c0 6 3.92 10 10 10 4.12 0 7.21-1.87 8.8-4.92l7.68 4.43c-3.18 5.3-9.14 8.49-16.48 8.49-11.05 0-19-7.2-19-18s7.96-18 19-18c7.34 0 13.29 3.19 16.48 8.49l-7.68 4.43c-1.59-3.05-4.68-4.92-8.8-4.92-6.07 0-10 4-10 10zm82.48-29v46h-9V5h9zM36.95 0L73.9 64H0L36.95 0zm92.38 5l-27.71 48L73.91 5H84.3l17.32 30 17.32-30h10.39zm58.91 12v9.69c-1-.29-2.06-.49-3.2-.49-5.81 0-10 4-10 10V51h-9V17h9v9.2c0-5.08 5.91-9.2 13.2-9.2z" fill="#000"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

20
website/tsconfig.json Normal file
View File

@ -0,0 +1,20 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}