diff --git a/lib/postsFetcher.ts b/lib/postsFetcher.ts deleted file mode 100644 index 2cab125..0000000 --- a/lib/postsFetcher.ts +++ /dev/null @@ -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(); -}; \ No newline at end of file diff --git a/scripts/gh-pages/build.mjs b/scripts/gh-pages/build.mjs deleted file mode 100644 index 80f10d7..0000000 --- a/scripts/gh-pages/build.mjs +++ /dev/null @@ -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(); \ No newline at end of file