Skip to content

Commit

Permalink
feat(cli): 增加私有化模板不展示的逻辑 (#16152)
Browse files Browse the repository at this point in the history
  • Loading branch information
koppthe authored Jul 24, 2024
1 parent 7c48afd commit da11bdd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/taro-cli/src/create/fetchTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ export default function fetchTemplate (templateSource: string, templateRootPath:
const creatorFile = path.join(templateRootPath, name, TEMPLATE_CREATOR)

if (!fs.existsSync(creatorFile)) return { name, value: name }
const { name: displayName, platforms = '', desc = '', compiler } = require(creatorFile)
const { name: displayName, platforms = '', desc = '', isPrivate = false, compiler } = require(creatorFile)
if (isPrivate) return null

return {
name: displayName || name,
Expand All @@ -121,7 +122,8 @@ export default function fetchTemplate (templateSource: string, templateRootPath:
compiler,
desc
}
})
}).filter(Boolean) as ITemplates[]

return Promise.resolve(res)
} else {
// 单模板
Expand Down

0 comments on commit da11bdd

Please sign in to comment.