Add --skip-package-file option.
This commit is contained in:
+23
-1
@@ -22,6 +22,25 @@ Options:
|
|||||||
bump. Valid options are: 'major', 'minor', 'patch',
|
bump. Valid options are: 'major', 'minor', 'patch',
|
||||||
'prerelease', 'buildmetadata', and 'last'. Defaults
|
'prerelease', 'buildmetadata', and 'last'. Defaults
|
||||||
to 'last'
|
to 'last'
|
||||||
|
|
||||||
|
--skip-package-file Don't write changes to the package file (*.nimble or
|
||||||
|
package.json). This is useful mostly in temporary
|
||||||
|
circumstances where you want to update other source
|
||||||
|
files without updating the package file. Be careful
|
||||||
|
in these cases, however, as update_version uses the
|
||||||
|
current version (as reported in the package file) as
|
||||||
|
the canonical version. When updating versions in
|
||||||
|
other source files, update_version ignores lines that
|
||||||
|
do not match the current version. Consider the
|
||||||
|
following:
|
||||||
|
|
||||||
|
update_version set 1.0.4 file1.nim, file2.nim --skip-package-file # works
|
||||||
|
update_version set 1.0.0 file1.nim, file2.nim --skip-package-file # fails
|
||||||
|
|
||||||
|
The second command will *not* rewrite the version
|
||||||
|
strings in file1.nim and file2.nim because the
|
||||||
|
versions in those files (1.0.4) do not match what is
|
||||||
|
in the package.
|
||||||
Details:
|
Details:
|
||||||
|
|
||||||
bump
|
bump
|
||||||
@@ -66,7 +85,7 @@ Details:
|
|||||||
Node: ^\s*export\s+const\s+\S*VERSION\S*\s*=\s*"(<old-version>)"\s*;?$
|
Node: ^\s*export\s+const\s+\S*VERSION\S*\s*=\s*"(<old-version>)"\s*;?$
|
||||||
"""
|
"""
|
||||||
|
|
||||||
const UV_VERSION = "1.1.0"
|
const UV_VERSION = "1.2.0"
|
||||||
|
|
||||||
type
|
type
|
||||||
LangType* = enum lNim, lNode
|
LangType* = enum lNim, lNode
|
||||||
@@ -313,6 +332,7 @@ when isMainModule:
|
|||||||
let part = parseSemverPart(partName)
|
let part = parseSemverPart(partName)
|
||||||
pkg.version = incrementSemverPart(pkg.version, part)
|
pkg.version = incrementSemverPart(pkg.version, part)
|
||||||
|
|
||||||
|
if not args["--skip-package-file"]:
|
||||||
writePackage(pkg)
|
writePackage(pkg)
|
||||||
|
|
||||||
for filePath in args["<src-file>"]:
|
for filePath in args["<src-file>"]:
|
||||||
@@ -333,6 +353,7 @@ when isMainModule:
|
|||||||
for filePath in args["<src-file>"]:
|
for filePath in args["<src-file>"]:
|
||||||
replaceVersionInFile(Path(filePath), pkg, oldVersion)
|
replaceVersionInFile(Path(filePath), pkg, oldVersion)
|
||||||
|
|
||||||
|
if not args["--skip-package-file"]:
|
||||||
writePackage(pkg)
|
writePackage(pkg)
|
||||||
echo pkg.version
|
echo pkg.version
|
||||||
|
|
||||||
@@ -349,6 +370,7 @@ when isMainModule:
|
|||||||
let isCorrect = stdin.readLine
|
let isCorrect = stdin.readLine
|
||||||
acceptNewVersion = "yes".startsWith(isCorrect.toLower)
|
acceptNewVersion = "yes".startsWith(isCorrect.toLower)
|
||||||
|
|
||||||
|
if not args["--skip-package-file"]:
|
||||||
echo "Updating version definition in " & $pkg.file
|
echo "Updating version definition in " & $pkg.file
|
||||||
writePackage(pkg)
|
writePackage(pkg)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Package
|
# Package
|
||||||
|
|
||||||
version = "1.1.0"
|
version = "1.2.0"
|
||||||
author = "Jonathan Bernard"
|
author = "Jonathan Bernard"
|
||||||
description = "Small util to update version consistently for nim and node packages."
|
description = "Small util to update version consistently for nim and node packages."
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|||||||
Reference in New Issue
Block a user