mirror of
https://github.com/DefectingCat/DefectingCat.github.io
synced 2025-07-15 16:51:37 +00:00
remove useless files
This commit is contained in:
@ -1,9 +0,0 @@
|
|||||||
const baseUrl = 'https://blog-backend-beige-pi.vercel.app/';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Read post meta info from backend
|
|
||||||
*/
|
|
||||||
const readFileMate = async (filename: string) => {
|
|
||||||
const target = `${baseUrl}/${filename}.mdx`;
|
|
||||||
const result = await (await fetch(target)).text();
|
|
||||||
};
|
|
@ -1,54 +0,0 @@
|
|||||||
/* @ts-check */
|
|
||||||
import path from 'path';
|
|
||||||
import fs from 'fs/promises';
|
|
||||||
import { fileURLToPath } from 'url';
|
|
||||||
import { log } from 'console';
|
|
||||||
|
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
|
||||||
const __dirname = path.dirname(__filename);
|
|
||||||
|
|
||||||
const contentPath = path.resolve(__dirname, '../../content/posts');
|
|
||||||
const buildPath = path.resolve(__dirname, '../../build');
|
|
||||||
|
|
||||||
const PostPerPage = 10;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Read post folder, list all posts
|
|
||||||
*/
|
|
||||||
async function allPosts() {
|
|
||||||
const content = await fs.readdir(contentPath);
|
|
||||||
return content;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copy all posts to build folder
|
|
||||||
*/
|
|
||||||
async function copyPosts(posts) {
|
|
||||||
const builds = posts.map((post) => {
|
|
||||||
log(`Copy file ${post}`);
|
|
||||||
return fs.copyFile(`${contentPath}/${post}`, `${buildPath}/${post}`);
|
|
||||||
});
|
|
||||||
await Promise.all(builds);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function buildJson(posts) {}
|
|
||||||
|
|
||||||
async function main() {
|
|
||||||
const posts = await allPosts();
|
|
||||||
log(posts);
|
|
||||||
|
|
||||||
log('Clean build path');
|
|
||||||
try {
|
|
||||||
await fs.access(buildPath);
|
|
||||||
await fs.rm(buildPath, { recursive: true, force: true });
|
|
||||||
} catch (error) {}
|
|
||||||
|
|
||||||
await fs.mkdir(buildPath);
|
|
||||||
|
|
||||||
log('Start build');
|
|
||||||
await copyPosts(posts);
|
|
||||||
|
|
||||||
log('Build done');
|
|
||||||
}
|
|
||||||
|
|
||||||
main();
|
|
Reference in New Issue
Block a user