Skip to content

Instantly share code, notes, and snippets.

@BinaryMuse BinaryMuse/README.md
Last active Sep 20, 2017

Embed
What would you like to do?

bump-package-dep

Automatically sets and commits appropriate versions of package dependencies for Atom based on current package.json values.

Example

Here, Atom is bundling tree-view v0.215.3, but we have v0.216.0 as the current version in tree-view's package.json:

$ jq '.packageDependencies."tree-view"' package.json
"0.215.3"
$ jq .version ~/github/tree-view/package.json
"0.216.0"

Let's update it!

$ bump-package-dep ~/github/tree-view
[master b5326e84b] :arrow_up: tree-view@0.216.0
 1 file changed, 1 insertion(+), 1 deletion(-)
commit b5326e84bcd82506336f6f2caa5f5a02d05cad07 (HEAD -> master)
Author: Michelle Tilley <binarymuse@github.com>
Date:   Wed Sep 20 15:05:50 2017 -0700

    :arrow_up: tree-view@0.216.0

diff --git a/package.json b/package.json
index 17a6ffede..0b745e8f6 100644
--- a/package.json
+++ b/package.json
@@ -131,7 +131,7 @@
     "symbols-view": "0.118.0",
     "tabs": "0.107.3",
     "timecop": "0.36.0",
-    "tree-view": "0.215.3",
+    "tree-view": "0.216.0",
     "update-package-dependencies": "0.12.0",
     "welcome": "0.36.5",
     "whitespace": "0.37.4",
#!/bin/bash
if [[ -z "$1" ]]; then
echo "Please specify an Atom package directory"
exit 1
fi
if [[ `git status --porcelain -- package.json` ]]; then
echo "package.json has uncommitted changes; aborting"
exit 1
fi
pushd "$1" > /dev/null
name=`jq -r .name package.json`
version=`jq -r .version package.json`
popd > /dev/null
set -e
jq ".packageDependencies[\"$name\"] = \"$version\"" package.json > package.json.bump
mv package.json.bump package.json
git commit -m ":arrow_up: $name@$version" -- package.json
git show head
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.