fix build issues
This commit is contained in:
parent
f46bdc3e1a
commit
14900bcdfa
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
title: JavaScript Console 2: Contracts
|
||||
title: 'JavaScript Console 2: Contracts'
|
||||
description: Instructions for working with contracts in the Javascript console.
|
||||
---
|
||||
|
|
@ -30,11 +30,11 @@
|
|||
"react-syntax-highlighter": "^15.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/js-yaml": "^4.0.5",
|
||||
"@types/node": "18.7.16",
|
||||
"@types/react": "18.0.18",
|
||||
"@types/react-dom": "18.0.6",
|
||||
"@types/react-syntax-highlighter": "^15.5.5",
|
||||
"@types/js-yaml": "^4.0.5",
|
||||
"eslint": "8.23.0",
|
||||
"eslint-config-next": "12.2.5",
|
||||
"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.
|
||||
|
@ -40,20 +40,18 @@ export const getStaticPaths: GetStaticPaths = () => {
|
|||
|
||||
// Reads file data for markdown pages
|
||||
export const getStaticProps: GetStaticProps = async context => {
|
||||
const { slug } = context.params as ParsedUrlQuery
|
||||
const filePath = (slug as string[])!.join('/')
|
||||
let file
|
||||
const { slug } = context.params as ParsedUrlQuery;
|
||||
const filePath = (slug as string[])!.join('/');
|
||||
let file;
|
||||
|
||||
try {
|
||||
file = fs
|
||||
.readFileSync(`${filePath}.md`, 'utf-8')
|
||||
file = fs.readFileSync(`${filePath}.md`, 'utf-8');
|
||||
} catch {
|
||||
file = fs
|
||||
.readFileSync(`${filePath}/index.md`, 'utf-8')
|
||||
file = fs.readFileSync(`${filePath}/index.md`, 'utf-8');
|
||||
}
|
||||
|
||||
const { data: frontmatter, content } = matter(file, MATTER_OPTIONS);
|
||||
|
||||
|
||||
return {
|
||||
props: {
|
||||
frontmatter,
|
||||
|
@ -72,15 +70,9 @@ interface Props {
|
|||
const DocPage: NextPage<Props> = ({ frontmatter, content }) => {
|
||||
return (
|
||||
<>
|
||||
<Heading as='h1'>
|
||||
{frontmatter.title}
|
||||
</Heading>
|
||||
<Heading as='h1'>{frontmatter.title}</Heading>
|
||||
|
||||
<ReactMarkdown
|
||||
components={MDXComponents}
|
||||
>
|
||||
{content}
|
||||
</ReactMarkdown>
|
||||
<ReactMarkdown components={MDXComponents}>{content}</ReactMarkdown>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue