
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
gulp-git-svn-version-filename
Advanced tools
此 gulp 插件用于在文件名中添加对应 Git/Svn 的版本号。
注意:gulpfile.js
文件所在目录需要是 Git/Svn 有效的版本仓库目录,并确保命令行中能正常运行 Git/Svn 命令。
安装模块
npm i gulp-git-svn-version-filename
var FileVer = require('gulp-git-svn-version-filename');
var fileVer = new FileVer({
type: 'svn', // 仓库类型 支持svn、git
cwd: process.cwd(), // 项目根目录
user: '', // 仓库账号名
pwd: '', // 仓库账号密码
cache: true, // 是否缓存已查询版本信息
formater: '{name}_{version}{ext}', // 文件名加版本号的规则(不提供目录结构修改)
});
pathObj. = Path.parse(path)
,并加入version
信息,this指向fileVer。{'/home/user/git/project/js/a.js': '34ae3'}
this.formater
规则给fullPath加上version信息file.path
加完版本后的回调方法配置中user、pwd参数目前只有SVN支持,Git仓库请走ssh方式
gulpfile.js 中
var FileVer = require('gulp-git-svn-version-filename');
var cacheObj = {};
var fileVer = new FileVer({
type: 'svn', // 仓库类型 支持svn、git
cache: cacheObj, // 指定缓存对象
cwd: process.cwd(), // 项目根目录
user: '', // 仓库账号名
pwd: '', // 仓库账号密码
});
gulp.task('addSvnVersion', function(){
return gulp.src(['./js/**/*.js', './css/**/*.css'])
.pipe(fileVer.setForTransform(function(oldPath, versionPath){
console.log(versionPath, fileVer.getCache());
})
.pipe(gulp.dest('./build'))
});
FAQs
文件名中追加svn/git的对应文件版本号,要求传入文件的父层在svn/git仓库中
The npm package gulp-git-svn-version-filename receives a total of 12 weekly downloads. As such, gulp-git-svn-version-filename popularity was classified as not popular.
We found that gulp-git-svn-version-filename demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.