Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump typescript from 5.4.5 to 5.5.4 #12

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"husky": "^9.0.11",
"lint-staged": "^15.2.5",
"prettier": "^3.2.5",
"typescript": "5.4.5"
"typescript": "5.5.4"
},
"lint-staged": {
"src/**/*.{ts,tsx}": "npm run lint:fix"
Expand Down
29 changes: 29 additions & 0 deletions src/pages/advice/[pid].tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import Markdown from 'react-markdown'
import { promises as fs } from 'fs';
import 'katex/dist/katex.min.css'




export default function Article(props:any) {
return (
<Markdown>{props.article}</Markdown>
);
}

export async function getStaticProps({params}:{params:any}) {
const article = await fs.readFile("./src/markdown-pages/articles/"+params.pid, "utf8");
console.log(article)
return {props: {article}};

}

export async function getStaticPaths() {
let paths = (await fs.readdir("./src/markdown-pages/articles")).map(p => "/articles/"+p)
console.log("psths to render:", paths);
return { paths, fallback: true }

}



49 changes: 49 additions & 0 deletions src/pages/advice/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import ArticleListItem from "../../components/ArticleListItem";
import { promises as fs } from 'fs';


export default function ArticlesList(props: any) {
// eslint-disable-next-line react/prop-types
const {articles} = props;
return (
<>
<div>
<div>
<table className="table">
<thead>
<tr>
<th className="display-none-small-screen" scope="col">
{" "}
#{" "}
</th>
<th scope="col"> article Name</th>
<th scope="col"> Created Date</th>
</tr>
</thead>
<tbody>
{articles.map((article: any, index: any) => (
<ArticleListItem key={article} article={article} index={index}/>
))}
</tbody>
</table>
</div>
</div>
</>
);
}
// This function gets called at build time on server-side.
// It won't be called on client-side, so you can even do
// direct database queries. See the "Technical details" section.
export async function getStaticProps() {
return {props: {articles: await readDirectory("./src/markdown-pages/articles")}};
}

async function readDirectory(path: any) {
try {
// const data = await fs.readFile(path, 'utf8');
return await fs.readdir(path);

} catch (err) {
console.error(err);
}
}
2 changes: 1 addition & 1 deletion src/pages/articles/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default function ArticlesList(props: any) {
// It won't be called on client-side, so you can even do
// direct database queries. See the "Technical details" section.
export async function getStaticProps() {
return {props: {articles: await readDirectory("./src/markdown-pages/articles")}};
return {props: {articles: await readDirectory("./src/markdown-pages/advice")}};
}

async function readDirectory(path: any) {
Expand Down