umi icon indicating copy to clipboard operation
umi copied to clipboard

[Bug] create-umi 第三方 template 缺陷

Open xiefengnian opened this issue 1 year ago • 1 comments

What happens?

使用 npm create umi --template electron 时,在源中获取 tar 包时,是无法正确获取所需的 .npmrc 和 .gitignore 的。

Mini Showcase Repository(REQUIRED)

Please provide a minimal reproduction then upload to your GitHub. 请提供 最小重现,并上传到你的 GitHub 仓库

https://github.com/umijs/umi/blob/master/packages/create-umi/src/template.ts#L17

How To Reproduce

npm create umi --template electron

Context

  • Umi Version: latest
  • Node Version: any
  • Platform: any

xiefengnian avatar Aug 24 '23 06:08 xiefengnian

后续建议:在 unpack 完下载好的代码后,遍历产物文件目录,过一遍模板引擎,此时可以注入需要的 umi 内部变量信息,对于 .npmrc 同 umi 现在内置模板一样,使用 .npmrc.tpl 即可,模板引擎会渲染这些 .tpl 的文件。

fz6m avatar Aug 24 '23 12:08 fz6m