我应该版本控制我的jQuery插件的缩小版本吗? [英] Should I version control the minified versions of my jQuery plugins?

查看:96
本文介绍了我应该版本控制我的jQuery插件的缩小版本吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我写了一个jQuery插件并将其添加到我的存储库(在我的案例中为Mercurial)。它是一个单独的文件,比如 jquery.plugin.js 。我正在使用BitBucket来管理这个存储库,它的一个功能是下载页面。所以,我添加 jquery.plugin.js 作为下载之一。

Let's say I write a jQuery plugin and add it to my repository (Mercurial in my case). It's a single file, say jquery.plugin.js. I'm using BitBucket to manage this repository, and one of its features is a Downloads page. So, I add jquery.plugin.js as one of the downloads.

现在我想提供一个我的插件的缩小版本,但我不确定最佳做法是什么。我知道它应该在下载页面上以 jquery.plugin.min.js 的形式提供,但是我每次更新它时都应该对它进行版本控制以反映未公开的版本?

Now I want to make available a minified version of my plugin, but I'm not sure what the best practice is. I know that it should be available on the Downloads page as jquery.plugin.min.js, but should I also version control it each time I update it to reflect the unminified version?

我看到控制缩小版本的版本最明显的问题是,每当我对未经编辑的版本进行更改时,我可能会忘记更新它。

The most obvious problem I see with version controlling the minified version is that I might forget to update it each time I make a change to the unminified version.

那么,我应该控制缩小的文件吗?

So, should I version control the minified file?

推荐答案

不,你不应该在源代码管理下保持生成的最小化版本。

No, you should not need to keep generated minimized versions under source control.

我们在将生成的文件添加到源代码控制(TFS)时遇到了问题,因为TFS将本地文件设置为只读方式。生成文件作为构建过程的一部分的工具会出现写访问问题(这可能不是其他版本控制系统的问题)。

We have had problems when adding generated files into source control (TFS), because of the way TFS sets local files to be read-only. Tools that generate files as part of the build process then have write access problems (this is probably not a problem with other version control systems).

但重要的是,全部:


  • 工具

  • 脚本

  • 源代码

  • 资源

  • 第三方图书馆

  • tools
  • scripts
  • source code
  • resources
  • third party libraries

以及构建,测试和部署产品所需的任何其他内容都应受版本控制。

and anything else you need to build, test and deploy your product should be under version control.

您应该能够从源代码管理中检出特定版本(通过标记或版本号或等效版本),并完全按原样重新创建软件。时间。即使在新鲜机器上也是如此。

You should be able to check out a specific version from source control (by tag or revision number or the equivalent) and recreate the software exactly as it was at that point in time. Even on a 'fresh' machine.

构建不应该依赖于任何不受源代码控制的东西。

The build should not be dependent on anything which is not under source control.

脚本:build-scripts是否为ant,make,MSBuild命令文件或您正在使用的任何内容,以及您可能需要在版本控制下进行的任何部署脚本 - 而不仅仅是在构建计算机上。

Scripts: build-scripts whether ant, make, MSBuild command files or whatever you are using, and any deployment scripts you may have need to be under version control - not just on the build machine.

工具:这意味着编译器,最小化器,测试框架 - 构建,测试和部署脚本工作所需的一切 - 应该受源代码控制。您需要这些工具的确切版本才能重新创建到某个时间点。

Tools: this means the compilers, minimizers, test frameworks - everything you need for your build, test and deployment scripts to work - should be under source control. You need the exact version of those tools to be available to recreate to a point in time.

书籍持续交付'教会了我这一课 - 我强烈推荐它。

The book 'Continuous Delivery' taught me this lesson - I highly recommend it.

虽然我相信这是一个好主意 - 并且尽可能坚持下去 - 但在某些方面我并不是100%肯定。例如操作系统,Java JDK和持续集成工具(我们使用Jenkins)。

您是否实践持续集成?这是一个很好的方法来测试你是否掌控了上述所有内容。如果在构建软件之前必须在Continuous Integration机器上进行任何手动安装,可能会出现问题。

Do you practice Continuous Integration? It's a good way to test that you have all the above under control. If you have to do any manual installation on the Continuous Integration machine before it can build the software, something is probably wrong.

这篇关于我应该版本控制我的jQuery插件的缩小版本吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆