Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 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
11 changes: 11 additions & 0 deletions .github/workflows/ci-cd-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ jobs:
- name: Checkout the repo
uses: actions/checkout@v3

- name: Set up pnpm
uses: pnpm/action-setup@v2
with:
version: 7.28.0

- name: Install dependencies
run: pnpm install

- name: Lint
run: pnpm lint

- name: Build Docker image
uses: docker/build-push-action@v4
with:
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
"build": "pnpm -r build",
"start": "pnpm --filter @graphprotocol/docs start",
"export": "pnpm --filter @graphprotocol/docs export",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx,.mjs && pnpm prettier:check && pnpm typecheck",
"lint:fix": "eslint . --fix --ext .js,.jsx,.ts,.tsx,.mjs && pnpm prettier && pnpm typecheck",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx,.mjs; pnpm prettier:check; pnpm typecheck",
"lint:fix": "eslint . --fix --ext .js,.jsx,.ts,.tsx,.mjs; pnpm prettier; pnpm typecheck",
Copy link
Contributor

Choose a reason for hiding this comment

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

@benface we should use && instead, otherwise, it's not fails if some command fails, e.g. eslint --max-warnings 0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yeah, oops. I guess I just find it annoying that if e.g. Prettier fails, the TS errors are not even shown. Maybe Prettier should be last?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, I guess the following commands typecheck -> eslint -> prettier will be better

"prettier": "prettier . --write",
"prettier:check": "prettier . --check",
"typecheck": "tsc --noEmit",
"typecheck": "pnpm --filter @graphprotocol/docs typecheck",
"docker:build": "DOCKER_BUILDKIT=1 docker build . -t docs --no-cache",
"docker:up": "docker run --rm -it -p 3000:80 -v \"$(pwd)/nginx.conf:/etc/nginx/nginx.conf\" docs",
"docker:clean": "docker builder prune",
Expand Down
File renamed without changes.
11 changes: 8 additions & 3 deletions website/components/DocSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ export function DocSearch(props: DocSearchProps) {
content: `''`,
zIndex: 100,
position: 'absolute',
insetInline: Spacing['24px'],
left: Spacing['24px'],
right: Spacing['24px'],
bottom: '-1px',
borderBottom: buildBorder('White16')(theme),
backgroundColor: 'var(--docsearch-modal-background)',
Expand Down Expand Up @@ -242,14 +243,18 @@ export function DocSearch(props: DocSearchProps) {
'.DocSearch-Footer': {
position: 'fixed',
bottom: 0,
insetInline: 0,
left: 0,
right: 0,
padding: Spacing['16px'],
backgroundColor: 'transparent',
boxShadow: 'none',
'&::before': {
content: `''`,
position: 'absolute',
inset: 0,
left: 0,
right: 0,
top: 0,
bottom: 0,
backgroundColor: 'var(--docsearch-modal-background)',
opacity: Opacity['88%'],
[`@media (min-width: ${BREAKPOINT})`]: {
Expand Down
4 changes: 2 additions & 2 deletions website/components/EditPageLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ export const EditPageLink = ({ mobile = false, ...props }: EditPageLinkProps) =>
// If the current page is in a language other than English, link to the English version, as translations are handled by Crowdin
const { pagePath: _pagePath } = useContext(NavContext)!
const pagePathSegments = _pagePath.split('/')
pagePathSegments[0] = ['en', '[locale]'].includes(pagePathSegments[0]) ? pagePathSegments[0] : 'en'
pagePathSegments[1] = ['en', '[locale]'].includes(pagePathSegments[1]) ? pagePathSegments[1] : 'en'
const pagePath = pagePathSegments.join('/')

return (
<Link
href={`https://github.com/graphprotocol/docs/blob/main/pages/${pagePath}`}
href={`https://github.com/graphprotocol/docs/blob/main/website/${pagePath}`}
Copy link
Contributor

Choose a reason for hiding this comment

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

nice catch for edit on github, forget to test it

target="_blank"
sx={{
display: 'block',
Expand Down
2 changes: 2 additions & 0 deletions website/components/NavTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ const NavTreeItem = ({
size="12px"
sx={{
position: 'absolute',
left: Spacing['4px'],
insetInlineStart: Spacing['4px'],
insetInlineEnd: 'auto',
top: 0,
bottom: 0,
my: 'auto',
Expand Down
5 changes: 3 additions & 2 deletions website/components/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,13 @@ const MyApp = ({ Component, pageProps }: AppProps) => {
token: process.env.MIXPANEL_TOKEN ?? null,
}}
>
<div sx={{ position: 'absolute', inset: 0, overflow: 'hidden' }}>
<div sx={{ position: 'absolute', left: 0, right: 0, top: 0, bottom: 0, overflow: 'hidden' }}>
<div
sx={{
position: 'absolute',
top: 0,
insetInline: 0,
left: 0,
right: 0,
minHeight: '768px',
backgroundImage: `url('${process.env.BASE_PATH}/img/page-background.png')`,
backgroundSize: 'cover',
Expand Down
2 changes: 1 addition & 1 deletion website/layout/MDXLayoutNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export const MDXLayoutNav = ({ mobile = false }: { mobile?: boolean }) => {
active={currentPage?.path === navItem.path}
sx={mobile ? { py: 0 } : {}}
linkProps={{ sx: mobile ? {} : { paddingInlineEnd: 0 } }}
diamondProps={{ sx: mobile ? { insetInlineStart: '6px' } : {} }}
diamondProps={{ sx: mobile ? { left: '6px', insetInlineStart: '6px', insetInlineEnd: 'auto' } : {} }}
>
{navItem.title}
</NavTree.Item>
Expand Down
2 changes: 1 addition & 1 deletion website/next-sitemap.config.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @type {import('next-sitemap').IConfig} */
module.exports = {
siteUrl: process.env.SITE_URL || 'https://thegraph.com/docs/',
siteUrl: process.env.SITE_URL,
generateIndexSitemap: false,
}
2 changes: 1 addition & 1 deletion website/pages/[locale]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const Index: NextPage<IndexProps> = ({ navItems }: IndexProps) => {
<MDXLayout
// @ts-expect-error: we don't need another properties
pageOpts={{
filePath: `[locale]/index.tsx`,
filePath: `pages/[locale]/index.tsx`,
frontMatter: frontmatter(locale as AppLocale),
headings,
}}
Expand Down
5 changes: 2 additions & 3 deletions website/pages/_app.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{/* _app.mdx is not typesafe but _app.tsx is.
_app.mdx is used in nextra for better performance and smallest bundle size.
*/}
{/* _app.mdx is not typesafe but _app.tsx is. */}
{/* _app.mdx is used in nextra for better performance and smallest bundle size. */}

export { default } from '../components/_app'
3 changes: 2 additions & 1 deletion website/scripts/sitemap-ci.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ async function main() {

const d = parser.parse(await fs.readFile(sitemapPath, 'utf8'))

const routes = d.urlset.url.map((url) => url.loc.replace(process.env.SITE_URL || `https://thegraph.com/docs`, ``))
// TODO: `process.env.SITE_URL` never seems to be set here, so it always falls back to the default value
const routes = d.urlset.url.map((url) => url.loc.replace(process.env.SITE_URL || 'https://thegraph.com/docs', ''))

const redirectsPointingToNonExistingStuff = []

Expand Down