-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.justfile
118 lines (88 loc) · 3.12 KB
/
.justfile
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/usr/bin/env just --justfile
set dotenv-load
project_name := "Swatch"
plugins_dir := if os_family() == "unix" {
"$HOME/Documents/Roblox/Plugins"
} else {
"$LOCALAPPDATA/Roblox/Plugins"
}
plugin_root := absolute_path("plugin")
plugin_source := plugin_root / "src"
plugin_project := plugin_root / "default.project.json"
plugin_filename := project_name + ".rbxm"
plugin_output := plugins_dir / plugin_filename
plugin_build := plugin_root / "build"
server_root := absolute_path("server")
server_source := server_root / "src"
server_project := server_root / "default.project.json"
testez_defs_path := absolute_path("testez.d.lua")
global_defs_path := tmpdir / "globalTypes.d.lua"
sourcemap_path := tmpdir / "sourcemap.json"
tmpdir := `mktemp -d`
default:
@just --list
clean:
rm -rf {{ plugin_output }}
rm -rf {{ plugin_build }}
lint:
selene {{ plugin_source }}
stylua --check {{ plugin_source }}
selene {{ server_source }}
stylua --check {{ server_source }}
_get-plugin-name:
jq -r .name {{ plugin_root / "default.project.json" }}
_prune:
rm -rf {{ plugin_build / "**/*.spec.luau" }}
rm -rf {{ plugin_build / "**/*.story.luau" }}
rm -rf {{ plugin_build / "**/*.storybook.luau" }}
_build target output:
-rm -rf {{ plugin_build }}
-mkdir -p {{ plugin_build }}
rojo sourcemap {{ plugin_project }} -o {{ plugin_root / "sourcemap.json" }}
darklua process {{ plugin_source }} {{ plugin_build }} \
--config {{ plugin_root / ".darklua.json" }}
{{ if target == "prod" { `just _prune` } else { `` } }}
-mkdir -p {{ parent_directory(output) }}
rojo build {{ plugin_root / "build.project.json" }} -o {{ output }}
init:
foreman install
lune setup
just wally-install
wally-install:
wally install --project-path {{ plugin_root }}
rojo sourcemap {{ plugin_project }} -o {{ sourcemap_path }}
cd plugin && wally-package-types --sourcemap {{ sourcemap_path }} Packages/
build target="prod":
just _build {{ target }} {{ plugin_output }}
build-watch target="prod":
npx -y chokidar-cli "{{ plugin_source }}/**/*" --initial \
-c "just _build {{ target }} {{ plugin_output }}" \
build-here target="prod" filename=plugin_filename:
just _build {{ target }} {{ filename }}
test: clean
rojo build {{ plugin_project }} -o {{ tmpdir / "tests.rbxl" }}
run-in-roblox --place {{ tmpdir / "tests.rbxl" }} --script tests/init.server.lua
test-server:
find server -name "*.spec.lua*" -exec lune run {} \;
serve:
docker compose up
serve-watch:
docker compose watch --no-up & docker compose up
plugin-analyze:
curl -s -o {{ global_defs_path }} \
-O https://raw.githubusercontent.com/JohnnyMorganz/luau-lsp/master/scripts/globalTypes.d.lua
rojo sourcemap {{ plugin_project }} -o {{ sourcemap_path }}
luau-lsp analyze --sourcemap={{ sourcemap_path }} \
--defs={{ global_defs_path }} \
--defs={{ testez_defs_path }} \
--settings="./.vscode/settings.json" \
--ignore=**/Packages/** \
{{ plugin_source }}
server-analyze:
rojo sourcemap {{ server_project }} -o {{ sourcemap_path }}
luau-lsp analyze --sourcemap={{ sourcemap_path }} \
--settings="./.vscode/settings.json" \
{{ server_source }}
analyze:
just plugin-analyze
just server-analyze