-
-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathdoit
103 lines (93 loc) · 2.55 KB
/
doit
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
doit_dev = "doit -t .doit-files/dev.doit"
doit_env = "doit -t .doit-files/env.doit"
doit_utl = "doit -t .doit-files/utl.doit"
init {
@ Initializes the currently targetted module
opt -g @ This is to initlaize the global environment
$$$
if [ "$1" = "-g" ]; then
npm install
exit
fi
cd $$($doit_env tgt -r) || exit
if [ ! -e "include" ]; then exit 0 ; fi
rm -Rf common/ || exit
mkdir common/ || exit
echo "\e[32mUpdating referenced common files\e[0m"
for item in $$(cat include || exit); do
ln -s ../../common/$$item common/$$item || exit
done
$$$
}
clean {
@ Cleans up the target module directory
opt -g @ If specified, will remove the global build files/directories
$$$
if [ "$1" = "-g" ]; then
echo "Cleaning global"
rm -Rf node_modules
rm -Rf release
rm -f package-lock.json
sleep 0.5 && rm -Rf .doit || echo "\e[91mThis failure may be due to a doit programming still running. Maybe you have 'doit launch' running in the background?\e[0m" &
else
target="$$($doit_env tgt -r)"
cd $$($doit_env tgt -r) || exit
echo "\e[32mCleaning: \e[34m$$target\e[0m"
rm -Rf common
fi
$$$
}
dev {
@ Copy the targetted module's data to the set foundry data directory
opt module_name @ Provide the module name you wish to deploy instead of\nthe current target
$ $doit_dev dev $@
}
watch {
@@@
Watches the current target module for file changes and executes `dev`
if a change occurs
@@@
$ $doit_dev watch $@
}
pack {
@ Package the targetted module for release
$ $doit_dev pack $@
}
tag {
@ Tag the current commit for release of the currently targetted module
$ $doit_dev tag $@
}
tgt {
@@@
Get/Set the target module for development/release. If no target name
is provided, it will print the current target.
@@@
opt name @ name of the target to be set
opt -r @ If you omit a name, this will print the current target raw.
$ $doit_env tgt $@
}
env {
@ Set the foundry environment
req f-path @ Path to the Foundry Install directory
req f-data @ Path to the Foundry Data directory
$ $doit_env env $@
}
lint {
@ Run ESLint to check validity of files
$ npx eslint '**/{src,common}/**/*.{js,mjs}'
}
getref {
@@@
Create a sym-link to the foundry.js file found in the set environment.
This reference is used for type hinting and for checking on how Foundry
does certain things.
@@@
$$$
rm -f fvtt-scripts
ln -s "$$(jq -r .foundry.path .devenv)/resources/app/public/scripts/" fvtt-scripts
$$$
}
launch {
@ Launch the foundry server
$ sudo $$(which node) "$$(jq -r .foundry.path .devenv)/resources/app/main.js" --dataPath="$$(jq -r .foundry.data .devenv)"
}