Skip to content

Commit

Permalink
marlowe-dashboard-client: provide contracts.json
Browse files Browse the repository at this point in the history
Add an `extraSrcs` input that symlinks `contracts/contracts.json` into
the build. In order to get the same folder during development the
`package.json` provides a `link-contracts` script:

```
$ npm run link-contracts
```
  • Loading branch information
gilligan committed Apr 6, 2021
1 parent 6771caa commit ac7efd3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ rec {

marlowe-dashboard = pkgs.recurseIntoAttrs rec {
inherit (pkgs.callPackage ./marlowe-dashboard-client {
inherit plutus-pab;
inherit plutus-pab marlowe-app;
inherit (plutus.lib) buildPursPackage buildNodeModules filterNpm gitignore-nix;
inherit webCommon webCommonMarlowe;
}) client server-invoker generated-purescript generate-purescript;
}) client server-invoker generated-purescript generate-purescript contractsJSON;
};

marlowe-marketplace = pkgs.recurseIntoAttrs rec {
Expand Down
3 changes: 3 additions & 0 deletions marlowe-dashboard-client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ yarn.lock
.psc-package2nix/
.spago/
.spago2nix/
# contracts is a symlink provided via the nix build
# and should be ignored
contracts
9 changes: 7 additions & 2 deletions marlowe-dashboard-client/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ pkgs, gitignore-nix, webCommon, webCommonMarlowe, buildPursPackage, buildNodeModules, filterNpm, plutus-pab }:
{ pkgs, gitignore-nix, webCommon, webCommonMarlowe, buildPursPackage, buildNodeModules, filterNpm, plutus-pab, marlowe-app }:
let
cleanSrc = gitignore-nix.gitignoreSource ./.;

Expand All @@ -9,6 +9,10 @@ let
githubSourceHashMap = { };
};

contractsJSON = pkgs.writeTextDir "contracts.json" (builtins.toJSON {
marlowe = "${marlowe-app}/bin/marlowe-app";
});

client = buildPursPackage {
inherit pkgs nodeModules;
src = cleanSrc;
Expand All @@ -20,12 +24,13 @@ let
web-common = webCommon;
web-common-marlowe = webCommonMarlowe;
generated = plutus-pab.generated-purescript;
contracts = contractsJSON;
};
packages = pkgs.callPackage ./packages.nix { };
spagoPackages = pkgs.callPackage ./spago-packages.nix { };
};
in
{
inherit (plutus-pab) server-invoker generated-purescript generate-purescript start-backend;
inherit client;
inherit client contractsJSON;
}
3 changes: 2 additions & 1 deletion marlowe-dashboard-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"test:watch": "spago test --no-psa --watch",
"docs": "spago docs",
"repl": "spago repl",
"start": "npm install && plutus-pab-generate-purs && npm run purs:compile && npm run webpack:server"
"start": "npm install && plutus-pab-generate-purs && npm run link-contracts && npm run purs:compile && npm run webpack:server",
"link-contracts": "nix-build ../default.nix -A marlowe-dashboard.contractsJSON -o contracts"
},
"dependencies": {
"json-bigint": "^1.0.0"
Expand Down

0 comments on commit ac7efd3

Please sign in to comment.