mirror of
https://github.com/DefectingCat/DefectingCat.github.io
synced 2025-07-16 01:01:38 +00:00
Updat build script
This commit is contained in:
@ -4,7 +4,7 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
"build": "next build",
|
"build": "next build && node scripts/build-search.mjs",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "next lint",
|
"lint": "next lint",
|
||||||
"test": "jest --watch",
|
"test": "jest --watch",
|
||||||
|
@ -13,14 +13,14 @@ const postLists = () => {
|
|||||||
const files = fs.readdirSync(path.join('pages/p'));
|
const files = fs.readdirSync(path.join('pages/p'));
|
||||||
|
|
||||||
const myPosts = [];
|
const myPosts = [];
|
||||||
files.map((f, fi) => {
|
files.map((f) => {
|
||||||
const content = fs.readFileSync(path.join('pages/p', f), 'utf-8');
|
const content = fs.readFileSync(path.join('pages/p', f), 'utf-8');
|
||||||
// const { data: meta, content } = matter(markdownWithMeta);
|
// const { data: meta, content } = matter(markdownWithMeta);
|
||||||
|
|
||||||
const slug = f.replace(/\.mdx$/, '');
|
const slug = f.replace(/\.mdx$/, '');
|
||||||
const regex = /^#{2}(?!#)(.*)/gm;
|
const regex = /^#{2}(?!#)(.*)/gm;
|
||||||
|
|
||||||
content.match(regex)?.map((heading, i) => {
|
content.match(regex)?.map((heading) => {
|
||||||
myPosts.push({
|
myPosts.push({
|
||||||
content: null,
|
content: null,
|
||||||
hierarchy: {
|
hierarchy: {
|
||||||
|
Reference in New Issue
Block a user