import fs from 'fs-extra'
import path from 'path'
export const generateConfig = (options = {}) => {
const { theme, platformId, material, scripts = [], styles = [] } = options
const configContent = `
export default {
id: 'engine.config',
theme: '${theme}',
material: ${JSON.stringify(material)},
scripts: ${JSON.stringify(scripts)},
styles: ${JSON.stringify(styles)},
platformId: ${platformId}
}
`
return configContent
}
export const generatePackageJson = (name, templatePath) => {
const templatePackageJson = fs.readJSONSync(path.resolve(templatePath, 'package.json'))
templatePackageJson.name = name
return templatePackageJson
}
export const generateThemeMeta = (themeName = 'custom') => {
const metaContent = `
export default {
id: 'engine.theme.${themeName}',
text: '自定义主题',
type: '${themeName}',
icon: 'dark'
}
`
return metaContent
}