Skip to content

Commit e178a3e

Browse files
author
Dimitri POSTOLOV
authored
extract theme as separate package @graphprotocol/theme (#336)
1 parent 29d307d commit e178a3e

35 files changed

+782
-648
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,4 @@ yarn-error.log*
4141

4242
*/public/sitemap*.xml
4343
.eslintcache
44+
dist/

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
.next
33
/out/
44
pnpm-lock.yaml
5+
dist/

.prettierrc

Lines changed: 0 additions & 6 deletions
This file was deleted.

package.json

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,29 @@
33
"private": true,
44
"packageManager": "[email protected]",
55
"scripts": {
6-
"dev": "pnpm --filter @graphprotocol/docs dev",
76
"build": "pnpm -r build",
8-
"start": "pnpm --filter @graphprotocol/docs start",
9-
"export": "pnpm --filter @graphprotocol/docs export",
10-
"lint": "pnpm typecheck && eslint --cache --ext .js,.jsx,.ts,.tsx,.mjs --max-warnings 0 . && pnpm prettier:check",
11-
"lint:fix": "pnpm typecheck && eslint --cache --ext .js,.jsx,.ts,.tsx,.mjs --fix . && pnpm prettier",
12-
"typecheck": "pnpm --filter @graphprotocol/docs typecheck",
13-
"prettier": "prettier . --loglevel warn --write",
14-
"prettier:check": "prettier . --loglevel warn --check",
7+
"dev": "pnpm --filter @graphprotocol/docs dev",
158
"docker:build": "DOCKER_BUILDKIT=1 docker build . -t docs --no-cache",
16-
"docker:up": "docker run --rm -it -p 3000:80 -v \"$(pwd)/nginx.conf:/etc/nginx/nginx.conf\" docs",
179
"docker:clean": "docker builder prune",
18-
"prepare": "husky install && chmod +x .husky/*",
10+
"docker:up": "docker run --rm -it -p 3000:80 -v \"$(pwd)/nginx.conf:/etc/nginx/nginx.conf\" docs",
11+
"export": "pnpm --filter @graphprotocol/docs export",
12+
"lint": "pnpm typecheck && eslint --ignore-path .gitignore --cache --ext .js,.jsx,.ts,.tsx,.mjs --max-warnings 0 . && pnpm prettier:check",
13+
"lint:fix": "pnpm typecheck && eslint --ignore-path .gitignore --cache --ext .js,.jsx,.ts,.tsx,.mjs --fix . && pnpm prettier",
1914
"pre-commit": "lint-staged --concurrent false",
20-
"pre-push": "pnpm build"
15+
"pre-push": "pnpm build",
16+
"prepare": "husky install && chmod +x .husky/*",
17+
"prettier": "prettier . --loglevel warn --write",
18+
"prettier:check": "prettier . --loglevel warn --check",
19+
"start": "pnpm --filter @graphprotocol/docs start",
20+
"typecheck": "pnpm --filter @graphprotocol/docs typecheck"
2121
},
2222
"devDependencies": {
2323
"@edgeandnode/eslint-config": "^1.3.1",
2424
"eslint": "^8.36.0",
2525
"husky": "^8.0.3",
2626
"lint-staged": "^13.2.0",
2727
"prettier": "^2.8.6",
28+
"prettier-plugin-pkg": "^0.17.1",
2829
"typescript": "5.0.2"
2930
},
3031
"lint-staged": {

packages/nextra-theme/package.json

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"name": "@graphprotocol/nextra-theme",
3+
"version": "0.0.0",
4+
"description": "A Nextra theme for The Graph documentation sites.",
5+
"exports": {
6+
".": {
7+
"import": "./dist/index.js",
8+
"types": "./dist/index.d.ts"
9+
}
10+
},
11+
"types": "./dist/index.d.ts",
12+
"typesVersions": {
13+
"*": {
14+
".": [
15+
"./dist/index.d.ts"
16+
]
17+
}
18+
},
19+
"files": [
20+
"dist"
21+
],
22+
"scripts": {
23+
"build": "tsup"
24+
},
25+
"peerDependencies": {
26+
"@edgeandnode/components": "^27.4.1",
27+
"@emotion/react": "^11.10.6",
28+
"next": "^13.2.4",
29+
"next-seo": "^5.15.0",
30+
"nextra": "^2.3.0",
31+
"react-dom": "^18.2.0",
32+
"theme-ui": "^0.15.5"
33+
},
34+
"dependencies": {
35+
"@docsearch/react": "^3.3.3",
36+
"@radix-ui/react-collapsible": "1.0.2",
37+
"@radix-ui/react-visually-hidden": "^1.0.2",
38+
"lodash": "^4.17.21",
39+
"prism-react-renderer": "^1.3.5",
40+
"react-intersection-observer": "^9.4.3",
41+
"react-use": "^17.4.0"
42+
},
43+
"devDependencies": {
44+
"@edgeandnode/components": "^27.4.1",
45+
"@emotion/react": "^11.10.6",
46+
"@types/lodash": "^4.14.191",
47+
"@types/react": "^18.0.28",
48+
"@types/react-dom": "^18.0.11",
49+
"next": "^13.2.4",
50+
"next-seo": "^5.15.0",
51+
"nextra": "2.3.0",
52+
"react": "18.2.0",
53+
"react-dom": "^18.2.0",
54+
"theme-ui": "^0.15.5",
55+
"tsup": "6.7.0"
56+
},
57+
"sideEffects": false
58+
}

website/components/Difficulty.tsx renamed to packages/nextra-theme/src/components/Difficulty.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { useI18n } from '@/i18n'
1+
import { useI18n } from '@edgeandnode/components'
22

33
// TODO: Refactor this component
44
export const Difficulty = ({ level }: { level: string }) => {
5-
const { t } = useI18n()
5+
const { t } = useI18n<any>()
66

77
return (
88
<div

website/components/EditPageLink.tsx renamed to packages/nextra-theme/src/components/EditPageLink.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
11
import { HTMLAttributes, useContext } from 'react'
22

3-
import { BorderRadius, buildShadow, buildTransition, Flex, Icon, Opacity, Spacing, Text } from '@edgeandnode/components'
3+
import {
4+
BorderRadius,
5+
buildShadow,
6+
buildTransition,
7+
Flex,
8+
Icon,
9+
Opacity,
10+
Spacing,
11+
Text,
12+
useI18n,
13+
} from '@edgeandnode/components'
414

515
import { Link } from '@/components'
6-
import { useI18n } from '@/i18n'
716
import { NavContext } from '@/layout/NavContext'
817

918
export type EditPageLinkProps = {
1019
mobile?: boolean
1120
} & Omit<HTMLAttributes<HTMLElement>, 'children'>
1221

1322
export const EditPageLink = ({ mobile = false, ...props }: EditPageLinkProps) => {
14-
const { t } = useI18n()
23+
const { t } = useI18n<any>()
1524

1625
// If the current page is in a language other than English, link to the English version, as translations are handled by Crowdin
1726
const { filePath } = useContext(NavContext)!

0 commit comments

Comments
 (0)