Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

有关【egg-init】的一些建议 #456

Closed
liyanlong opened this issue Feb 25, 2017 · 22 comments
Closed

有关【egg-init】的一些建议 #456

liyanlong opened this issue Feb 25, 2017 · 22 comments

Comments

@liyanlong
Copy link

官网好像对 egg-init 的介绍不是很多

希望后期能够补充官网的文档来介绍一下 egg-init. 可以介绍一下目前的 egg-init的模板的规则是如何的。

egg-init的使用

用法是这样
egg-init --type simple showcase

目前是否可以支持来自github的模板 ?

egg-init --type username/repository myapp

@atian25
Copy link
Member

atian25 commented Feb 25, 2017

目前不知道, 执行下 egg-init --help 就知道了.

现在支持本地的路径, 但不支持 github 的.

这块我们暂时没有什么计划, 如果有兴趣可以写下 RFC 提案讨论下.

另外, 社区也可以直接写基于 yo 的骨架, 直接用 yo 也没问题. egg-init 的几个骨架主要是规范 eslint 和 npm scripts 这几个地方.

@liyanlong
Copy link
Author

恩, 我会了解一下yo, 希望egg的生态能够更加完善。

@atian25
Copy link
Member

atian25 commented Feb 25, 2017

你也可以给 egg-init 提交一个 PR, 来支持 username/repository, 就是多一个判断去 download

@atian25
Copy link
Member

atian25 commented Feb 25, 2017

看了下, 可以增加一个 egg-init --package=<npm name> 的指令就可以了.

https://github.com/eggjs/egg-init/blob/master/lib/init_command.js#L70

这里加个判断就行, 下周有时间我再搞搞

@liyanlong
Copy link
Author

我觉得可行。感谢

@atian25
Copy link
Member

atian25 commented Feb 25, 2017

ref: eggjs/egg-init#22

@atian25
Copy link
Member

atian25 commented Feb 26, 2017

@liyanlong 1.8.0 已经支持, 另外 README 也增加了简单的参数说明

@liyanlong
Copy link
Author

OK, 我去试着create一个模板

@liyanlong
Copy link
Author

@atian25
看了下egg-init 的说明

  • Add your package name to egg-init-config's package.json config.boilerplate property
    这里有句话 , 是说我要 PR egg-init-config 么?

@atian25
Copy link
Member

atian25 commented Feb 26, 2017 via email

@liyanlong
Copy link
Author

哦哦. 使用方式是不是类似这样

$ egg-init  --package="egg-boileplate-simple"

还是说去掉前缀

$ egg-init  --package="simple"

@popomore
Copy link
Member

popomore commented Feb 26, 2017 via email

@atian25
Copy link
Member

atian25 commented Feb 26, 2017 via email

@liyanlong
Copy link
Author

liyanlong commented Feb 26, 2017

egg-init : 1.8.0
platform: macOS

$ egg-init --package=egg-boileplate-simple simple

TypeError: Cannot read property 'tarball' of undefined
    at Command.downloadBoilerplate (/usr/local/lib/node_modules/egg-init/lib/init_command.js:405:31)
    at next (native)
    at onFulfilled (/usr/local/lib/node_modules/egg-init/node_modules/co/index.js:65:19)
    at process._tickCallback (internal/process/next_tick.js:103:7)

出现了这个问题. @atian25

@atian25
Copy link
Member

atian25 commented Feb 26, 2017

@liyanlong egg-boilerplate-plugin 而不是 egg-boileplate-simple 拼写错误了.

我补个友好的提示吧

@liyanlong
Copy link
Author

@atian25 恩,生效了。
不过有一个问题, 我的模板里面自带了一张图片, 使用egg-init download下来图片的打不开了。

我使用的是自己写的 boilerplate egg-boilerplate-nuxt

$ egg-init --package=egg-boilerplate-nuxt nuxt-egg-demo

具体文件在 {app_root}/resources/assets/img/logo.png

@atian25
Copy link
Member

atian25 commented Mar 16, 2017

@liyanlong 刚看到你的 nuxt-egg,不错。

图片可能是因为 zip 解压那里有问题,重构的时候顺便搞搞, #379

@liyanlong
Copy link
Author

liyanlong commented Mar 16, 2017

@atian25 谢谢,最近公事也有点多,我也想有时间多研究一下 egg框架.

@atian25
Copy link
Member

atian25 commented Mar 16, 2017

@lcoder
Copy link

lcoder commented Nov 3, 2019

貌似没采纳建议啊,我新手第一步看到npm ini egg --type=simple 。想知道下,type是干嘛的,搜来搜去,都不知道type的可用项,哪里有文档可以看一下

@atian25
Copy link
Member

atian25 commented Nov 4, 2019

貌似没采纳建议啊,我新手第一步看到npm ini egg --type=simple 。想知道下,type是干嘛的,搜来搜去,都不知道type的可用项,哪里有文档可以看一下

egg-init --help

或者看下 https://github.com/eggjs/egg-init 源码

@lcoder
Copy link

lcoder commented Nov 4, 2019

@atian25 谢谢,看源码找到了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants