Closed MikeAlhayek closed 4 years ago
You would need to supply a regex:
bump({
regex: new RegExp()
})
Thanks for your quick response.
I tried to use AssemblyVersion\("\d.\d.\d"\)
as my pattern. Here is a test case for the full expression https://regex101.com/r/DjoYlf/3
Here is my complete script
const bump = require('gulp-bump');
function bump(cb) {
cb();
return gulp.src('./AssemblyInfo.cs')
.pipe(bump({
regex: new RegExp('AssemblyVersion\("(\d+\.\d+\.\d+)"\)'),
type: "patch"
}))
.pipe(gulp.dest('./'));
}
exports.bump = bump;
I am still getting an error. Here is the error I am getting
[PluginError: Invalid semver: version key "version" is not found in file] {
plugin: 'gulp-bump',
showProperties: true,
showStack: false,
__safety: { toString: [Function: bound ] },
domainEmitter: DestroyableTransform {
_readableState: ReadableState {
objectMode: true,
highWaterMark: 16,
buffer: BufferList { length: 0 },
length: 0,
pipes: [Pumpify],
pipesCount: 1,
flowing: true,
ended: false,
endEmitted: false,
reading: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
destroyed: false,
defaultEncoding: 'utf8',
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null
},
readable: true,
_events: [Object: null prototype] {
end: [Array],
prefinish: [Function: prefinish],
data: [Function: ondata]
},
_eventsCount: 3,
_maxListeners: undefined,
_writableState: WritableState {
objectMode: true,
highWaterMark: 16,
finalCalled: false,
needDrain: false,
ending: false,
ended: false,
finished: false,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: true,
bufferProcessing: false,
onwrite: [Function],
writecb: null,
writelen: 0,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 0,
prefinished: false,
errorEmitted: true,
bufferedRequestCount: 0,
corkedRequestsFree: [CorkedRequest]
},
writable: true,
allowHalfOpen: true,
_transformState: {
afterTransform: [Function: bound afterTransform],
needTransform: true,
transforming: false,
writecb: null,
writechunk: null,
writeencoding: 'utf8'
},
_destroyed: false,
_transform: [Function],
[Symbol(kCapture)]: false
},
domainThrown: false
}
@stevelacy I updated my last comment with the regex test https://regex101.com/r/DjoYlf/3
@stevelacy I have not been able to find a solution. Any ideas that I should try?
@CrestApps Give me a few minutes and I'll add support for [KeyName]("\d.\d.\d")
@CrestApps Published 4.1.0 with the new regex which supports a functional syntax:
*Version("1.2.3")
Or change the key from version
to OtherKey
for:
OtherKey("1.2.3")
e42a791eafc80a07d3e2bad73241665461875ff0
Let me know if it works for you, is this directly in bump-regex or gulp-bump?
@stevelacy Thank you so much! This is amazing. Yes I am using gulp-bump. To test this out, I manually updated the dependencies in gulp-bump to test it out and it worked!
Can you please release a new version of gulp-bump
with bump-regex 4.1.0 dependency?
For anyone interested this is the task I am using with Gulp 4.0.2
function bumpVersion(cb) {
cb();
return gulp.src(["./Properties/AssemblyInfo.cs"])
.pipe(bump({
keys: ["AssemblyVersion", "AssemblyFileVersion"]
}))
.pipe(gulp.dest("./Properties/"));
};
exports.bumpVersion= bumpVersion;
Now running gulp bumpVersion
updates the version in both AssemblyVersion
and AssemblyFileVersion
Nice, you don't need to provide the keys actually as the regex is taking the value Version
from AssemblyVersion
.
Published to version 3.2.0
Hi, thank you for this very helpful package.
I am trying to bump a
C#
file. The file has the following contentI tried
and
Thanks for your help!