fix build issues

pull/26459/head^2
Corwin Smith 2 years ago
parent f46bdc3e1a
commit 14900bcdfa
  1. 2
      docs/interacting-with-geth/javascript-console-contracts.md
  2. 2
      package.json
  3. 26
      src/pages/[...slug].tsx
  4. 6483
      yarn.lock

@ -1,5 +1,5 @@
--- ---
title: JavaScript Console 2: Contracts title: 'JavaScript Console 2: Contracts'
description: Instructions for working with contracts in the Javascript console. description: Instructions for working with contracts in the Javascript console.
--- ---

@ -30,11 +30,11 @@
"react-syntax-highlighter": "^15.5.0" "react-syntax-highlighter": "^15.5.0"
}, },
"devDependencies": { "devDependencies": {
"@types/js-yaml": "^4.0.5",
"@types/node": "18.7.16", "@types/node": "18.7.16",
"@types/react": "18.0.18", "@types/react": "18.0.18",
"@types/react-dom": "18.0.6", "@types/react-dom": "18.0.6",
"@types/react-syntax-highlighter": "^15.5.5", "@types/react-syntax-highlighter": "^15.5.5",
"@types/js-yaml": "^4.0.5",
"eslint": "8.23.0", "eslint": "8.23.0",
"eslint-config-next": "12.2.5", "eslint-config-next": "12.2.5",
"eslint-config-prettier": "^8.5.0", "eslint-config-prettier": "^8.5.0",

@ -27,7 +27,7 @@ export const getStaticPaths: GetStaticPaths = () => {
} }
} }
return files.map(file => file.replace('.md', '')).map((file) => file.replace('/index', '')); return files.map(file => file.replace('.md', '')).map(file => file.replace('/index', ''));
}; };
const paths: string[] = getFileList('docs'); // This is folder that get crawled for valid docs paths. Change if this path changes. const paths: string[] = getFileList('docs'); // This is folder that get crawled for valid docs paths. Change if this path changes.
@ -40,20 +40,18 @@ export const getStaticPaths: GetStaticPaths = () => {
// Reads file data for markdown pages // Reads file data for markdown pages
export const getStaticProps: GetStaticProps = async context => { export const getStaticProps: GetStaticProps = async context => {
const { slug } = context.params as ParsedUrlQuery const { slug } = context.params as ParsedUrlQuery;
const filePath = (slug as string[])!.join('/') const filePath = (slug as string[])!.join('/');
let file let file;
try { try {
file = fs file = fs.readFileSync(`${filePath}.md`, 'utf-8');
.readFileSync(`${filePath}.md`, 'utf-8')
} catch { } catch {
file = fs file = fs.readFileSync(`${filePath}/index.md`, 'utf-8');
.readFileSync(`${filePath}/index.md`, 'utf-8')
} }
const { data: frontmatter, content } = matter(file, MATTER_OPTIONS); const { data: frontmatter, content } = matter(file, MATTER_OPTIONS);
return { return {
props: { props: {
frontmatter, frontmatter,
@ -72,15 +70,9 @@ interface Props {
const DocPage: NextPage<Props> = ({ frontmatter, content }) => { const DocPage: NextPage<Props> = ({ frontmatter, content }) => {
return ( return (
<> <>
<Heading as='h1'> <Heading as='h1'>{frontmatter.title}</Heading>
{frontmatter.title}
</Heading>
<ReactMarkdown <ReactMarkdown components={MDXComponents}>{content}</ReactMarkdown>
components={MDXComponents}
>
{content}
</ReactMarkdown>
</> </>
); );
}; };

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save