Skip to content

Commit

Permalink
take use of aliases into account
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoCapocci committed May 28, 2017
1 parent 6d06e38 commit 1043987
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bower-outdated",
"version": "0.0.7",
"version": "0.8.0",
"description": "This command will check the bower registry to see if any (or, specific) installed packages are currently outdated",
"license": "Apache-2.0",
"engines": {
Expand Down
19 changes: 15 additions & 4 deletions src/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ checkInstalledVersions = ->

Promise.map bowerDependencies, (bowerDependency) ->
new Promise (resolve, reject) ->
fs.readFile src + '/' + bowerDependency.name + '/.bower.json', (error, data) ->
return reject error if error
bowerDependency.actualVersion = JSON.parse(data).version
name = if bowerDependency.installedName then bowerDependency.installedName else bowerDependency.name
file = src + '/' + name + '/.bower.json'
fs.readFile file, (error, data) ->
unless error
bowerDependency.actualVersion = JSON.parse(data).version
resolve()

ansiTrim = (str) ->
Expand All @@ -69,8 +71,17 @@ makePretty = ({name, actualVersion, wantedVersion, latestVersion}) ->
columns

mapDependencyFromConfig = (value, key) ->
sharpIndex = value.indexOf '#'
if sharpIndex isnt -1
if _.startsWith value, 'git'
value = 'git'
else
installedName = key
key = value.substring 0, sharpIndex
value = value.substring sharpIndex + 1
name: key
wantedVersion: if _.startsWith value, 'git' then 'git' else value
wantedVersion: value
installedName: installedName if installedName?

bowerDependencies = _.map bowerConf.dependencies, mapDependencyFromConfig
bowerDependencies = bowerDependencies.concat _.map bowerConf.devDependencies, mapDependencyFromConfig
Expand Down

0 comments on commit 1043987

Please sign in to comment.