Add --skip-package-file option.
This commit is contained in:
+27
-5
@@ -22,6 +22,25 @@ Options:
|
||||
bump. Valid options are: 'major', 'minor', 'patch',
|
||||
'prerelease', 'buildmetadata', and 'last'. Defaults
|
||||
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:
|
||||
|
||||
bump
|
||||
@@ -66,7 +85,7 @@ Details:
|
||||
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
|
||||
LangType* = enum lNim, lNode
|
||||
@@ -313,7 +332,8 @@ when isMainModule:
|
||||
let part = parseSemverPart(partName)
|
||||
pkg.version = incrementSemverPart(pkg.version, part)
|
||||
|
||||
writePackage(pkg)
|
||||
if not args["--skip-package-file"]:
|
||||
writePackage(pkg)
|
||||
|
||||
for filePath in args["<src-file>"]:
|
||||
replaceVersionInFile(Path(filePath), pkg, oldVersion)
|
||||
@@ -333,7 +353,8 @@ when isMainModule:
|
||||
for filePath in args["<src-file>"]:
|
||||
replaceVersionInFile(Path(filePath), pkg, oldVersion)
|
||||
|
||||
writePackage(pkg)
|
||||
if not args["--skip-package-file"]:
|
||||
writePackage(pkg)
|
||||
echo pkg.version
|
||||
|
||||
elif args["get"]: echo pkg.version
|
||||
@@ -349,8 +370,9 @@ when isMainModule:
|
||||
let isCorrect = stdin.readLine
|
||||
acceptNewVersion = "yes".startsWith(isCorrect.toLower)
|
||||
|
||||
echo "Updating version definition in " & $pkg.file
|
||||
writePackage(pkg)
|
||||
if not args["--skip-package-file"]:
|
||||
echo "Updating version definition in " & $pkg.file
|
||||
writePackage(pkg)
|
||||
|
||||
for filePath in args["<src-file>"]:
|
||||
echo "Updating version definition in " & $filePath
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Package
|
||||
|
||||
version = "1.1.0"
|
||||
version = "1.2.0"
|
||||
author = "Jonathan Bernard"
|
||||
description = "Small util to update version consistently for nim and node packages."
|
||||
license = "MIT"
|
||||
|
||||
Reference in New Issue
Block a user