mirror of
https://github.com/pengzhanbo/vuepress-theme-plume.git
synced 2026-04-23 10:58:13 +08:00
perf(cli): update templates
This commit is contained in:
parent
ee33ed946a
commit
eaa0b466ac
@ -49,18 +49,25 @@ export async function generate(mode: Mode, data: ResolvedData): Promise<void> {
|
||||
}
|
||||
|
||||
// rewrite git files begin ==================================
|
||||
if (data.git)
|
||||
fileList.push(...await readFiles(getTemplate('git')))
|
||||
|
||||
if (mode === Mode.init) {
|
||||
const gitignorePath = path.join(cwd, '.gitignore')
|
||||
const docs = data.docsDir
|
||||
if (fs.existsSync(gitignorePath)) {
|
||||
const content = await fs.promises.readFile(gitignorePath, 'utf-8')
|
||||
fileList.push({
|
||||
filepath: '.gitignore',
|
||||
content: `${content}\n${docs}/.vuepress/.cache\n${docs}/.vuepress/.temp\n${docs}/.vuepress/dist\n`,
|
||||
})
|
||||
if (data.git) {
|
||||
const gitFiles = await readFiles(getTemplate('git'))
|
||||
if (mode === Mode.init) {
|
||||
const gitignorePath = path.join(cwd, '.gitignore')
|
||||
const docs = data.docsDir
|
||||
if (fs.existsSync(gitignorePath)) {
|
||||
const content = await fs.promises.readFile(gitignorePath, 'utf-8')
|
||||
fileList.push({
|
||||
filepath: '.gitignore',
|
||||
content: `${content}\n${docs}/.vuepress/.cache\n${docs}/.vuepress/.temp\n${docs}/.vuepress/dist\n`,
|
||||
})
|
||||
fileList.push(...gitFiles.filter(({ filepath }) => filepath !== '.gitignore'))
|
||||
}
|
||||
else {
|
||||
fileList.push(...gitFiles)
|
||||
}
|
||||
}
|
||||
else {
|
||||
fileList.push(...gitFiles)
|
||||
}
|
||||
}
|
||||
// rewrite git files end ====================================
|
||||
|
||||
@ -67,4 +67,4 @@ jobs:
|
||||
build_dir: {{docsDir}}/.vuepress/dist
|
||||
env:
|
||||
# @see https://docs.github.com/cn/actions/reference/authentication-in-a-workflow#about-the-github_token-secret
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITHUB_TOKEN: $\{{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
node_modules
|
||||
**/node_modules
|
||||
|
||||
{{ docsDir }}/.vuepress/.cache
|
||||
{{ docsDir }}/.vuepress/.temp
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user