-
Notifications
You must be signed in to change notification settings - Fork 58
/
format.sh
executable file
·33 lines (25 loc) · 984 Bytes
/
format.sh
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
#!/usr/bin/env bash
# Ensure path is passed in
if [ -z "$1" ]; then
echo "No argument supplied, please enter the filepath of the xpra-html5 project"
exit 1
fi
# Ensure path passed in is a folder
if [ ! -d "$1" ]; then
echo "$1 either does not exist or is not a folder, please enter the filepath of the xpra-html5 project"
exit 1
fi
# Check if nix is installed, if it isn't, use the determinate nix installer
if command -v nix 2>&1 >/dev/null; then
echo "Nix is installed, formatting..."
else
echo "Nix is not installed, using Determinate Nix Installer..."
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | \
sh -s -- install
echo "Nix has been installed, formatting..."
fi
nix-shell $1/shell.nix --run "
js-beautify --config $1/.jsbeautifyrc --type js -r $1/html5/js/*.js;
js-beautify --config $1/.jsbeautifyrc --type html -r $1/html5/*.html;
js-beautify --config $1/.jsbeautifyrc --type css -r $1/html5/css/*.css;
"