Update dependencies

This commit is contained in:
DefectingCat
2022-09-01 09:20:02 +08:00
parent 5dbe5c6cac
commit b0b7ed47e9
3 changed files with 507 additions and 534 deletions

View File

@ -14,7 +14,7 @@
"pretty": "prettier --write \"./**/*.{js,jsx,ts,tsx,json}\""
},
"dependencies": {
"@codesandbox/sandpack-react": "^1.5.4",
"@codesandbox/sandpack-react": "^1.6.0",
"@docsearch/react": "3",
"@giscus/react": "^2.2.0",
"@mapbox/rehype-prism": "^0.8.0",
@ -37,21 +37,20 @@
"devDependencies": {
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.3.0",
"@types/jest": "^28.1.8",
"@types/node": "18.7.13",
"@types/react": "18.0.17",
"@types/jest": "^29.0.0",
"@types/node": "18.7.14",
"@types/react": "18.0.18",
"autoprefixer": "^10.4.8",
"cross-env": "^7.0.3",
"dotenv": "^16.0.1",
"eslint": "8.22.0",
"dotenv": "^16.0.2",
"eslint": "8.23.0",
"eslint-config-next": "12.2.5",
"gray-matter": "^4.0.3",
"jest": "^28.1.3",
"jest-environment-jsdom": "^28.1.3",
"nanoid": "^4.0.0",
"jest": "^29.0.1",
"jest-environment-jsdom": "^29.0.1",
"postcss": "^8.4.16",
"prettier": "^2.7.1",
"tailwindcss": "^3.1.8",
"typescript": "4.7.4"
"typescript": "4.8.2"
}
}
}

View File

@ -1,8 +1,8 @@
/* @ts-check */
import { config } from 'dotenv';
import algoliasearch from 'algoliasearch/lite.js';
import fs from 'fs';
import path from 'path';
import { nanoid } from 'nanoid';
const dataPath = 'data/posts';
@ -23,43 +23,39 @@ const postLists = () => {
const regex = /^#{2,3}(?!#)(.*)/gm;
let lastH2 = '';
const url = `https://rua.plus/p/${slug}#${head
.toLocaleLowerCase()
.replace(/ /g, '-')}`;
content.match(regex)?.map((h) => {
const heading = h.split(' ');
const level = heading[0].length;
const head = h.substring(level + 1);
const record = {
content: null,
hierarchy: {
lvl0: 'Post',
lvl1: slug,
lvl2: head,
},
type: `lvl${level}`,
objectID: url,
url,
};
switch (level) {
case 2: {
myPosts.push({
content: null,
hierarchy: {
lvl0: 'Post',
lvl1: slug,
lvl2: head,
},
type: `lvl${level}`,
objectID: `${nanoid()}-https://rua.plus/p/${slug}`,
url: `https://rua.plus/p/${slug}#${head
.toLocaleLowerCase()
.replace(/ /g, '-')}`,
});
myPosts.push(record);
lastH2 = head;
break;
}
case 3: {
myPosts.push({
content: null,
...record,
hierarchy: {
lvl0: 'Post',
lvl1: slug,
lvl2: lastH2,
...record.hierarchy,
lvl3: h.substring(level + 1),
},
type: `lvl${level}`,
objectID: `${nanoid()}-https://rua.plus/p/${slug}`,
url: `https://rua.plus/p/${slug}#${head
.toLocaleLowerCase()
.replace(/ /g, '-')}`,
});
break;
}
@ -73,8 +69,8 @@ const postLists = () => {
lvl1: slug,
},
type: 'lvl1',
objectID: `${nanoid()}-https://rua.plus/p/${slug}`,
url: `https://rua.plus/p/${slug}`,
objectID: url,
url,
});
});
return myPosts;

974
yarn.lock

File diff suppressed because it is too large Load Diff