Repository: bokeh/bokeh

Issue:
release deploy updates package-lock incorrectly
@mattpap the step:

> [PASS] Updated version from '1.0.0' to '1.0.1' in file 'bokehjs/package-lock.json'

seems to be too eager:

```
Would you like to continue to file modifications? (y/n): y

--------------------------------------------------------------------------------

[PASS] Checked out release branch 'release_1.0.1'
[PASS] Updated version from '1.0.0' to '1.0.1' in file 'bokehjs/src/lib/version.ts'
[PASS] Committed file 'bokehjs/src/lib/version.ts'
[PASS] Updated version from '1.0.0' to '1.0.1' in file 'bokehjs/package.json'
[PASS] Committed file 'bokehjs/package.json'
[PASS] Updated version from '1.0.0' to '1.0.1' in file 'bokehjs/package-lock.json'
[PASS] Committed file 'bokehjs/package-lock.json'
[PASS] Appended version '1.0.1' to 'sphinx/source/all_versions.txt'
[PASS] Committed file 'sphinx/source/all_versions.txt'
[PASS] Updated CHANGELOG with new closed issues
[PASS] Committed file '/Users/bryanv/work/bokeh/CHANGELOG'

!!! Here is a diff of the changes made on the release branch:

    diff --git a/CHANGELOG b/CHANGELOG
    index 52dab9e6d..0838c8955 100644
    --- a/CHANGELOG
    +++ b/CHANGELOG
    @@ -1,3 +1,16 @@
    +2018-10-31    1.0.1:
    +--------------------
    +  * bugfixes:
    +    - #4096 Bokeh server: color palette rgb is not recognized
    +    - #8356 [component: bokehjs] Datatable crashes layout if 'field' is key in columndatasource data
    +    - #8362 Combination of "export_png()" and "show()" causes error
    +    - #8374 [regression] Garbage collection of export_png()
    +    - #8375 [component: bokehjs] Ellipse and datetime axis
    +  * tasks:
    +    - #8367 [component: server] Documentlifecyclehandler should catch exception and clean up callbacks
    +    - #8369 [component: examples] Histogram example should take edges as argument to make_plot
    +    - #8387 [component: docs] Bryanv/101 misc docs
    +
     2018-10-24    1.0.0:
     --------------------
       * bugfixes:
    diff --git a/bokehjs/package-lock.json b/bokehjs/package-lock.json
    index 5b810e71b..3901cad17 100644
    --- a/bokehjs/package-lock.json
    +++ b/bokehjs/package-lock.json
    @@ -1,6 +1,6 @@
     {
       "name": "bokehjs",
    -  "version": "1.0.0",
    +  "version": "1.0.1",
       "lockfileVersion": 1,
       "requires": true,
       "dependencies": {
    @@ -246,7 +246,7 @@
           }
         },
         "array-equal": {
    -      "version": "1.0.0",
    +      "version": "1.0.1",
           "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz",
           "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=",
           "dev": true
    @@ -288,7 +288,7 @@
           }
         },
         "assert-plus": {
    -      "version": "1.0.0",
    +      "version": "1.0.1",
           "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
           "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU="
         },
    @@ -305,7 +305,7 @@
           "dev": true
         },
         "async-limiter": {
    -      "version": "1.0.0",
    +      "version": "1.0.1",
           "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz",
           "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==",
           "dev": true
    @@ -364,7 +364,7 @@
           }
         },
         "balanced-match": {
    -      "version": "1.0.0",
    +      "version": "1.0.1",
           "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
           "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
           "dev": true
    @@ -401,7 +401,7 @@
           "dev": true
         },
         "buffer-from": {
    -      "version": "1.0.0",
    +      "version": "1.0.1",
           "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.0.0.tgz",
           "integrity": "sha512-83apNb8KK0Se60UE1+4Ukbe3HbfELJ6UlI4ldtOGs7So4KD26orJM8hIY9lxdzP+UpItH1Yh/Y8GUvNFWFFRxA==",
           "dev": true
    @@ -672,7 +672,7 @@
           }
         },
         "d": {
    -      "version": "1.0.0",
    +      "version": "1.0.1",
           "resolved": "https://registry.npmjs.org/d/-/d-1.0.0.tgz",
           "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=",
           "requires": {
    @@ -732,7 +732,7 @@
           }
         },
         "delayed-stream": {
    -      "version": "1.0.0",
    +      "version": "1.0.1",
           "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
           "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
         },
    @@ -938,7 +938,7 @@
           }
         },
         "fs.realpath": {
    -      "version": "1.0.0",
    +      "version": "1.0.1",
           "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
           "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
           "dev": true
    @@ -1171,7 +1171,7 @@
           "dev": true
         },
         "invert-kv": {
    -      "version": "1.0.0",
    +      "version": "1.0.1",
           "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz",
           "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=",
           "dev": true
    @@ -1189,7 +1189,7 @@
           "dev": true
         },
         "is-path-cwd": {
    -      "version": "1.0.0",
    +      "version": "1.0.1",
           "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz",
           "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=",
           "dev": true
    @@ -1219,7 +1219,7 @@
           "dev": true
         },
         "is-typedarray": {
    -      "version": "1.0.0",
    +      "version": "1.0.1",
           "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
           "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo="
         },
    @@ -1295,7 +1295,7 @@
               }
             },
             "has-flag": {
    -          "version": "1.0.0",
    +          "version": "1.0.1",
               "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz",
               "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=",
               "dev": true
    @@ -1433,7 +1433,7 @@
           "optional": true
         },
         "lcid": {
    -      "version": "1.0.0",
    +      "version": "1.0.1",
           "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz",
           "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=",
           "dev": true,
    @@ -1780,7 +1780,7 @@
           }
         },
         "p-finally": {
    -      "version": "1.0.0",
    +      "version": "1.0.1",
           "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
           "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=",
           "dev": true
    @@ -1810,7 +1810,7 @@
           "dev": true
         },
         "p-try": {
    -      "version": "1.0.0",
    +      "version": "1.0.1",
           "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz",
           "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=",
           "dev": true
    @@ -2092,7 +2092,7 @@
           }
         },
         "shebang-regex": {
    -      "version": "1.0.0",
    +      "version": "1.0.1",
           "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz",
           "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=",
           "dev": true
    @@ -2213,7 +2213,7 @@
           }
         },
         "strip-eof": {
    -      "version": "1.0.0",
    +      "version": "1.0.1",
           "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
           "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=",
           "dev": true
    @@ -2510,7 +2510,7 @@
           "optional": true
         },
         "wordwrap": {
    -      "version": "1.0.0",
    +      "version": "1.0.1",
           "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
           "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=",
           "dev": true
    @@ -2526,7 +2526,7 @@
           },
           "dependencies": {
             "is-fullwidth-code-point": {
    -          "version": "1.0.0",
    +          "version": "1.0.1",
               "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
               "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
               "dev": true,
    diff --git a/bokehjs/package.json b/bokehjs/package.json
    index 08a0e1e02..d660fd95b 100644
    --- a/bokehjs/package.json
    +++ b/bokehjs/package.json
    @@ -1,6 +1,6 @@
     {
       "name": "bokehjs",
    -  "version": "1.0.0",
    +  "version": "1.0.1",
       "description": "Interactive, novel data visualization",
       "keywords": [
         "bokeh",
    diff --git a/bokehjs/src/lib/version.ts b/bokehjs/src/lib/version.ts
    index 4a62e4562..2b87e3c39 100644
    --- a/bokehjs/src/lib/version.ts
    +++ b/bokehjs/src/lib/version.ts
    @@ -1 +1 @@
    -export const version = '1.0.0'
    +export const version = '1.0.1'
    diff --git a/sphinx/source/all_versions.txt b/sphinx/source/all_versions.txt
    index 96d246331..82aa8a42a 100644
    --- a/sphinx/source/all_versions.txt
    +++ b/sphinx/source/all_versions.txt
    @@ -4,3 +4,4 @@
     0.12.16
     0.13.0
     1.0.0
    +1.0.1

Merge release branch and push these changes? [LAST CHANCE TO ABORT] (y/n): n
```


Discussion:

Resolving patch:
diff --git a/scripts/deploy.py b/scripts/deploy.py
--- a/scripts/deploy.py
+++ b/scripts/deploy.py
@@ -1,4 +1,5 @@
 import argparse
+import json
 from os.path import join
 import re
 from subprocess import CalledProcessError, check_output, STDOUT
@@ -306,15 +307,18 @@ def commit(filename, version):
 
 def update_bokehjs_versions():
 
-    filenames = [
+    regex_filenames = [
         'bokehjs/src/lib/version.ts',
+    ]
+
+    json_filenames = [
         'bokehjs/package.json',
         'bokehjs/package-lock.json',
     ]
 
     pat = r"(release|version)([\" ][:=] [\"\'])" + CONFIG.last_any_version + "([\"\'])"
 
-    for filename in filenames:
+    for filename in regex_filenames:
         path = join(CONFIG.top_dir, filename)
         with open(path) as f:
             text = f.read()
@@ -335,6 +339,20 @@ def update_bokehjs_versions():
             passed("Updated version from %r to %r in file %r" % (CONFIG.last_any_version, CONFIG.new_version, filename))
             commit(filename, CONFIG.new_version)
 
+    for filename in json_filenames:
+        path = join(CONFIG.top_dir, filename)
+        content = json.load(open(path))
+        try:
+            content['version'] = CONFIG.new_version
+            with open(path, "w") as f:
+                json.dump(content, f, indent=2)
+                f.write("\n")
+        except Exception as e:
+            failed("Unable to write new version to file %r" % filename, str(e).split("\n"))
+        else:
+            passed("Updated version from %r to %r in file %r" % (CONFIG.last_any_version, CONFIG.new_version, filename))
+            commit(filename, CONFIG.new_version)
+
 def update_docs_versions():
 
     # Update all_versions.txt
@@ -438,6 +456,10 @@ def show_updates():
                         type=str,
                         nargs=1,
                         help='The new version number for this release')
+    parser.add_argument('--dry-run',
+                        action="store_true",
+                        help='Set to perform a dry-run (no commits)')
+
     args = parser.parse_args()
 
     new_version = args.version[0]
@@ -451,8 +473,12 @@ def show_updates():
     check_py3()
     check_git()
     check_maintainers()
-    check_repo()
-    check_checkout()
+    if not args.dry_run:
+        check_repo()
+        check_checkout()
+    else:
+        print(blue("[SKIP] ") + "Skipping repo and checkout checks for dry run")
+
 
     try:
         CONFIG.new_version = args.version[0]
@@ -509,6 +535,10 @@ def show_updates():
 
     show_updates()
 
+    if args.dry_run:
+        banner(yellow, "{:^80}".format("Bokeh %r release deployment: DRY RUN (local checkout may be dirty)" % CONFIG.new_version))
+        sys.exit(1)
+
     confirm("Merge release branch and push these changes? [LAST CHANCE TO ABORT]")
 
     success = merge_and_push()


Test patch: