dexteryy / CardKit

A mobile UI library provides a series of building blocks which are all components built on DarkDOM and Moui.
http://ozjs.org/CardKit
703 stars 141 forks source link

cleaner repository #8

Closed ktmud closed 11 years ago

ktmud commented 11 years ago

examples 目录下有一个重复的 dist 目录,dist 下还有压缩后的文件版本,很不方便 diff ,长此以往还造成仓库过大,git clone 时会相当耗时耗力

对于 examples 下的 dist 目录,两种方案:

  1. examples 目录下 dist 用软链接,缺点是在 windows 下支持不好
  2. 修改 examples 下 html 对 dist 文件的引用,缺点是 examples 就不可以在根目录下 run 起来, grunt connect 会失效

对于 min 文件:

  1. 仓库本身不提供压缩版文件,放在其他地方(如需 nightly build ,可以写个同步脚本),有需要的可以从官网下载(如 jquery)
  2. grunt 命令默认不打压缩版,也不清空已有压缩版,需要时再 build (如 d3.js )

个人建议 min 文件不进仓库,本身这个项目还高度不稳定,不应该期待有人随时来下最新版。事实上,直接下一个黑盒子压缩版来用的人必然几乎等于没有。当前最重要的应为项目已有参与者方便。

dexteryy commented 11 years ago

min文件确实无所谓,不过dist/里构建好的发布文件却是一直有人在用的(电影票务等)

最近在做的galeditor项目也有这个问题:

http://github-ent.intra.douban.com/dexteryy/GalEditor/tree/master/dist http://github-ent.intra.douban.com/book/ark/blob/master/Gruntfile.js#L48

让 dist/ 进仓库的理由跟 galeditor 相同:下游项目不方便安装这个项目的所有依赖以及每次都执行构建

examples 的需求也类似。所以目前的状态确实是一个妥协,也需要想更好的方法,比如专门的分支、专门的仓库,不过这些方法也存在问题,下次再口头讨论一下罢。

这个问题其实蛮广泛的,也没看到特别好的现成解决方法,比如说这是jquery的:

https://github.com/jquery/jquery https://github.com/components/jquery

dexteryy commented 11 years ago

新的Gruntfile.js已基本解决这个问题:

平时开发过程中用grunt watch,会自动调grunt test,用 target/ 里的文件更新 examples/ 和 『public』目录

每次提交前一定要执行 grunt,会调用grunt restore,恢复之前用于临时测试的 examples/

需要同步并提交到『public』目录(即 config.js 里配置的实际项目静态文件目录)的时候,可执行 grunt deploy,会调用 grunt build 构建发布文件,但不会更新 dist/ 里的文件

这样每次提交都只包含源代码的更新,不会夹带 dist/、 target/、examples/ 里的更新

正式发布新版本时,单独修改 bower.json,执行 grunt publish,然后再提交和打tag