forked from windmill-labs/windmill
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.nu
More file actions
executable file
·54 lines (41 loc) · 1.22 KB
/
dev.nu
File metadata and controls
executable file
·54 lines (41 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#! /usr/bin/env nu
let cache = "/tmp/windmill/cache/python_311/"
# Clean cache
def "main clean" [] {
^rm -rf ($cache ++ "/wmill*")
}
# Watch changes in directory and autopatch (watchexec required)
def "main watch" [] {
# watchexec -w ../backend/windmill-api/openapi.yaml './dev.nu -g' &
# TODO: Watch openapi.yaml
^watchexec ./dev.nu -p
}
# Build client and move to windmill's cache
# To build you will need nushell and tsc (typescript compiler)
# If none arguments selected, all will be turned on
# If any argument specified, all others will be disabled
def main [
--gen(-g) # Generate code (OpenAPI codegen)
--compile(-c) # Compile code (TS >> JS)
--patch(-p) # Patch
] {
let do_all = not ($gen or $compile or $patch);
# TODO: Gen windmill-client.js
# TODO: Gen bundle? (README_DEV.md)
if ($do_all or $gen) {
print "Generating code from openapi.yml..."
./build.sh
}
if ($do_all or $patch) {
print "Patching cache..."
# Clean up in all versions
rm -rf ($cache ++ wmill*/wmill/*)
# Copy files from local ./dist to every wm-client version in cache
ls /tmp/windmill/cache/python_311/wmill* | each {
|i|
let path = $i | get name;
^cp -r wmill/wmill/* ($path ++ "/wmill")
}
}
print Done!
}