mirror of
https://github.com/DefectingCat/DefectingCat.github.io
synced 2025-07-16 01:01:38 +00:00
Update dependencies
This commit is contained in:
21
package.json
21
package.json
@ -14,7 +14,7 @@
|
|||||||
"pretty": "prettier --write \"./**/*.{js,jsx,ts,tsx,json}\""
|
"pretty": "prettier --write \"./**/*.{js,jsx,ts,tsx,json}\""
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@codesandbox/sandpack-react": "^1.5.4",
|
"@codesandbox/sandpack-react": "^1.6.0",
|
||||||
"@docsearch/react": "3",
|
"@docsearch/react": "3",
|
||||||
"@giscus/react": "^2.2.0",
|
"@giscus/react": "^2.2.0",
|
||||||
"@mapbox/rehype-prism": "^0.8.0",
|
"@mapbox/rehype-prism": "^0.8.0",
|
||||||
@ -37,21 +37,20 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@testing-library/jest-dom": "^5.16.5",
|
"@testing-library/jest-dom": "^5.16.5",
|
||||||
"@testing-library/react": "^13.3.0",
|
"@testing-library/react": "^13.3.0",
|
||||||
"@types/jest": "^28.1.8",
|
"@types/jest": "^29.0.0",
|
||||||
"@types/node": "18.7.13",
|
"@types/node": "18.7.14",
|
||||||
"@types/react": "18.0.17",
|
"@types/react": "18.0.18",
|
||||||
"autoprefixer": "^10.4.8",
|
"autoprefixer": "^10.4.8",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"dotenv": "^16.0.1",
|
"dotenv": "^16.0.2",
|
||||||
"eslint": "8.22.0",
|
"eslint": "8.23.0",
|
||||||
"eslint-config-next": "12.2.5",
|
"eslint-config-next": "12.2.5",
|
||||||
"gray-matter": "^4.0.3",
|
"gray-matter": "^4.0.3",
|
||||||
"jest": "^28.1.3",
|
"jest": "^29.0.1",
|
||||||
"jest-environment-jsdom": "^28.1.3",
|
"jest-environment-jsdom": "^29.0.1",
|
||||||
"nanoid": "^4.0.0",
|
|
||||||
"postcss": "^8.4.16",
|
"postcss": "^8.4.16",
|
||||||
"prettier": "^2.7.1",
|
"prettier": "^2.7.1",
|
||||||
"tailwindcss": "^3.1.8",
|
"tailwindcss": "^3.1.8",
|
||||||
"typescript": "4.7.4"
|
"typescript": "4.8.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
|
/* @ts-check */
|
||||||
import { config } from 'dotenv';
|
import { config } from 'dotenv';
|
||||||
import algoliasearch from 'algoliasearch/lite.js';
|
import algoliasearch from 'algoliasearch/lite.js';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { nanoid } from 'nanoid';
|
|
||||||
|
|
||||||
const dataPath = 'data/posts';
|
const dataPath = 'data/posts';
|
||||||
|
|
||||||
@ -23,43 +23,39 @@ const postLists = () => {
|
|||||||
const regex = /^#{2,3}(?!#)(.*)/gm;
|
const regex = /^#{2,3}(?!#)(.*)/gm;
|
||||||
|
|
||||||
let lastH2 = '';
|
let lastH2 = '';
|
||||||
|
const url = `https://rua.plus/p/${slug}#${head
|
||||||
|
.toLocaleLowerCase()
|
||||||
|
.replace(/ /g, '-')}`;
|
||||||
|
|
||||||
content.match(regex)?.map((h) => {
|
content.match(regex)?.map((h) => {
|
||||||
const heading = h.split(' ');
|
const heading = h.split(' ');
|
||||||
const level = heading[0].length;
|
const level = heading[0].length;
|
||||||
const head = h.substring(level + 1);
|
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) {
|
switch (level) {
|
||||||
case 2: {
|
case 2: {
|
||||||
myPosts.push({
|
myPosts.push(record);
|
||||||
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, '-')}`,
|
|
||||||
});
|
|
||||||
lastH2 = head;
|
lastH2 = head;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3: {
|
case 3: {
|
||||||
myPosts.push({
|
myPosts.push({
|
||||||
content: null,
|
...record,
|
||||||
hierarchy: {
|
hierarchy: {
|
||||||
lvl0: 'Post',
|
...record.hierarchy,
|
||||||
lvl1: slug,
|
|
||||||
lvl2: lastH2,
|
|
||||||
lvl3: h.substring(level + 1),
|
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;
|
break;
|
||||||
}
|
}
|
||||||
@ -73,8 +69,8 @@ const postLists = () => {
|
|||||||
lvl1: slug,
|
lvl1: slug,
|
||||||
},
|
},
|
||||||
type: 'lvl1',
|
type: 'lvl1',
|
||||||
objectID: `${nanoid()}-https://rua.plus/p/${slug}`,
|
objectID: url,
|
||||||
url: `https://rua.plus/p/${slug}`,
|
url,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return myPosts;
|
return myPosts;
|
||||||
|
Reference in New Issue
Block a user