Updat build script

This commit is contained in:
Defectink
2022-04-18 15:00:56 +08:00
parent e0a293ac2e
commit 835ff07758
2 changed files with 3 additions and 3 deletions

View File

@ -4,7 +4,7 @@
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"build": "next build && node scripts/build-search.mjs",
"start": "next start",
"lint": "next lint",
"test": "jest --watch",

View File

@ -13,14 +13,14 @@ const postLists = () => {
const files = fs.readdirSync(path.join('pages/p'));
const myPosts = [];
files.map((f, fi) => {
files.map((f) => {
const content = fs.readFileSync(path.join('pages/p', f), 'utf-8');
// const { data: meta, content } = matter(markdownWithMeta);
const slug = f.replace(/\.mdx$/, '');
const regex = /^#{2}(?!#)(.*)/gm;
content.match(regex)?.map((heading, i) => {
content.match(regex)?.map((heading) => {
myPosts.push({
content: null,
hierarchy: {