Skip to content

Instantly share code, notes, and snippets.

@estliberitas
Created November 17, 2015 16:21
Show Gist options
  • Save estliberitas/ac4c184ebc6a085cecb5 to your computer and use it in GitHub Desktop.
Save estliberitas/ac4c184ebc6a085cecb5 to your computer and use it in GitHub Desktop.
When you need versions of all the Bower dependencies
#!/bin/bash
# Hi guys!
# If it has happened with you and you got Bower dependencies
# and no `bower.json` file, and all you want is just have
# `bower.json` with those dependencies...
# You'll probably want to get those dependencies and their
# actual versions. And this is what simple command below does:
# Run it in a folder which keeps dependencies
# Optionally you can add `| tr '\n' ' '` - this way you'll get
# space-separated list which you can pass to `bower install --save`
grep -F -R -n '"version": ' ./*/bower.json | \
tr '\t' ' ' | \
sed -E 's/.\///;s/\/bower.json:[0-9]+:[ ]+"version": "/@/;s/",//'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment