Remove ecosystem configuration file, add Docker entrypoint script, and update deployment workflow to build and push Docker images. Enhance AdminPage with Docker export functionality and improve post management API to use dynamic posts directory path.
This commit is contained in:
@@ -7,6 +7,7 @@ import { JSDOM } from 'jsdom';
|
||||
import chokidar from 'chokidar';
|
||||
import type { FSWatcher } from 'chokidar';
|
||||
import hljs from 'highlight.js';
|
||||
import { getPostsDirectory } from './postsDirectory';
|
||||
|
||||
export interface Post {
|
||||
slug: string;
|
||||
@@ -19,7 +20,7 @@ export interface Post {
|
||||
author: string;
|
||||
}
|
||||
|
||||
const postsDirectory = path.join(process.cwd(), 'posts');
|
||||
const postsDirectory = getPostsDirectory();
|
||||
|
||||
// Function to get file creation date
|
||||
function getFileCreationDate(filePath: string): Date {
|
||||
|
||||
9
src/lib/postsDirectory.ts
Normal file
9
src/lib/postsDirectory.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import path from 'path';
|
||||
import { existsSync } from 'fs';
|
||||
|
||||
export function getPostsDirectory() {
|
||||
const rootDir = process.cwd();
|
||||
const dockerDir = path.join(rootDir, 'docker');
|
||||
const postsDir = path.join(rootDir, 'posts');
|
||||
return existsSync(dockerDir) ? dockerDir : postsDir;
|
||||
}
|
||||
Reference in New Issue
Block a user