-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMakefile
107 lines (94 loc) · 3.54 KB
/
Makefile
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
log_target_info = (echo "\e[34m================\n $1\n================\e[39m")
NACARA_LAYOUT_STANDARD_DIR=src/Nacara.Layout.Standard
NACARA_DIR=src/Nacara
NACARA_CORE_DIR=src/Nacara.Core
NACARA_CREATE_DIR=src/Nacara.Create
NACARA_API_GEN_DIR=src/Nacara.ApiGen
# Base of the Fable commands
NACARA_LAYOUT_STANDARD_FABLE=dotnet fable $(NACARA_LAYOUT_STANDARD_DIR)/Source --outDir $(NACARA_LAYOUT_STANDARD_DIR)/dist
NACARA_FABLE=dotnet fable $(NACARA_DIR)/Source --outDir $(NACARA_DIR)/dist
NODEMON_WATCHER=npx nodemon \
--watch $(NACARA_DIR)/dist \
--watch $(NACARA_LAYOUT_STANDARD_DIR)/dist \
--delay 150ms \
--exec \"nacara watch\"
setup-dev:
@$(call log_target_info, "Setting up the npm link for local development")
npm install
dotnet tool restore
cd $(NACARA_DIR) && npm install
cd $(NACARA_LAYOUT_STANDARD_DIR) && npm install
cd $(NACARA_DIR) && npm link
cd $(NACARA_LAYOUT_STANDARD_DIR) && npm link
npm link nacara nacara-layout-standard
unsetup-dev:
@$(call log_target_info, "Unsetting the npm link for local development")
npm unlink nacara nacara-layout-standard
cd $(NACARA_DIR) && npm -g unlink
cd $(NACARA_LAYOUT_STANDARD_DIR) && npm -g unlink
clean:
@$(call log_target_info, "Cleaning...")
# Clean Nacara.Layout.Standard artifacts
rm -rf $(NACARA_LAYOUT_STANDARD_DIR)/dist
rm -rf $(NACARA_LAYOUT_STANDARD_DIR)/Source/bin
rm -rf $(NACARA_LAYOUT_STANDARD_DIR)/Source/obj
# Clean Nacara artifacts
rm -rf $(NACARA_DIR)/dist
rm -rf $(NACARA_DIR)/Source/bin
rm -rf $(NACARA_DIR)/Source/obj
# Clean Nacara.Core artifacts
rm -rf $(NACARA_CORE_DIR)/dist
rm -rf $(NACARA_CORE_DIR)/Source/bin
rm -rf $(NACARA_CORE_DIR)/Source/obj
# Clean generated documentation
rm -rf docs_deploy
watch: clean
# Make sure that the dist directories exists
# Otherwise, nodemon cannot listen to them
@$(call log_target_info, "Setup directories for the watcher")
mkdir $(NACARA_LAYOUT_STANDARD_DIR)/dist
mkdir $(NACARA_DIR)/dist
# Start the different watcher
# 1. Nacara
# 2. Nacara.Layout.Standard
# 3. Nodemon to restart nacara on changes
@$(call log_target_info, "Watching...")
npx concurrently -p none \
"$(NODEMON_WATCHER)" \
"$(NACARA_LAYOUT_STANDARD_FABLE) --watch --sourceMaps" \
"$(NACARA_FABLE) --watch --sourceMaps"
nodemon:
$(NODEMON_WATCHER)
build: clean
@$(call log_target_info, "Building...")
$(NACARA_FABLE)
$(NACARA_LAYOUT_STANDARD_FABLE)
generate-docs: build
@$(call log_target_info, "Generating documentation...")
@# Publish Nacare.Core to have all the dll files available in a single folder
dotnet publish $(NACARA_CORE_DIR)
@# Generate the API reference files
cd $(NACARA_API_GEN_DIR)/Source \
&& dotnet run -f net6.0 -- \
--project Nacara.Core \
-lib ../../Nacara.Core/bin/Debug/netstandard2.0/publish/ \
--output ../../../docs/ \
--base-url /Nacara/
npx nacara
test: build
@$(call log_target_info, "Testing...")
cd $(NACARA_API_GEN_DIR)/Tests && dotnet run
release: test
@$(call log_target_info, "Releasing...")
@# Remove .fable/.gitignore files otherwise npm doesn't publish that directory
rm -rf $(NACARA_DIR)/dist/.fable/.gitignore
rm -rf $(NACARA_LAYOUT_STANDARD_DIR)/dist/.fable/.gitignore
@# Publish the packages
node ./scripts/release-npm.js $(NACARA_DIR)
node ./scripts/release-nuget.js $(NACARA_CORE_DIR) Nacara.Core.fsproj
node ./scripts/release-npm.js $(NACARA_LAYOUT_STANDARD_DIR)
node ./scripts/release-npm.js $(NACARA_CREATE_DIR)
node ./scripts/release-nuget.js $(NACARA_API_GEN_DIR) Source/Nacara.ApiGen.fsproj
publish-docs: release generate-docs
@$(call log_target_info, "Publishing...")
npx gh-pages --dist docs_deploy