packages feed

yarn2nix 0.7.0 → 0.8.0

raw patch · 6 files changed

+82/−48 lines, 6 filesdep +prettyprinterdep −ansi-wl-pprintdep ~aesondep ~hnixdep ~stmPVP ok

version bump matches the API change (PVP)

Dependencies added: prettyprinter

Dependencies removed: ansi-wl-pprint

Dependency ranges changed: aeson, hnix, stm, tasty-quickcheck, yarn-lock

API changes (from Hackage documentation)

- Distribution.Nixpkgs.Nodejs.ResolveLockfile: resolveLockfileStatus :: (Chan Remote) -> Lockfile -> IO (Either (NonEmpty Text) ResolvedLockfile)
+ Distribution.Nixpkgs.Nodejs.ResolveLockfile: resolveLockfileStatus :: Chan Remote -> Lockfile -> IO (Either (NonEmpty Text) ResolvedLockfile)
- Distribution.Nodejs.Package: BinFiles :: (HashMap Text FilePath) -> Bin
+ Distribution.Nodejs.Package: BinFiles :: HashMap Text FilePath -> Bin
- Distribution.Nodejs.Package: ManFiles :: (HashMap Text FilePath) -> Man
+ Distribution.Nodejs.Package: ManFiles :: HashMap Text FilePath -> Man

Files

nix-lib/default.nix view
@@ -89,7 +89,7 @@           in ''             echo "linking node dependency ${formatKey dep.key}"             ${ # we need to create the scope folder, otherwise ln fails-               lib.optionalString hasScope ''mkdir "${parentfolder}"'' }+               lib.optionalString hasScope ''mkdir -p "${parentfolder}"'' }             ln -sT ${dep.drv} "${subfolder}"             ${yarn2nix}/bin/node-package-tool \               link-bin \
nix-lib/old-version-dependencies.nix view
@@ -3,14 +3,13 @@   yarn-lock =     super.mkDerivation rec {       pname = "yarn-lock";-      version = "0.5.0";+      version = "0.6.2";       # src = ../../../haskell/yarn-lock;       src = pkgs.fetchFromGitHub {         owner = "Profpatsch";         repo = "yarn-lock";         rev = version;-        # rev = "61cc65a858db92e7c0bea861bf279f286c34bb81";-        sha256 = "007a7n1qqa7cp85bbw00yvkg2ikg1yzj1k8i9bav1bnbk6n7xp7s";+        sha256 = "06171ya075yx88gfx39z6mh1k1al0qaqrarbas5mv6lrky19bdxs";       };       license = lib.licenses.mit;       buildDepends = with self; [ megaparsec protolude tasty-hunit tasty-th either neat-interpolation tasty-quickcheck quickcheck-instances ];
src/Distribution/Nixpkgs/Nodejs/Cli.hs view
@@ -14,7 +14,7 @@ import qualified System.Directory as Dir  import qualified Nix.Pretty as NixP-import Text.PrettyPrint.ANSI.Leijen (putDoc)+import Data.Text.Prettyprint.Doc.Render.Text (putDoc) import qualified Yarn.Lock as YL import qualified Yarn.Lock.Types as YLT import qualified Yarn.Lock.Helpers as YLH
src/Distribution/Nixpkgs/Nodejs/OptimizedNixOutput.hs view
@@ -78,12 +78,14 @@  -- | Final package reference used in the generated package list. data PkgRef+  -- | reference to another package definition (e.g. @^1.2@ points to @1.2@)   = PkgRef Text-    -- ^ reference to another package definition (e.g. @^1.2@ points to @1.2@)   | PkgDefFile (PkgData (Either Text Registry))-    -- ^ actual definiton of a file package+  -- ^ actual definition of a file package+  | PkgDefFileLocal (PkgData Text)+  -- ^ actual definition of a local package (tar.gz file relative to nix expression)   | PkgDefGit  (PkgData Git)-    -- ^ actual definiton of a git package+  -- ^ actual definition of a git package  -- | Package definition needed for calling the build function. data PkgData a = PkgData@@ -115,6 +117,7 @@   , (["registries", "yarn"], "y")   , (["registries", "npm"], "n")   , (["nodeFilePackage"], "f")+  , (["nodeFileLocalPackage"], "l")   , (["nodeGitPackage"], "g")   , (["identityRegistry"], "ir")   , (["scopedName"], "sc")@@ -164,8 +167,14 @@         YLT.FileRemote{fileUrl} ->           PkgDefFile $ pkgDataGeneric $ note fileUrl             $ recognizeRegistry defName fileUrl+        YLT.FileLocal{fileLocalPath} ->+          PkgDefFileLocal $ pkgDataGeneric $ fileLocalPath         YLT.GitRemote{gitRepoUrl, gitRev} ->           PkgDefGit $ pkgDataGeneric $ Git gitRepoUrl gitRev+        YLT.FileRemoteNoIntegrity{..} ->+          panic "programming error, should have thrown an error in ResolveLockfile"+        YLT.FileLocalNoIntegrity{..} ->+          panic "programming error, should have thrown an error in ResolveLockfile"                  -- we don’t need another ref indirection                  -- if that’s already the name of our def       refNames = List.delete defSym $ toList $ NE.nub@@ -188,6 +197,7 @@   # We want each package definition to be one line, by putting   # the boilerplate into these functions for different remotes.   nodeFilePackage = …+  nodeFileLocalPackage = …   nodeGitPackage = …    # an identity function for e.g. git repos or unknown registries@@ -200,6 +210,7 @@   s = self;   ir = identityRegistry;   f = nodeFilePackage;+  l = nodeFileLocalPackage;   g = nodeGitPackage;   y = registries.yarnpkg;   sc = scopedName;@@ -214,6 +225,7 @@   "babel-core@6.24.1" = f "babel-core" "6.24.1" y "a0e457c58ebdbae575c9f8cd75127e93756435d8" [     s."accepts@~1.3.3"   ];+  "local-package@file:../foo.tgz" = l "local-package" "file:../foo.tgz" ../foo.tgz "thehash" [] } @ -}@@ -230,6 +242,7 @@     ==> N.mkLets         (  [ "registries" $= N.mkNonRecSet (fmap (mkRegistry . snd) registries)            , "nodeFilePackage" $= buildPkgFn+           , "nodeFileLocalPackage" $= buildPkgLocalFn            , "nodeGitPackage" $= buildPkgGitFn            , "identityRegistry" $= NA.multiParam ["url", "_", "_"] "url"            , "scopedName" $=@@ -265,6 +278,15 @@         ("fetchurl" @@ N.mkNonRecSet           [ "url" $= ("registry" @@ "key" @@ "version")           , inheritStatic ["sha1"] ])+    -- | Building a 'YLT.FileLocal' package.+    buildPkgLocalFn :: NExpr+    buildPkgLocalFn =+      buildPkgFnGeneric ["path", "sha1"]+        ("builtins.path" @@ N.mkNonRecSet+          [ inheritStatic ["path"]+          -- TODO: use the sha1 here! (does builtins.path only take sha256?)+          -- , "sha256" $= "sha1"+          ])     -- | Building a 'YLT.GitRemote' package.     buildPkgGitFn :: NExpr     buildPkgGitFn =@@ -272,16 +294,7 @@         ("fetchgit" @@ N.mkNonRecSet           [ inheritStatic ["url", "rev", "sha256"] ]) -    mkDefGeneric :: PkgData a -> NSym -> [NExpr] -> NExpr-    mkDefGeneric PkgData{..} buildFnSym additionalArguments =-      foldl' (@@) (shorten [buildFnSym])-        $ [ case pkgDataName of-              YLT.SimplePackageKey n -> N.mkStr n-              YLT.ScopedPackageKey s n -> "sc" @@ N.mkStr s @@ N.mkStr n-          , N.mkStr pkgDataVersion ]-          <> additionalArguments <>-          [ N.mkList $ map (N.mkSym selfSym !!.) pkgDataDependencies ]-+    -- | Create a package definition.     mkPkg :: (Text, PkgRef) -> N.Binding NExpr     mkPkg (key, pkgRef) = key $$= case pkgRef of       PkgRef t -> N.mkSym selfSym !!. t@@ -291,9 +304,22 @@                    (\reg -> shorten ["registries", registrySym reg])                    pkgDataUpstream           , N.mkStr pkgDataHashSum ]+      PkgDefFileLocal pd@PkgData{pkgDataUpstream = path, pkgDataHashSum} ->+        mkDefGeneric pd "nodeFileLocalPackage" [ N.mkPath False (toS path), N.mkStr pkgDataHashSum ]       PkgDefGit pd@PkgData{pkgDataUpstream = Git{..}, pkgDataHashSum} ->         mkDefGeneric pd "nodeGitPackage"           [ N.mkStr gitUrl, N.mkStr gitRev, N.mkStr pkgDataHashSum ]++    -- | The common parts of creating a package definition.+    mkDefGeneric :: PkgData a -> NSym -> [NExpr] -> NExpr+    mkDefGeneric PkgData{..} buildFnSym additionalArguments =+      foldl' (@@) (shorten [buildFnSym])+        $ [ case pkgDataName of+              YLT.SimplePackageKey n -> N.mkStr n+              YLT.ScopedPackageKey s n -> "sc" @@ N.mkStr s @@ N.mkStr n+          , N.mkStr pkgDataVersion ]+          <> additionalArguments <>+          [ N.mkList $ map (N.mkSym selfSym !!.) pkgDataDependencies ]      selfSym :: Text     selfSym = "s"
src/Distribution/Nixpkgs/Nodejs/ResolveLockfile.hs view
@@ -59,7 +59,16 @@     resolve :: YLT.Package -> E.ExceptT Text IO (Resolved YLT.Package)     resolve pkg = case YLT.remote pkg of       YLT.FileRemote{..} -> pure $ r fileSha1+      YLT.FileLocal{..}  -> pure $ r fileLocalSha1       YLT.GitRemote{..}  -> r <$> fetchFromGit gitRepoUrl gitRev+      YLT.FileRemoteNoIntegrity{..} -> E.throwE+        $ "The remote "+        <> fileNoIntegrityUrl+        <> " does not specify a sha1 hash in the yarn.lock file, which we don’t support (yet)"+      YLT.FileLocalNoIntegrity{..} -> E.throwE+        $ "The local file "+        <> fileLocalNoIntegrityPath+        <> " does not specify a sha1 hash in the yarn.lock file, which we don’t support (yet)"       where         r sha = Resolved { hashSum = sha, resolved = pkg } 
yarn2nix.cabal view
@@ -1,11 +1,13 @@--- This file has been generated from package.yaml by hpack version 0.27.0.+cabal-version: 1.12++-- This file has been generated from package.yaml by hpack version 0.33.0. -- -- see: https://github.com/sol/hpack ----- hash: 9f5e62ecebb812a5457199df157d56a8529dd64b80a8ea3c7fbbbf22d86627f3+-- hash: 5daa56420b918ef3cbd08426830e2e6fd2caf9897d7b21ec8141f33a81148fd3  name:           yarn2nix-version:        0.7.0+version:        0.8.0 synopsis:       Convert yarn.lock files to nix expressions description:    Convert @yarn.lock@ files to nix expressions. See @yarn2nix@ executable. Contains a nix library to call the generated nix files in @nix-lib/@. Library functions and module names might be restructured in the future. category:       Distribution, Nix@@ -16,17 +18,15 @@ license:        MIT license-file:   LICENSE build-type:     Simple-cabal-version:  >= 1.10- extra-source-files:-    default.nix     LICENSE+    README.md+    yarn2nix.nix+    default.nix+    shell.nix     nix-lib/buildNodePackage.nix     nix-lib/default.nix     nix-lib/old-version-dependencies.nix-    README.md-    shell.nix-    yarn2nix.nix  source-repository head   type: git@@ -47,8 +47,7 @@       src   ghc-options: -Wall   build-depends:-      aeson >=1.0 && <1.3-    , ansi-wl-pprint ==0.6.*+      aeson >=1.0 && <1.5     , async-pool ==0.9.*     , base ==4.*     , bytestring ==0.10.*@@ -56,17 +55,18 @@     , data-fix ==0.0.7 || ==0.2.0     , directory ==1.3.*     , filepath ==1.4.*-    , hnix ==0.5.*+    , hnix ==0.6.*     , mtl ==2.2.*+    , prettyprinter ==1.2.*     , process >=1.4     , protolude ==0.2.*     , regex-tdfa ==1.2.*     , regex-tdfa-text ==1.0.0.*-    , stm ==2.4.*+    , stm >2.4.0 && <2.6.0.0     , text ==1.2.*     , transformers ==0.5.*     , unordered-containers ==0.2.*-    , yarn-lock ==0.5.*+    , yarn-lock ==0.6.*   default-language: Haskell2010  executable node-package-tool@@ -75,8 +75,7 @@       Paths_yarn2nix   ghc-options: -Wall   build-depends:-      aeson >=1.0 && <1.3-    , ansi-wl-pprint ==0.6.*+      aeson >=1.0 && <1.5     , async-pool ==0.9.*     , base ==4.*     , bytestring ==0.10.*@@ -84,19 +83,20 @@     , data-fix ==0.0.7 || ==0.2.0     , directory ==1.3.*     , filepath ==1.4.*-    , hnix ==0.5.*+    , hnix ==0.6.*     , mtl ==2.2.*     , optparse-applicative >=0.13 && <0.15+    , prettyprinter ==1.2.*     , process >=1.4     , protolude ==0.2.*     , regex-tdfa ==1.2.*     , regex-tdfa-text ==1.0.0.*-    , stm ==2.4.*+    , stm >2.4.0 && <2.6.0.0     , text ==1.2.*     , transformers ==0.5.*     , unix ==2.7.*     , unordered-containers ==0.2.*-    , yarn-lock ==0.5.*+    , yarn-lock ==0.6.*     , yarn2nix   default-language: Haskell2010 @@ -106,8 +106,7 @@       Paths_yarn2nix   ghc-options: -Wall   build-depends:-      aeson >=1.0 && <1.3-    , ansi-wl-pprint ==0.6.*+      aeson >=1.0 && <1.5     , async-pool ==0.9.*     , base ==4.*     , bytestring ==0.10.*@@ -115,17 +114,18 @@     , data-fix ==0.0.7 || ==0.2.0     , directory ==1.3.*     , filepath ==1.4.*-    , hnix ==0.5.*+    , hnix ==0.6.*     , mtl ==2.2.*+    , prettyprinter ==1.2.*     , process >=1.4     , protolude ==0.2.*     , regex-tdfa ==1.2.*     , regex-tdfa-text ==1.0.0.*-    , stm ==2.4.*+    , stm >2.4.0 && <2.6.0.0     , text ==1.2.*     , transformers ==0.5.*     , unordered-containers ==0.2.*-    , yarn-lock ==0.5.*+    , yarn-lock ==0.6.*     , yarn2nix   default-language: Haskell2010 @@ -139,8 +139,7 @@       tests   ghc-options: -Wall   build-depends:-      aeson >=1.0 && <1.3-    , ansi-wl-pprint ==0.6.*+      aeson >=1.0 && <1.5     , async-pool ==0.9.*     , base ==4.*     , bytestring ==0.10.*@@ -148,21 +147,22 @@     , data-fix ==0.0.7 || ==0.2.0     , directory ==1.3.*     , filepath ==1.4.*-    , hnix ==0.5.*+    , hnix ==0.6.*     , mtl ==2.2.*     , neat-interpolation ==0.3.*+    , prettyprinter ==1.2.*     , process >=1.4     , protolude ==0.2.*     , regex-tdfa ==1.2.*     , regex-tdfa-text ==1.0.0.*-    , stm ==2.4.*+    , stm >2.4.0 && <2.6.0.0     , tasty >=0.11 && <1.2     , tasty-hunit >=0.9 && <0.11-    , tasty-quickcheck ==0.8.* || ==0.9.*+    , tasty-quickcheck >=0.8 && <0.11     , tasty-th ==0.1.7.*     , text ==1.2.*     , transformers ==0.5.*     , unordered-containers ==0.2.*-    , yarn-lock ==0.5.*+    , yarn-lock ==0.6.*     , yarn2nix   default-language: Haskell2010