forked from rescript-lang/rescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsuffix.sh
executable file
·56 lines (47 loc) · 893 Bytes
/
suffix.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
source "./utils.sh"
cd ../testrepo
bold "Test: It should support custom suffixes"
# Clean Repo
sleep 1
if rewatch clean &> /dev/null;
then
success "Repo Cleaned"
else
error "Error Cleaning Repo"
exit 1
fi
# Replace suffix
replace "s/.mjs/.res.js/g" bsconfig.json
if rewatch build &> /dev/null;
then
success "Repo Built"
else
error "Error building repo"
exit 1
fi
# Count files with new extension
file_count=$(find . -name *.res.js | wc -l)
if [ "$file_count" -eq 9 ];
then
success "Found files with correct suffix"
else
error "Suffix not correctly used"
exit 1
fi
if rewatch clean &> /dev/null;
then
success "Repo Cleaned"
else
error "Error Cleaning Repo"
exit 1
fi
# Restore Suffix
replace "s/.res.js/.mjs/g" bsconfig.json
# Restore original build
if rewatch build &> /dev/null;
then
success "Repo Built"
else
error "Error building repo"
exit 1
fi