Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Building the `node_modules` folder is not actually purescript specific and is more of an input so this commit splits off the use of npmlock2nix for building a `node_modules` output to node_modules.nix and a `buildNodeModules` function in `plutus.lib.buildNodeModules`
- Loading branch information
Showing
3 changed files
with
38 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ npmlock2nix | ||
, nodejs | ||
, python2 | ||
, stdenv | ||
, lib | ||
, CoreServices ? null # needed by darwin only | ||
, xcodebuild ? null # needed by darwin only | ||
}: | ||
let | ||
# Takes a source and extracts `package.json, package-lock.json` from it | ||
# Type: Path -> Path | ||
getPackageFiles = src: lib.cleanSourceWith { | ||
filter = (path: type: lib.elem (baseNameOf path) [ "package.json" "package-lock.json" ]); | ||
inherit src; | ||
}; | ||
in | ||
# Description: Takes a `projectDir` path to a directory containing a `package.json` and a `package-lock.json` | ||
# and creates an output containing `node_modules/, package.json, package-lock.json`. The `buildInputs` | ||
# will be avaibale during `npm install` | ||
# Type: Attr { projectDir: Path, buildInputs: List } -> Derivation | ||
{ projectDir, buildInputs ? [ ] }: | ||
npmlock2nix.node_modules { | ||
inherit nodejs; | ||
src = getPackageFiles projectDir; | ||
buildInputs = [ python2 ] | ||
++ lib.optionals (stdenv.isDarwin) [ CoreServices xcodebuild ] | ||
++ buildInputs; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters