Skip to content

Commit 2158f27

Browse files
committed
feat(ctl-full): reorganize ctl-full commands
BREAKING CHANGE: webpack and serve removed
1 parent 58a01e9 commit 2158f27

1 file changed

Lines changed: 47 additions & 21 deletions

File tree

ctl-full/flake.nix

Lines changed: 47 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,26 @@
5252
# TODO Affjax FFI should be in ctl-nix
5353
foreign.Affjax.node_modules = node_modules;
5454
};
55+
ps-command = ps.command { };
5556
prebuilt = (pkgs.arion.build {
5657
inherit pkgs;
5758
modules = [ (pkgs.buildCtlRuntime { }) ];
5859
}).outPath;
60+
concurrent = pkgs.writeShellApplication {
61+
name = "concurrent";
62+
runtimeInputs = with pkgs; [
63+
concurrently
64+
];
65+
text = ''
66+
concurrently\
67+
--color "auto"\
68+
--prefix "[{command}]"\
69+
--handle-input\
70+
--restart-tries 10\
71+
"$@"
72+
'';
73+
};
74+
# TODO move from docker runtime to a nix runtime
5975
runtime = pkgs.writeShellApplication {
6076
name = "runtime";
6177
runtimeInputs = [ pkgs.arion pkgs.docker ];
@@ -69,11 +85,10 @@
6985
docker run --rm -it -v "$(pwd)":/data -w /data -v store_node-preview-ipc:/ipc -e CARDANO_NODE_SOCKET_PATH=/ipc/node.socket --entrypoint cardano-cli "inputoutput/cardano-node" "$@"
7086
'';
7187
};
72-
ps-command = ps.command { };
7388
purs-watch = pkgs.writeShellApplication {
7489
name = "purs-watch";
7590
runtimeInputs = with pkgs; [ entr ps-command ];
76-
text = "find src | entr -s 'echo building && purs-nix compile'";
91+
text = ''find {src,test} | entr -s "purs-nix $*"'';
7792
};
7893
webpack = pkgs.writeShellApplication {
7994
name = "webpack";
@@ -88,18 +103,14 @@
88103
dev = pkgs.writeShellApplication {
89104
name = "dev";
90105
runtimeInputs = with pkgs; [
91-
concurrently
106+
concurrent
92107
runtime
93108
purs-watch
94109
serve
95110
];
96111
text = ''
97-
concurrently\
98-
--color "auto"\
99-
--prefix "[{command}]"\
100-
--handle-input\
101-
--restart-tries 10\
102-
purs-watch\
112+
concurrent \
113+
"purs-watch compile"\
103114
serve\
104115
"runtime up"
105116
'';
@@ -111,21 +122,37 @@
111122
};
112123
docs = pkgs.writeShellApplication {
113124
name = "docs";
114-
runtimeInputs = with pkgs; [ nodejs ps-command ];
115-
text = ''purs-nix docs && npx http-server ./generated-docs/html -o'';
125+
runtimeInputs = with pkgs; [
126+
concurrent
127+
nodejs
128+
purs-watch
129+
];
130+
text = ''
131+
concurrent \
132+
"purs-watch docs" \
133+
"npx http-server ./generated-docs/html -o"
134+
'';
135+
};
136+
testInputs = with pkgs; [
137+
plutip-server
138+
postgresql
139+
ogmios
140+
kupo
141+
ogmios-datum-cache
142+
];
143+
# FIXME ctl-full tests not working
144+
# related to LovelaceAcademy/ctl-nix#29
145+
tests = pkgs.writeShellApplication {
146+
name = "tests";
147+
runtimeInputs = testInputs ++ [ purs-watch ];
148+
text = ''purs-watch test "$@"'';
116149
};
117150
in
118151
{
119152
packages.default = ps.output { };
120153

121154
checks.default = (ps.test.check { }).overrideAttrs ({ buildInputs ? [ ], ... }: {
122-
buildInputs = with pkgs; buildInputs ++ [
123-
plutip-server
124-
postgresql
125-
ogmios
126-
kupo
127-
ogmios-datum-cache
128-
];
155+
buildInputs = buildInputs ++ testInputs;
129156
});
130157

131158
devShells.default =
@@ -140,18 +167,17 @@
140167
purs
141168
ps-command
142169
purs-watch
143-
webpack
144-
serve
145170
dev
146171
bundle
147172
docs
173+
tests
148174
];
149175
shellHook = ''
150176
alias log_='printf "\033[1;32m%s\033[0m\n" "$@"'
151177
alias info_='printf "\033[1;34m[INFO] %s\033[0m\n" "$@"'
152178
alias warn_='printf "\033[1;33m[WARN] %s\033[0m\n" "$@"'
153179
log_ "Welcome to ctl-full shell."
154-
info_ "Available commands: runtime, cardano-cli, webpack, purs-nix, serve, dev, bundle, docs."
180+
info_ "Available commands: dev, tests, docs, runtime, cardano-cli, purs-nix, bundle."
155181
info_ "testnet-magic for preview is 2"
156182
'';
157183
};

0 commit comments

Comments
 (0)