Skip to content
This repository has been archived by the owner on May 20, 2021. It is now read-only.

mkYarnWorkspace ignores workspace paths which yarn would ignore #89

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,15 @@ in rec {
else lib.concatMap (child: expandGlobList (base+("/"+child)) rest) matchingChildren;
# Path -> PathGlob -> [Path]
expandGlob = base: glob: expandGlobList base (splitGlob glob);
packagePaths = lib.concatMap (expandGlob src) packageGlobs;
validPackage = path:
let
packageJSON = path+"/package.json";
package = lib.importJSON packageJSON;
in
builtins.pathExists (path+"/package.json") &&
builtins.hasAttr "name" package &&
builtins.hasAttr "version" package;
packagePaths = builtins.filter validPackage (lib.concatMap (expandGlob src) packageGlobs);
packages = lib.listToAttrs (map (src:
let
packageJSON = src+"/package.json";
Expand Down
8 changes: 8 additions & 0 deletions tests/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ in
'';
};
}).package-one;
inherit (yarn2nix.mkYarnWorkspace {
src = fetchFromGitHub {
owner = "facebook";
repo = "nuclide";
rev = "v0.366.0";
sha256 = "1iyy8by8p90dncyqi3pgaj36hmz1khi9w1rkhd5gi9nbkkv5can4";
};
}) nuclide-node-transpiler;
} // {
duplicate-pkgs = import ./duplicate-pkgs { inherit yarn2nix; };
no-import-from-derivation = import ./no-import-from-derivation {
Expand Down
Empty file.
4 changes: 4 additions & 0 deletions tests/workspace/package-nameless/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"version": "1.0.0",
"license": "MIT"
}
4 changes: 4 additions & 0 deletions tests/workspace/package-versionless/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "versionless",
"license": "MIT"
}