Shea Levy avatar Shea Levy committed d428b1e

Change how topLevel packages are handled

Comments (0)

Files changed (1)

src/npm2nix.coffee

     stream.write """
     \n  "#{escapeNixString name}"."#{escapeNixString spec}" = {
         version = "#{escapeNixString pkg.version}";
-        topLevel = #{if fullNames[name]?[spec]? then 'true' else 'false'};
         dependencies = [
     """
     patchLatest = 'false'
     if pkg.dist.tarball?
       stream.write "\n    tarball = \"#{pkg.dist.tarball}\";"
     stream.write "\n  };"
+    if fullNames[name] is spec
+      stream.write """
+      \n  "#topLevel"."#{escapeNixString name}" = "#{escapeNixString spec}";
+      """
   finalizePkgs = ->
     stream.end "\n}\n"
 
 
     addPackage = (name, spec) ->
       spec = '*' if spec is 'latest' or spec is '' #ugh
-      fullNames[name] ?= {}
-      fullNames[name][spec] = true
+      fullNames[name] = spec
       fetcher.fetch name, spec, registry
     if packages instanceof Array
       for pkg in packages
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.