Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: preview folder path #986

Merged
merged 1 commit into from
May 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/server/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/server/plugins/deploys/sftp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/server/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

/**
Expand Down