Skip to content

Commit

Permalink
fix(config): add parameter to control generate folder
Browse files Browse the repository at this point in the history
  • Loading branch information
BeADre committed Dec 29, 2021
1 parent 333cfae commit 6a17558
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/varlet-cli/src/compiler/compileSiteEntry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,6 @@ export async function buildSiteSource() {
}

export async function buildSiteEntry() {
getVarletConfig()
getVarletConfig(true)
await Promise.all([buildMobileSiteRoutes(), buildPcSiteRoutes(), buildSiteSource()])
}
9 changes: 6 additions & 3 deletions packages/varlet-cli/src/config/varlet.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { merge } from 'lodash'
import { VARLET_CONFIG, SITE_CONFIG } from '../shared/constant'
import { outputFileSyncOnChange } from '../shared/fsUtils'

export function getVarletConfig(): Record<string, any> {
export function getVarletConfig(isGenVarlet = false): Record<string, any> {
let config: any = {}

if (pathExistsSync(VARLET_CONFIG)) {
Expand All @@ -14,8 +14,11 @@ export function getVarletConfig(): Record<string, any> {
const defaultConfig = require('../../varlet.default.config.js')

const mergedConfig = merge(defaultConfig, config)
const source = JSON.stringify(mergedConfig, null, 2)
outputFileSyncOnChange(SITE_CONFIG, source)

if (isGenVarlet) {
const source = JSON.stringify(mergedConfig, null, 2)
outputFileSyncOnChange(SITE_CONFIG, source)
}

return mergedConfig
}

0 comments on commit 6a17558

Please sign in to comment.