remove useless files

This commit is contained in:
DefectingCat
2023-05-19 09:18:19 +08:00
parent cd124571cc
commit 120d599a83
2 changed files with 0 additions and 63 deletions

View File

@ -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();
};

View File

@ -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();