-
Notifications
You must be signed in to change notification settings - Fork 23
/
Makefile
405 lines (298 loc) · 13.5 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
.PHONY: server build
NODE_VERSION=v12.6.0
RELEASES := $(PWD)/releases
LAST_RELEASE=$(RELEASES)/last_release
VERSION=$(shell sh ./release-version.sh)
VERSION_FILE_PATH=$(shell sh ./release-version-file-path.sh)
ifeq ($(shell uname), Darwin)
target=darwin
else ifeq ($(shell uname), Linux)
target=linux
else
target=$()
endif
fresh-install:
rm -rf packages/*/node-modules
npm run bootstrap
docker-image:
docker build -t registry.gitlab.com/deepkit/deepkit-project/server .
docker-push:
docker push registry.gitlab.com/deepkit/deepkit-project/server
docker-linux-build-image:
docker build -t deepkit/build-linux -f docker-build/Dockerfile .
test-ci:
id
echo $(PWD)
ls -al $(PWD)
npm install -g coveralls lerna yarn npm-local-development
lerna bootstrap --nohoist \* --no-ci
npm-local-development --no-watcher
cd packages/core && npm run test
cd packages/core-node && npm run test
# cd packages/server && npm run test
# ./node_modules/.bin/jest --coverage
# cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
release:
echo "Build release $(RELEASES)/$(VERSION), target=$(target)"
-[ -f "$(RELEASES)/$(VERSION)" ] && echo "Release already exists $(RELEASES)/$(VERSION)"
[ ! -f "$(RELEASES)/$(VERSION)" ] && make release-$(target)
# CLI LINUX
/tmp/node-$(NODE_VERSION)-linux-x64/bin/node:
rm -rf /tmp/node-$(NODE_VERSION)-linux-x64-tar
rm -rf /tmp/node-$(NODE_VERSION)-linux-x64
mkdir -p /tmp/node-$(NODE_VERSION)-linux-x64-tar
tar xf libs/node/node-$(NODE_VERSION)-linux-x64.tar.gz -C /tmp/node-$(NODE_VERSION)-linux-x64-tar
mv /tmp/node-$(NODE_VERSION)-linux-x64-tar/* /tmp/node-$(NODE_VERSION)-linux-x64
build/linux/cli/bin/node: /tmp/node-$(NODE_VERSION)-linux-x64/bin/node
mkdir -p build/linux/cli/bin
cp /tmp/node-$(NODE_VERSION)-linux-x64/bin/node build/linux/cli/bin;
#/docker/deepkit/docker-image-cli-linux:
# @if ! docker images | grep deepkit/build-cli-linux; then \
# docker build -t deepkit/build-cli-linux -f docker-build/npm-install.Dockerfile packages/cli; \
# fi
#docker/build/linux/cli/node_modules: /docker/deepkit/docker-image-cli-linux
# mkdir -p build/linux/cli/
# @id=$(shell docker create deepkit/build-cli-linux); \
# docker cp $$id:/app/node_modules build/linux/cli/node_modules; \
# docker rm -v $$id;
cli-linux-clean:
rm -rf build/linux/cli
rm -rf build/linux/deepkit-cli-linux.tar.gz
rm -f packages/cli/dist/main.js
# this is required to use when building cli-linux on linux/windows
#cli-linux-local-rebuild: cli-linux-clean docker/build/linux/cli/node_modules cli-linux
build/linux/cli/bin: build/linux/cli/bin/node
mkdir -p build/linux/cli/bin
cp packages/cli/bin/deepkit build/linux/cli/bin/deepkit
_always/build/linux/cli/node_modules: build/linux/cli/bin
cp packages/cli/package.json build/linux/cli/
cd build/linux/cli && npm version $(VERSION_FILE_PATH) --allow-same-version && cd -
cp packages/cli/package-lock.json build/linux/cli/
cd build/linux/cli && npm install --only=prod
cli-linux: build/linux/cli/bin _always/build/linux/cli/node_modules packages/cli/dist/main.js
cp packages/cli/dist/main.js build/linux/cli/main.js
cp packages/cli/dist/main.js.map build/linux/cli/main.js.map
tar -C build/linux/cli -czf build/linux/deepkit-cli-linux.tar.gz .
@echo "build/linux/deepkit-cli-linux.tar.gz Done"
build/linux/deepkit-cli-linux.tar.gz: cli-linux
cli-linux-rebuild: cli-linux-clean
make cli-linux
# CLI GENERAL
packages/cli/dist/main.js:
cd packages/cli && npm run build
cli-linux-standalone: _always/build/linux/cli/node_modules
make cli-linux
# CLI DARWIN
build/darwin/cli/bin:
mkdir -p build/darwin/cli/bin
cp packages/cli/bin/deepkit build/darwin/cli/bin/deepkit
cli-darwin: build/darwin/cli/bin packages/cli/dist/main.js
cp packages/cli/package.json build/darwin/cli/package.json
cd build/darwin/cli/ && npm version $(VERSION_FILE_PATH) --allow-same-version && cd -
cp packages/cli/dist/main.js build/darwin/cli/main.js
cp packages/cli/dist/main.js.map build/darwin/cli/main.js.map
cd build/darwin/cli && npm install --only=prod --unsafe
# cd build/darwin/cli && zip -8 -qr $(RELEASES)/$(VERSION)/deepkit-cli-macOS-$(VERSION).zip .
cli-darwin-clean:
rm -rf build/darwin/cli
rm -f packages/cli/dist/main.js
cli-darwin-rebuild: cli-darwin-clean
make cli-darwin
# SERVER
packages/server/dist/main.js:
cd packages/server && npm run build
# SERVER DARWIN
build/darwin/server/libs:
mkdir -p build/darwin/server/libs
cp packages/server/libs/mongod-darwin-x64 build/darwin/server/libs
server-darwin: packages/server/dist/main.js build/darwin/server/libs
cp packages/server/package.json build/darwin/server/package.json
cd build/darwin/server/ && npm version $(VERSION_FILE_PATH) --allow-same-version && cd -
cp packages/server/dist/main.js build/darwin/server/main.js
# cd build/darwin/server && zip -8 -qr $(RELEASES)/$(VERSION)/deepkit-server-macOS-$(VERSION).zip .
server-darwin-clean:
rm -rf build/darwin/server
rm -rf build/darwin/server.tar.gz
rm -f packages/server/dist/*
server-darwin-rebuild: server-darwin-clean
make server-darwin
# SERVER WINDOWS
build/windows/server/libs:
mkdir -p build/windows/server/libs
cp packages/server/libs/mongod-win32-x64.exe build/windows/server/libs
build/windows/server/bin:
mkdir -p build/windows/server/bin
cp packages/server/bin/deepkit-server build/windows/server/bin/deepkit-server
server-windows: build/windows/server/bin packages/server/dist/main.js build/windows/server/libs
cp packages/server/package.json build/windows/server/package.json
cd build/windows/server/ && npm version $(VERSION_FILE_PATH) --allow-same-version && cd -
cp packages/server/dist/main.js build/windows/server/main.js
# cd build/windows/server && zip -8 -qr $(RELEASES)/$(VERSION)/deepkit-server-windows-$(VERSION).zip .
server-windows-clean:
rm -rf build/windows/server
rm -rf build/windows/server.tar.gz
rm -f packages/server/dist/*
server-windows-rebuild: server-windows-clean
make server-windows
# SERVER LINUX
build/linux/server/bin/node: /tmp/node-$(NODE_VERSION)-linux-x64/bin/node
mkdir -p build/linux/server/bin
cp /tmp/node-$(NODE_VERSION)-linux-x64/bin/node build/linux/server/bin/node;
build/linux/server/libs/mongod-linux-x64:
mkdir -p build/linux/server/libs
cp packages/server/libs/mongod-linux-x64 build/linux/server/libs
build/linux/server/libs: build/linux/server/libs/mongod-linux-x64
_always/build/linux/server/node_modules:
mkdir -p build/linux/server/
cp packages/server/package.json build/linux/server/package.json
cd build/linux/server/ && npm version $(VERSION_FILE_PATH) --allow-same-version && cd -
docker build -t deepkit/npm-install -f docker-build/npm-install.Dockerfile docker-build
docker run -v `pwd`/build/linux/server:/app deepkit/npm-install
build/linux/server/bin: build/linux/server/bin/node
mkdir -p build/linux/server/bin
cp packages/server/bin/deepkit-server build/linux/server/bin/deepkit-server
server-linux: build/linux/server/bin packages/server/dist/main.js build/linux/server/libs packages/deepkit/dist/deepkit/index.html
cp packages/server/package.json build/linux/server/package.json
cd build/linux/server/ && npm version $(VERSION_FILE_PATH) --allow-same-version && cd -
cp packages/server/dist/main.js build/linux/server/main.js
server-linux-clean:
rm -rf build/linux/server
rm -rf build/linux/server.tar.gz
rm -f packages/server/dist/*
server-linux-rebuild: server-linux-clean
make server-linux
#server-linux-in-docker:
# docker build -t deepkit/ci -f docker-build/ci.Dockerfile .
# docker run deepkit/ci sh -c "cd deepkit && make server-linux"
deepkit-frontend:
rm -rf build/frontend
cd packages/deepkit && npm version $(VERSION_FILE_PATH) --allow-same-version && cd -
cd packages/deepkit && npm run build && cd - && cp -r packages/deepkit/dist/deepkit build/frontend
# deepkit team server
server-linux-standalone: _always/build/linux/server/node_modules
make server-linux-rebuild deepkit-frontend
cp -r build/frontend build/linux/server/frontend
cd build/linux/server && zip -8 -qr $(RELEASES)/$(VERSION)/deepkit-server-linux-x64-$(VERSION).zip .
# Electron
packages/electron/dist/main.js:
cd packages/electron && ./node_modules/.bin/webpack-cli --mode development --config webpack.config.js;
#electron-darwin: build/electron/main.js build/darwin/server/main.js build/darwin/cli/main.js build/linux/deepkit-cli-linux.tar.gz build/frontend/index.html
electron-darwin-prebuild:
cd packages/electron && npm version $(VERSION_FILE_PATH) --allow-same-version && cd -
cd packages/electron && ./macos-build.sh;
_always/electron:
rm -rf packages/electron/dist/main.js
make packages/electron/dist/main.js
mkdir -p build/electron
cp packages/electron/dist/main.js build/electron/main.js
electron-darwin-local: _always/electron cli-darwin-rebuild cli-linux-rebuild deepkit-frontend server-darwin-rebuild
make electron-darwin-prebuild
mac-store:
echo Did you correctly tag a version? No dev versions allowed now.
echo We got: `sh release-version.sh`
read
make electron-darwin-local
# at this point we need all certs in apple-certificates in keychain including the private keys
cd packages/electron && ./macos-sign-mas.sh
cd packages/electron && ./macos-upload-store.sh
electron-linux-prebuild:
cd packages/electron && npm version $(VERSION_FILE_PATH) --allow-same-version && cd -
cd packages/electron && ./linux-build.sh;
electron-linux-local: _always/electron cli-linux-rebuild deepkit-frontend server-linux-rebuild
make electron-linux-prebuild
electron-linux-rebuild:
rm -r packages/electron/dist
make electron-linux
electron-windows-local: _always/electron cli-linux-rebuild deepkit-frontend server-windows-rebuild
cd packages/electron && npm version $(VERSION_FILE_PATH) --allow-same-version && cd -
cd packages/electron && ./windows-build.sh;
all-darwin-rebuild:
make server-darwin-rebuild
make cli-darwin-rebuild
make deepkit-angular-rebuild
make electron-darwin-rebuild
all-linux-rebuild:
make server-linux-rebuild
make cli-linux-rebuild
make deepkit-angular-rebuild
make electron-linux-rebuild
all-rebuild:
make cli-darwin-rebuild
make server-linux-rebuild
make server-darwin-rebuild
make deepkit-angular-rebuild
make electron-darwin
make electron-linux
# Deepkit
packages/deepkit/dist/deepkit/index.html:
cd packages/deepkit && npm run build
deepkit-angular: packages/deepkit/dist/deepkit/index.html
deepkit-angular-rebuild:
rm -rf packages/deepkit/dist
make deepkit-angular
upload-macos-release:
#pip install --upgrade pip wheel; pip install b2
#python -m b2 authorize-account ${{B2_APPKEY_ID}} ${{B2_APPKEY}}
python -m b2 upload-file deepkit-releases releases/$(VERSION_FILE_PATH)/deepkit-app-macOS-$(VERSION_FILE_PATH).zip releases/$(VERSION_FILE_PATH)/deepkit-app-macOS-$(VERSION_FILE_PATH).zip
python -m b2 clear-account
upload-linux-release:
#pip install --upgrade pip wheel; pip install b2
#python -m b2 authorize-account ${{B2_APPKEY_ID}} ${{B2_APPKEY}}
python -m b2 upload-file deepkit-releases releases/$(VERSION_FILE_PATH)/deepkit-app-linux-x64-$(VERSION_FILE_PATH).zip releases/$(VERSION_FILE_PATH)/deepkit-app-linux-x64-$(VERSION_FILE_PATH).zip
python -m b2 upload-file deepkit-releases releases/$(VERSION_FILE_PATH)/deepkit-server-linux-x64-$(VERSION_FILE_PATH).tar.gz releases/$(VERSION_FILE_PATH)/deepkit-server-linux-x64-$(VERSION_FILE_PATH).tar.gz
python -m b2 upload-file deepkit-releases releases/$(VERSION_FILE_PATH)/deepkit-cli-linux-x64-$(VERSION_FILE_PATH).tar.gz releases/$(VERSION_FILE_PATH)/deepkit-cli-linux-x64-$(VERSION_FILE_PATH).tar.gz
python -m b2 clear-account
cli-nexe-build:
docker run -ti \
-v `pwd`/packages/cli/src:/app/packages/cli/src \
-v `pwd`/packages/cli/package.json:/app/packages/cli/package.json \
-v `pwd`/packages/cli/dist:/app/packages/cli/dist \
deepkit/build sh -c 'cd packages/cli && npm run build-binary'
dev-setup:
cd packages/core && npm link --only=production && cd -
cd packages/core-node && npm link --only=production && cd -
cd packages/server && npm link @deepkit/core && cd -
cd packages/server && npm link @deepkit/core-node && cd -
cd packages/cli && npm link @deepkit/core && cd -
cd packages/cli && npm link @deepkit/core-node && cd -
cd packages/deepkit && npm link @deepkit/core && cd -
all:
echo hi
#
# rm -rf build
# make cli-linux
# make cli-darwin
# make build-packages
# make build-electron
build-packages-darwin: deepkit-angular cli-darwin server-darwin
website-image:
docker build -t deepkit/website -f docker-build/website.Dockerfile .
angular-watch:
cd packages/deepkit && ./node_modules/.bin/ng build --watch
angular-prod:
cd packages/deepkit && npm run build
icon-font:
cd packages/deepkit && npm run icon-font
server:
cd packages/server && ./node_modules/.bin/webpack
server-run:
cd packages/server && node dist/main.js
server-watch-only:
cd packages/server && ./node_modules/.bin/webpack --watch
server-watch:
cd packages/server && ./node_modules/.bin/webpack --watch --start
cli-watch:
cd packages/cli && ./node_modules/.bin/webpack --watch
electron-build:
cd packages/electron && npm run build
electron:
cd packages/electron && npm run electron:start
cli:
mkdir -p build/cli/packages
rsync -a --progress packages/cli build/cli/packages --exclude node_modules
rsync -a --progress packages/core build/cli/packages --exclude node_modules
rsync -a --progress packages/core-node build/cli/packages --exclude node_modules
cd build/cli/packages/cli && npm install && cd -
cd build/cli/packages/core && rm -rf node_modules && npm install --production && cd -
cd build/cli/packages/core-node && rm -rf node_modules && npm install --production && cd -
cd build/cli/packages/cli && DEBUG=* NODE_PRESERVE_SYMLINKS=1 TS_NODE_IGNORE=false oclif-dev pack && cd -