Merge pull request #128119 from Simspace/yarn2nix-preserve-resolutions

yarn2nix: preserve top-level package.json resolutions field in workspace

authored by

Silvan Mosberger and committed by
GitHub
c7b52869 79fc85e9

+8 -4
+8 -4
pkgs/development/tools/yarn2nix-moretea/yarn2nix/default.nix
··· 74 preBuild ? "", 75 postBuild ? "", 76 workspaceDependencies ? [], # List of yarn packages 77 }: 78 let 79 extraNativeBuildInputs = ··· 98 99 workspaceJSON = pkgs.writeText 100 "${name}-workspace-package.json" 101 - (builtins.toJSON { private = true; workspaces = ["deps/**"]; }); # scoped packages need second splat 102 103 workspaceDependencyLinks = lib.concatMapStringsSep "\n" 104 (dep: '' ··· 176 177 packageGlobs = if lib.isList package.workspaces then package.workspaces else package.workspaces.packages; 178 179 globElemToRegex = lib.replaceStrings ["*"] [".*"]; 180 181 # PathGlob -> [PathGlobElem] ··· 223 inherit name; 224 value = mkYarnPackage ( 225 builtins.removeAttrs attrs ["packageOverrides"] 226 - // { inherit src packageJSON yarnLock workspaceDependencies; } 227 // lib.attrByPath [name] {} packageOverrides 228 ); 229 }) ··· 245 extraBuildInputs ? [], 246 publishBinsFor ? null, 247 workspaceDependencies ? [], # List of yarnPackages 248 ... 249 }@attrs: 250 let ··· 264 preBuild = yarnPreBuild; 265 postBuild = yarnPostBuild; 266 workspaceDependencies = workspaceDependenciesTransitive; 267 - inherit packageJSON pname version yarnLock offlineCache yarnFlags pkgConfig; 268 }; 269 270 publishBinsFor_ = unlessNull publishBinsFor [pname]; ··· 298 '') 299 workspaceDependenciesTransitive; 300 301 - in stdenv.mkDerivation (builtins.removeAttrs attrs ["yarnNix" "pkgConfig" "workspaceDependencies"] // { 302 inherit src pname; 303 304 name = baseName;
··· 74 preBuild ? "", 75 postBuild ? "", 76 workspaceDependencies ? [], # List of yarn packages 77 + packageResolutions ? {}, 78 }: 79 let 80 extraNativeBuildInputs = ··· 99 100 workspaceJSON = pkgs.writeText 101 "${name}-workspace-package.json" 102 + (builtins.toJSON { private = true; workspaces = ["deps/**"]; resolutions = packageResolutions; }); # scoped packages need second splat 103 104 workspaceDependencyLinks = lib.concatMapStringsSep "\n" 105 (dep: '' ··· 177 178 packageGlobs = if lib.isList package.workspaces then package.workspaces else package.workspaces.packages; 179 180 + packageResolutions = package.resolutions or {}; 181 + 182 globElemToRegex = lib.replaceStrings ["*"] [".*"]; 183 184 # PathGlob -> [PathGlobElem] ··· 226 inherit name; 227 value = mkYarnPackage ( 228 builtins.removeAttrs attrs ["packageOverrides"] 229 + // { inherit src packageJSON yarnLock packageResolutions workspaceDependencies; } 230 // lib.attrByPath [name] {} packageOverrides 231 ); 232 }) ··· 248 extraBuildInputs ? [], 249 publishBinsFor ? null, 250 workspaceDependencies ? [], # List of yarnPackages 251 + packageResolutions ? {}, 252 ... 253 }@attrs: 254 let ··· 268 preBuild = yarnPreBuild; 269 postBuild = yarnPostBuild; 270 workspaceDependencies = workspaceDependenciesTransitive; 271 + inherit packageJSON pname version yarnLock offlineCache yarnFlags pkgConfig packageResolutions; 272 }; 273 274 publishBinsFor_ = unlessNull publishBinsFor [pname]; ··· 302 '') 303 workspaceDependenciesTransitive; 304 305 + in stdenv.mkDerivation (builtins.removeAttrs attrs ["yarnNix" "pkgConfig" "workspaceDependencies" "packageResolutions"] // { 306 inherit src pname; 307 308 name = baseName;