Skip to content

Commit

Permalink
fix(cli): default 模板把'.'开头文件改为'_'开头,close #3944
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen-jj committed Aug 1, 2019
1 parent 95a22d4 commit 91e696c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/taro-cli/src/create/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,21 @@ export async function createApp (
const templatePath = creater.templatePath(template)
const projectPath = path.join(projectDir, projectName)

// default 模板发布 npm 会滤掉 '.' 开头的文件,因此改为 '_' 开头,这里先改回来。
if (template === 'default') {
const files = await fs.readdir(templatePath)
const renames = files
.map(file => {
const filePath = path.join(templatePath, file)
if (fs.statSync(filePath).isFile() && file.startsWith('_')) {
return fs.rename(filePath, path.join(templatePath, file.replace(/^_/, '.')))
}
return Promise.resolve()
})

await Promise.all(renames)
}

// npm & yarn
const version = helper.getPkgVersion()
const shouldUseYarn = helper.shouldUseYarn()
Expand Down
File renamed without changes.

0 comments on commit 91e696c

Please sign in to comment.