1 Star 1 Fork 0

wudx / VersionCompare

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

VersionCompare


用来生成版本差异文件,方便增量更新

使用前需要先安装nodejs

配置文件config.xml

按需修改配置文件

<?xml version="1.0" encoding="UTF-8"?>
<config>
	<inputDir>d:\code\nodejs\test</inputDir><!-- 输入目录 -->
	<outputDir>d:\code\nodejs\test2</outputDir><!-- 输出目录 -->
	<isCopyFile>true</isCopyFile><!--是否拷贝差异文件到输出目录(会保持目录结构)-->
	<maxDiffCount>2000</maxDiffCount><!--最大差异文件数,差异个数超过这个值就重置版本号,version.json会置空-->
	<ignoreDirs>aaa\xxx|aaa\aaaa.txt</ignoreDirs><!--忽略的目录或文件,多个用|隔开-->
	<versionName></versionName><!-- 自定义版本号,留空会自动使用当前时间当作版本号(推荐)-->
</config>

生成差异配置

D:\code\nodejs\VersionCompare>node index.js -c config.xml

第一次打版本,会在输出目录生成文件.historyversion.json .history是历史记录文件,主要根据这个文件来生成文件差异配置。 主要记录大版本号,和各个文件对应的版本号和md5值

<root>
<version>20171204154609</version>
<file><name>001.txt</name><version>20171204154609</version><md5>C8252D98634C30F96320C93C0BF8F8AE</md5></file>
<file><name>aaa\xxx.txt</name><version>20171204154609</version><md5>18D423DB14F083C6CCEABF934DD722BD</md5></file>
</root>

version.json就是我们项目中需要用到文件,主要记录从上个大版本到目前所有修改过的文件,第一次打版本version.json还不会有数据,因为没有上一个版本可比较,也就没有差异文件。

后面的版本打包,如果有差异文件,会记录在version.json,并在输出目录创建以当前日期命名的文件夹,比如20171204155419,里面包含所有差异的文件(含目录结构)

{
"001.txt":"20171204155419",
"aaa\/xxx.txt":"20171204155419"
}

规则

项目中使用

根据要加载文件的url在version.json文件中查找,如果能找到就使用version.json记录的版本号,没有就直接使用大版本号

The MIT License (MIT) Copyright (c) 2017 wudx Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

用来生成版本差异文件,方便增量更新 展开 收起
JavaScript
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
JavaScript
1
https://gitee.com/wudxcode/VersionCompare.git
git@gitee.com:wudxcode/VersionCompare.git
wudxcode
VersionCompare
VersionCompare
master

搜索帮助

14c37bed 8189591 565d56ea 8189591