From 4d842d1e5894e17d5b394bddcb824a71dfd40189 Mon Sep 17 00:00:00 2001 From: wherelse Date: Tue, 17 May 2022 20:47:23 +0800 Subject: [PATCH] fix: priview folder path --- src/server/app.ts | 8 ++++---- src/server/plugins/deploys/sftp.ts | 2 +- src/server/renderer.ts | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/server/app.ts b/src/server/app.ts index 549b626a..7aa30f50 100644 --- a/src/server/app.ts +++ b/src/server/app.ts @@ -218,7 +218,7 @@ export default class App { // Site folder exists if (fse.pathExistsSync(this.appDir)) { // Check if the `images`, `config`, 'output', `post-images`, 'posts', 'themes', 'static' folder exists, if it does not exist, copy it from default-files - ['images', 'config', 'output', 'post-images', 'posts', 'themes', 'static'].forEach((folder: string) => { + ['images', 'config', 'post-images', 'posts', 'themes', 'static'].forEach((folder: string) => { const folderPath = path.join(this.appDir, folder) if (!fse.pathExistsSync(folderPath)) { fse.copySync( @@ -235,7 +235,7 @@ export default class App { this.checkTheme('paper') // move output/favicon.ico to Gridea/favicon.ico - const outputFavicon = path.join(this.appDir, 'output', 'favicon.ico') + const outputFavicon = path.join(this.buildDir, 'favicon.ico') const sourceFavicon = path.join(this.appDir, 'favicon.ico') const existFaviconOutput = fse.pathExistsSync(outputFavicon) const existFaviconSource = fse.pathExistsSync(sourceFavicon) @@ -288,8 +288,8 @@ export default class App { const routesStack = routers.stack routesStack.forEach(removeMiddleware) } - this.previewServer.use(express.static(`${this.appDir}/output`)) - console.log(`Preview server: Static dir change to ${this.appDir}/output`) + this.previewServer.use(express.static(`${this.buildDir}`)) + console.log(`Preview server: Static dir change to ${this.buildDir}`) } private initEvents(): void { diff --git a/src/server/plugins/deploys/sftp.ts b/src/server/plugins/deploys/sftp.ts index fd9b2348..56882854 100644 --- a/src/server/plugins/deploys/sftp.ts +++ b/src/server/plugins/deploys/sftp.ts @@ -109,7 +109,7 @@ export default class SftpDeploy extends Model { connectConfig.password = setting.password } - const localPath = normalizePath(path.join(this.appDir, 'output')) + const localPath = normalizePath(path.join(this.buildDir)) const remotePath = normalizePath(path.join(setting.remotePath)) try { diff --git a/src/server/renderer.ts b/src/server/renderer.ts index b2a9b70a..0ca927bf 100644 --- a/src/server/renderer.ts +++ b/src/server/renderer.ts @@ -85,7 +85,7 @@ export default class Renderer extends Model { async loadConfig() { this.themePath = urlJoin(this.appDir, 'themes', this.db.themeConfig.themeName) - fse.ensureDirSync(urlJoin(this.appDir, 'output')) + fse.ensureDirSync(urlJoin(this.outputDir)) } /**