-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.sh
785 lines (689 loc) · 37.5 KB
/
build.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
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
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
#!/bin/sh
start=`date +%s`
force=false
copy=false
docs=false
locale=false
forcelibs=false
sourceModified=false
for arg in "$@"
do
case ${arg} in
-c | --copy)
copy=true
;;
-f | --force)
force=true
;;
-fl | --forcelibs)
forcelibs=true
;;
-d | --docs)
docs=true
;;
-l | --locale)
locale=true
;;
esac
done
RIMRAF=./node_modules/.bin/rimraf
ROLLUP=./node_modules/.bin/rollup
TERSER='./node_modules/.bin/terser -b ascii_only=true'
NGC=./node_modules/.bin/ngc
NG=./node_modules/.bin/ng
NGPACKAGR=./node_modules/.bin/ng-packagr
TSC=./node_modules/.bin/tsc
COMPODOC=./node_modules/.bin/compodoc
SUCCESS_FILE="BUILD_SUCCESS"
if [[ ${force} == true ]]; then
rm -rf ./dist/
fi
mkdir -p ./dist/tmp/libs/core-js
mkdir -p ./dist/bundles/wmapp/scripts
mkdir -p ./dist/bundles/wmmobile/scripts
execCommand() {
local task=$1
local desc=$2
local command=$3
echo "$task: $desc"
${command} > /dev/null
if [[ "$?" -ne "0" ]]; then
echo "$task: $desc - failure"
exit 1
else
echo "$task: $desc - success"
fi
}
hasLibChanges() {
if [[ ${force} == true ]] || [[ ${forcelibs} == true ]]; then
return 0
fi
local successFile="./dist/LIB_${SUCCESS_FILE}"
if ! [[ -e ${successFile} ]]; then
return 0
fi
local updateTime=`date -r ./package.json +%s`
local buildTime=`date -r ${successFile} +%s`
if [[ ${updateTime} -le ${buildTime} ]]; then
return 1
else
return 0
fi
return 0
}
hasLibJsChanges(){
if [[ ${force} == true ]]; then
return 0
fi
local successFile="./dist/LIB_${SUCCESS_FILE}"
if ! [[ -e ${successFile} ]]; then
return 0
fi
local updateTime=`date -r ./projects/components/widgets/data/table/src/datatable.js +%s`
local buildTime=`date -r ${successFile} +%s`
if [[ ${updateTime} -le ${buildTime} ]]; then
return 1
else
return 0
fi
return 0
}
buildNeeded() {
if [[ ${force} == true ]]; then
return 1
fi
local bundle=$1
local sourceLocation=$2
local successFile="./dist/tmp/${bundle}_${SUCCESS_FILE}"
if ! [[ -e ${successFile} ]]; then
return 1
fi
local modifiedSourceFilesCount=`find ${sourceLocation} -type f \( -name "*.ts" ! -name "*.doc.ts" -o -name "*.html" -o -name "*.json" \) -newer $successFile | wc -l`
return $modifiedSourceFilesCount
}
rollup() {
local bundle=$1
execCommand rollup ${bundle} "$ROLLUP -c $bundle/rollup.config.js --silent"
}
ngPackagrBuild() {
local bundle=$1
local sourceLocation=$2
local ngModuleName=$3;
buildNeeded ${bundle} ${sourceLocation}
if [[ "$?" -ne 0 ]]; then
$NGPACKAGR -p $sourceLocation/ng-package.json -c $sourceLocation/tsconfig.lib.prod.json
if [[ "$?" -eq "0" ]]; then
touch ./dist/tmp/${bundle}_${SUCCESS_FILE}
fi
sourceModified=true
else
echo "No changes in $bundle"
fi
}
bundleWeb() {
echo "uglify: web"
${TERSER} \
./libraries/core/bundles/index.umd.js \
./libraries/swipey/bundles/index.umd.js \
./libraries/transpiler/bundles/index.umd.js \
./libraries/http/bundles/index.umd.js \
./libraries/oAuth/bundles/index.umd.js \
./libraries/security/bundles/index.umd.js \
./libraries/components/base/bundles/index.umd.js \
./libraries/build-task/bundles/index.umd.js \
./libraries/components/input/default/bundles/index.umd.js \
./libraries/components/basic/default/bundles/index.umd.js \
./libraries/components/basic/progress/bundles/index.umd.js \
./libraries/components/basic/rich-text-editor/bundles/index.umd.js \
./libraries/components/basic/search/bundles/index.umd.js \
./libraries/components/basic/tree/bundles/index.umd.js \
./libraries/components/input/calendar/bundles/index.umd.js \
./libraries/components/input/chips/bundles/index.umd.js \
./libraries/components/input/color-picker/bundles/index.umd.js \
./libraries/components/input/currency/bundles/index.umd.js \
./libraries/components/input/epoch/bundles/index.umd.js \
./libraries/components/input/file-upload/bundles/index.umd.js \
./libraries/components/input/rating/bundles/index.umd.js \
./libraries/components/input/slider/bundles/index.umd.js \
./libraries/components/chart/bundles/index.umd.js \
./libraries/components/navigation/menu/bundles/index.umd.js \
./libraries/components/navigation/navbar/bundles/index.umd.js \
./libraries/components/navigation/breadcrumb/bundles/index.umd.js \
./libraries/components/navigation/popover/bundles/index.umd.js \
./libraries/components/dialogs/default/bundles/index.umd.js \
./libraries/components/dialogs/alert-dialog/bundles/index.umd.js \
./libraries/components/dialogs/confirm-dialog/bundles/index.umd.js \
./libraries/components/dialogs/design-dialog/bundles/index.umd.js \
./libraries/components/page/default/bundles/index.umd.js \
./libraries/components/page/footer/bundles/index.umd.js \
./libraries/components/page/header/bundles/index.umd.js \
./libraries/components/page/left-panel/bundles/index.umd.js \
./libraries/components/page/right-panel/bundles/index.umd.js \
./libraries/components/page/top-nav/bundles/index.umd.js \
./libraries/components/prefab/bundles/index.umd.js \
./libraries/components/data/pagination/bundles/index.umd.js \
./libraries/components/data/card/bundles/index.umd.js \
./libraries/components/data/list/bundles/index.umd.js \
./libraries/components/data/table/bundles/index.umd.js \
./libraries/components/data/live-table/bundles/index.umd.js \
./libraries/components/data/form/bundles/index.umd.js \
./libraries/components/dialogs/iframe-dialog/bundles/index.umd.js \
./libraries/components/dialogs/login-dialog/bundles/index.umd.js \
./libraries/components/dialogs/partial-dialog/bundles/index.umd.js \
./libraries/components/containers/accordion/bundles/index.umd.js \
./libraries/components/containers/layout-grid/bundles/index.umd.js \
./libraries/components/containers/linear-layout/bundles/index.umd.js \
./libraries/components/containers/panel/bundles/index.umd.js \
./libraries/components/containers/tabs/bundles/index.umd.js \
./libraries/components/containers/tile/bundles/index.umd.js \
./libraries/components/containers/wizard/bundles/index.umd.js \
./libraries/components/advanced/carousel/bundles/index.umd.js \
./libraries/components/advanced/marquee/bundles/index.umd.js \
./libraries/components/advanced/login/bundles/index.umd.js \
./libraries/components/advanced/custom/bundles/index.umd.js \
./libraries/variables/bundles/index.umd.js \
./libraries/mobile/placeholder/runtime/bundles/index.umd.js \
./libraries/mobile/placeholder/runtime-dynamic/bundles/index.umd.js \
./libraries/runtime/base/bundles/index.umd.js \
./libraries/runtime/dynamic/bundles/index.umd.js \
-o ./dist/bundles/wmapp/scripts/wm-loader.js -b
./node_modules/.bin/terser ./dist/bundles/wmapp/scripts/wm-loader.js \
-c -o ./dist/bundles/wmapp/scripts/wm-loader.min.js -m -b beautify=false,ascii_only=true
if [[ "$?" -eq "0" ]]; then
echo "uglify: web - success"
else
echo -e "uglify: web - failure"
fi
}
bundleMobile() {
echo "uglify: mobile"
${TERSER} \
./libraries/core/bundles/index.umd.js \
./libraries/swipey/bundles/index.umd.js \
./libraries/transpiler/bundles/index.umd.js \
./libraries/http/bundles/index.umd.js \
./libraries/oAuth/bundles/index.umd.js \
./libraries/security/bundles/index.umd.js \
./libraries/components/base/bundles/index.umd.js \
./libraries/build-task/bundles/index.umd.js \
./libraries/components/input/default/bundles/index.umd.js \
./libraries/components/basic/default/bundles/index.umd.js \
./libraries/components/basic/progress//bundles/index.umd.js \
./libraries/components/basic/rich-text-editor/bundles/index.umd.js \
./libraries/components/basic/search/bundles/index.umd.js \
./libraries/components/basic/tree/bundles/index.umd.js \
./libraries/components/input/calendar/bundles/index.umd.js \
./libraries/components/input/chips/bundles/index.umd.js \
./libraries/components/input/color-picker/bundles/index.umd.js \
./libraries/components/input/currency/bundles/index.umd.js \
./libraries/components/input/epoch/bundles/index.umd.js \
./libraries/components/input/file-upload/bundles/index.umd.js \
./libraries/components/input/rating/bundles/index.umd.js \
./libraries/components/input/slider/bundles/index.umd.js \
./libraries/components/chart/bundles/index.umd.js \
./libraries/components/navigation/menu/bundles/index.umd.js \
./libraries/components/navigation/navbar/bundles/index.umd.js \
./libraries/components/navigation/breadcrumb/bundles/index.umd.js \
./libraries/components/navigation/popover/bundles/index.umd.js \
./libraries/components/dialogs/default/bundles/index.umd.js \
./libraries/components/dialogs/alert-dialog/bundles/index.umd.js \
./libraries/components/dialogs/confirm-dialog/bundles/index.umd.js \
./libraries/components/dialogs/design-dialog/bundles/index.umd.js \
./libraries/components/page/default/bundles/index.umd.js \
./libraries/components/page/footer/bundles/index.umd.js \
./libraries/components/page/header/bundles/index.umd.js \
./libraries/components/page/left-panel/bundles/index.umd.js \
./libraries/components/page/right-panel/bundles/index.umd.js \
./libraries/components/page/top-nav/bundles/index.umd.js \
./libraries/components/prefab/bundles/index.umd.js \
./libraries/components/data/pagination/bundles/index.umd.js \
./libraries/components/data/card/bundles/index.umd.js \
./libraries/components/data/list/bundles/index.umd.js \
./libraries/components/data/table/bundles/index.umd.js \
./libraries/components/data/live-table/bundles/index.umd.js \
./libraries/components/data/form/bundles/index.umd.js \
./libraries/components/dialogs/iframe-dialog/bundles/index.umd.js \
./libraries/components/dialogs/login-dialog/bundles/index.umd.js \
./libraries/components/dialogs/partial-dialog/bundles/index.umd.js \
./libraries/components/containers/accordion/bundles/index.umd.js \
./libraries/components/containers/layout-grid/bundles/index.umd.js \
./libraries/components/containers/linear-layout/bundles/index.umd.js \
./libraries/components/containers/panel/bundles/index.umd.js \
./libraries/components/containers/tabs/bundles/index.umd.js \
./libraries/components/containers/tile/bundles/index.umd.js \
./libraries/components/containers/wizard/bundles/index.umd.js \
./libraries/components/advanced/carousel/bundles/index.umd.js \
./libraries/components/advanced/marquee/bundles/index.umd.js \
./libraries/components/advanced/login/bundles/index.umd.js \
./libraries/components/advanced/custom/bundles/index.umd.js \
./libraries/mobile/core/bundles/index.umd.js \
./libraries/mobile/components/basic/default/bundles/index.umd.js \
./libraries/mobile/components/basic/search/bundles/index.umd.js \
./libraries/mobile/components/containers/segmented-control/bundles/index.umd.js \
./libraries/mobile/components/device/barcode-scanner/bundles/index.umd.js \
./libraries/mobile/components/device/camera/bundles/index.umd.js \
./libraries/mobile/components/input/file-upload/bundles/index.umd.js \
./libraries/mobile/components/page/default/bundles/index.umd.js \
./libraries/mobile/components/page/left-panel/bundles/index.umd.js \
./libraries/mobile/components/page/mobile-navbar/bundles/index.umd.js \
./libraries/mobile/components/page/tab-bar/bundles/index.umd.js \
./libraries/mobile/components/data/media-list/bundles/index.umd.js \
./libraries/variables/bundles/index.umd.js \
./libraries/mobile/offline/bundles/index.umd.js \
./libraries/mobile/variables/bundles/index.umd.js \
./libraries/mobile/runtime/bundles/index.umd.js \
./libraries/mobile/runtime-dynamic/bundles/index.umd.js \
./libraries/runtime/base/bundles/index.umd.js \
./libraries/runtime/dynamic/bundles/index.umd.js \
-o ./dist/bundles/wmmobile/scripts/wm-mobileloader.js -b
./node_modules/.bin/terser ./dist/bundles/wmmobile/scripts/wm-mobileloader.js \
-c -o ./dist/bundles/wmmobile/scripts/wm-mobileloader.min.js -m -b beautify=false,ascii_only=true
if [[ "$?" -eq "0" ]]; then
echo "uglify: mobile - success"
else
echo -e "uglify: mobile - failure"
fi
}
buildApp() {
ngPackagrBuild core projects/core '@wm/core'
ngPackagrBuild transpiler projects/transpiler '@wm/transpiler'
ngPackagrBuild swipey projects/swipey '@wm/swipey'
ngPackagrBuild http-service projects/http-service '@wm/http'
ngPackagrBuild oAuth projects/oAuth '@wm/oAuth'
ngPackagrBuild security projects/security '@wm/security'
ngPackagrBuild variables projects/variables '@wm/variables'
ngPackagrBuild components-base projects/components/base '@wm/components/base'
ngPackagrBuild components-input projects/components/widgets/input/default '@wm/components/input'
ngPackagrBuild components-basic projects/components/widgets/basic/default '@wm/components/basic'
ngPackagrBuild components-basic-progress projects/components/widgets/basic/progress '@wm/components/basic/progress'
ngPackagrBuild components-basic-richtexteditor projects/components/widgets/basic/rich-text-editor '@wm/components/basic/rich-text-editor'
ngPackagrBuild components-basic-search projects/components/widgets/basic/search '@wm/components/basic/search'
ngPackagrBuild components-basic-tree projects/components/widgets/basic/tree '@wm/components/basic/tree'
ngPackagrBuild components-input-calendar projects/components/widgets/input/calendar '@wm/components/input/calendar'
ngPackagrBuild components-input-chips projects/components/widgets/input/chips '@wm/components/input/chips'
ngPackagrBuild components-input-colorpicker projects/components/widgets/input/color-picker '@wm/components/input/color-picker'
ngPackagrBuild components-input-currency projects/components/widgets/input/currency '@wm/components/input/currency'
ngPackagrBuild components-input-epoch projects/components/widgets/input/epoch '@wm/components/input/epoch'
ngPackagrBuild components-input-fileupload projects/components/widgets/input/file-upload '@wm/components/input/file-upload'
ngPackagrBuild components-input-rating projects/components/widgets/input/rating '@wm/components/input/rating'
ngPackagrBuild components-input-slider projects/components/widgets/input/slider '@wm/components/input/slider'
ngPackagrBuild components-charts projects/components/widgets/chart '@wm/components/chart'
ngPackagrBuild components-navigation-menu projects/components/widgets/navigation/menu '@wm/components/navigation/menu'
ngPackagrBuild components-navigation-navbar projects/components/widgets/navigation/navbar '@wm/components/navigation/navbar'
ngPackagrBuild components-navigation-breadcrumb projects/components/widgets/navigation/breadcrumb '@wm/components/navigation/breadcrumb'
ngPackagrBuild components-navigation-popover projects/components/widgets/navigation/popover '@wm/components/navigation/popover'
ngPackagrBuild components-containers-accordion projects/components/widgets/containers/accordion '@wm/components/containers/accordion'
ngPackagrBuild components-containers-linearlayout projects/components/widgets/containers/linear-layout '@wm/components/containers/linear-layout'
ngPackagrBuild components-containers-layoutgrid projects/components/widgets/containers/layout-grid '@wm/components/containers/layout-grid'
ngPackagrBuild components-containers-panel projects/components/widgets/containers/panel '@wm/components/containers/panel'
ngPackagrBuild components-containers-tabs projects/components/widgets/containers/tabs '@wm/components/containers/tabs'
ngPackagrBuild components-containers-tile projects/components/widgets/containers/tile '@wm/components/containers/tile'
ngPackagrBuild components-containers-wizard projects/components/widgets/containers/wizard '@wm/components/containers/wizard'
ngPackagrBuild components-dialogs projects/components/widgets/dialogs/default '@wm/components/dialogs'
ngPackagrBuild components-dialogs-alertdialog projects/components/widgets/dialogs/alert-dialog '@wm/components/dialogs/alert-dialog'
ngPackagrBuild components-dialogs-confirmdialog projects/components/widgets/dialogs/confirm-dialog '@wm/components/dialogs/confirm-dialog'
ngPackagrBuild components-dialogs-designdialog projects/components/widgets/dialogs/design-dialog '@wm/components/dialogs/design-dialog'
ngPackagrBuild components-dialogs-iframedialog projects/components/widgets/dialogs/iframe-dialog '@wm/components/dialogs/iframe-dialog'
ngPackagrBuild components-dialogs-partialdialog projects/components/widgets/dialogs/partial-dialog '@wm/components/dialogs/partial-dialog'
ngPackagrBuild components-page projects/components/widgets/page/default '@wm/components/page'
ngPackagrBuild components-page-footer projects/components/widgets/page/footer '@wm/components/page/footer'
ngPackagrBuild components-page-header projects/components/widgets/page/header '@wm/components/page/header'
ngPackagrBuild components-page-leftpanel projects/components/widgets/page/left-panel '@wm/components/page/left-panel'
ngPackagrBuild components-page-rightpanel projects/components/widgets/page/right-panel '@wm/components/page/right-panel'
ngPackagrBuild components-page-topnav projects/components/widgets/page/top-nav '@wm/components/page/top-nav'
ngPackagrBuild components-prefab projects/components/widgets/prefab '@wm/components/prefab'
ngPackagrBuild components-data-card projects/components/widgets/data/card '@wm/components/data/card'
ngPackagrBuild components-data-pagination projects/components/widgets/data/pagination '@wm/components/data/pagination'
ngPackagrBuild components-data-list projects/components/widgets/data/list '@wm/components/data/list'
ngPackagrBuild components-data-table projects/components/widgets/data/table '@wm/components/data/table'
ngPackagrBuild components-data-livetable projects/components/widgets/data/live-table '@wm/components/data/live-table'
ngPackagrBuild components-data-form projects/components/widgets/data/form '@wm/components/data/form'
ngPackagrBuild components-dialogs-logindialog projects/components/widgets/dialogs/login-dialog '@wm/components/dialogs/login-dialog'
ngPackagrBuild components-advanced-carousel projects/components/widgets/advanced/carousel '@wm/components/advanced/carousel'
ngPackagrBuild components-advanced-marquee projects/components/widgets/advanced/marquee '@wm/components/advanced/marquee'
ngPackagrBuild components-advanced-login projects/components/widgets/advanced/login '@wm/components/advanced/login'
ngPackagrBuild components-advanced-custom projects/components/widgets/advanced/custom '@wm/components/advanced/custom'
ngPackagrBuild mobile-core projects/mobile/core '@wm/mobile/core'
ngPackagrBuild mobile-offline projects/mobile/offline '@wm/mobile/offline'
ngPackagrBuild mobile-components-basic projects/mobile/components/basic/default '@wm/mobile/components/basic'
ngPackagrBuild mobile-components-basic-search projects/mobile/components/basic/search '@wm/mobile/components/basic/search'
ngPackagrBuild mobile-components-containers-segmented projects/mobile/components/containers/segmented-control '@wm/mobile/components/containers/segmented-control'
ngPackagrBuild mobile-components-device-barcodescanner projects/mobile/components/device/barcode-scanner '@wm/mobile/components/device/barcode-scanner'
ngPackagrBuild mobile-components-device-camera projects/mobile/components/device/camera '@wm/mobile/components/device/camera'
ngPackagrBuild mobile-components-input-fileupload projects/mobile/components/input/file-upload '@wm/mobile/components/input/file-upload'
ngPackagrBuild mobile-components-page projects/mobile/components/page/default '@wm/mobile/components/page'
ngPackagrBuild mobile-components-page-leftpanel projects/mobile/components/page/left-panel '@wm/mobile/components/page/left-panel'
ngPackagrBuild mobile-components-page-mobilenavbar projects/mobile/components/page/mobile-navbar '@wm/mobile/components/page/mobile-navbar'
ngPackagrBuild mobile-components-page-tabbar projects/mobile/components/page/tab-bar '@wm/mobile/components/page/tab-bar'
ngPackagrBuild mobile-components-data-medialist projects/mobile/components/data/media-list '@wm/mobile/components/data/media-list'
ngPackagrBuild mobile-variables projects/mobile/variables '@wm/mobile/variables'
ngPackagrBuild mobile-runtime projects/mobile/runtime '@wm/mobile/runtime'
ngPackagrBuild mobile-runtime-dynamic projects/mobile/runtime-dynamic '@wm/mobile/runtime/dynamic'
ngPackagrBuild mobile-placeholder-runtime projects/mobile/placeholder/runtime '@wm/mobile/placeholder/runtime'
ngPackagrBuild mobile-placeholder-runtimedynamic projects/mobile/placeholder/runtime-dynamic '@wm/mobile/placeholder/runtime/dynamic'
buildNeeded components-transpilation projects/components/transpile
if [[ $? -ne 0 ]]; then
./node_modules/.bin/ng-packagr -p projects/components/transpile/ng-package.json -c ./projects/components/transpile/tsconfig.lib.prod.json
if [[ "$?" -eq "0" ]]; then
touch ./dist/tmp/components-transpilation_${SUCCESS_FILE}
fi
sourceModified=true
fi
ngPackagrBuild runtime-base projects/runtime-base '@wm/runtime/base'
ngPackagrBuild runtime-dynamic projects/runtime-dynamic '@wm/runtime/dynamic'
if [[ "${sourceModified}" == true ]]; then
buildWMComponentUmdLibs
bundleWeb
bundleMobile
fi
}
buildDocs() {
if [[ "${docs}" == true ]]; then
${RIMRAF} ./dist/docs/
execCommand "compodoc" "docs" "${COMPODOC} --config documentation/compodocrc.json"
fi
}
copyDist() {
if [[ "${copy}" == true ]]; then
cp ./dist/bundles/wmapp/scripts/* ../wavemaker-studio-editor/src/main/webapp/wmapp/scripts/
cp -r ./dist/bundles/* ../../wavemaker-studio-saas/wavemaker-saas-client/local/webapp/remote-studio/ 2> /dev/null
cp -r ./dist/bundles/* ../../wavemaker-studio-saas/wavemaker-saas-client/local/webapp/static-files/ 2> /dev/null
if [[ "${docs}" == true ]]; then
cp -r ./dist/docs/* ../wavemaker-studio-editor/src/main/webapp/docs/
fi
if [[ "${locale}" == true ]]; then
cp -r ./dist/bundles/wmapp/locales/* ../wavemaker-studio-editor/src/main/webapp/wmapp/locales/
cp -r ./dist/bundles/wmmobile/locales/* ../wavemaker-studio-editor/src/main/webapp/wmmobile/locales/
fi
fi
}
copyLocale() {
if [[ "${locale}" == true ]]; then
local appDest=./dist/bundles/wmapp/locales
local mobileDest=./dist/bundles/wmmobile/locales
local angularSrc=./node_modules/@angular/common/locales
local fullCalendarSrc=./node_modules/fullcalendar/locales
local momentSrc=./node_modules/moment/locale
local timezoneSrc=./node_modules/moment-timezone/builds/moment-timezone-with-data.js
mkdir -p ${appDest}/angular
mkdir -p ${appDest}/angular/global
mkdir -p ${mobileDest}/angular
mkdir -p ${mobileDest}/angular/global
mkdir -p ${appDest}/fullcalendar
mkdir -p ${mobileDest}/fullcalendar
mkdir -p ${appDest}/moment
mkdir -p ${mobileDest}/moment
mkdir -p ${appDest}/moment-timezone
mkdir -p ${mobileDest}/moment-timezone
for file in ${angularSrc}/*.js; do
local destFileName=`echo $(basename ${file}) | tr 'A-Z' 'a-z'`;
cp ${file} ${appDest}/angular/${destFileName}
done
for file in ${angularSrc}/global/*.js; do
local destFileName=`echo $(basename ${file}) | tr 'A-Z' 'a-z'`;
cp ${file} ${appDest}/angular/global/${destFileName}
done
cp ${appDest}/angular/*.js ${mobileDest}/angular/
cp ${appDest}/angular/global/*.js ${mobileDest}/angular/global/
cp ${fullCalendarSrc}/*.js ${appDest}/fullcalendar/
cp ${fullCalendarSrc}/*.js ${mobileDest}/fullcalendar/
cp ${momentSrc}/*.js ${appDest}/moment/
cp ${momentSrc}/*.js ${mobileDest}/moment/
cp ${timezoneSrc} ${appDest}/moment-timezone/
cp ${timezoneSrc} ${mobileDest}/moment-timezone/
fi
}
buildCoreJs() {
execCommand "rollup" "core-js" "${ROLLUP} -c ./config/rollup.core-js.config.mjs"
}
buildTsLib() {
execCommand "rollup" "tslib" "${ROLLUP} ./node_modules/tslib/tslib.es6.js --o ./dist/tmp/libs/tslib/tslib.umd.js -f umd --name tslib --silent"
}
buildNgxBootstrap() {
execCommand "rollup" "ngx-bootstrap-libs" "${ROLLUP} -c ./config/rollup.ngxBootstrap.config.mjs"
arr=(./node_modules/ngx-bootstrap/collapse/bundles/ngx-bootstrap-collapse.umd.js \
./node_modules/ngx-bootstrap/chronos/bundles/ngx-bootstrap-chronos.umd.js \
./node_modules/ngx-bootstrap/utils/bundles/ngx-bootstrap-utils.umd.js \
./node_modules/ngx-bootstrap/positioning/bundles/ngx-bootstrap-positioning.umd.js \
./node_modules/ngx-bootstrap/component-loader/bundles/ngx-bootstrap-component-loader.umd.js \
./node_modules/ngx-bootstrap/dropdown/bundles/ngx-bootstrap-dropdown.umd.js \
./node_modules/ngx-bootstrap/locale/bundles/ngx-bootstrap-locale.umd.js \
./node_modules/ngx-bootstrap/buttons/bundles/ngx-bootstrap-buttons.umd.js \
./node_modules/ngx-bootstrap/carousel/bundles/ngx-bootstrap-carousel.umd.js \
./node_modules/ngx-bootstrap/mini-ngrx/bundles/ngx-bootstrap-mini-ngrx.umd.js \
./node_modules/ngx-bootstrap/focus-trap/bundles/ngx-bootstrap-focus-trap.umd.js \
./node_modules/ngx-bootstrap/modal/bundles/ngx-bootstrap-modal.umd.js \
./node_modules/ngx-bootstrap/pagination/bundles/ngx-bootstrap-pagination.umd.js \
./node_modules/ngx-bootstrap/popover/bundles/ngx-bootstrap-popover.umd.js \
./node_modules/ngx-bootstrap/progressbar/bundles/ngx-bootstrap-progressbar.umd.js \
./node_modules/ngx-bootstrap/rating/bundles/ngx-bootstrap-rating.umd.js \
./node_modules/ngx-bootstrap/sortable/bundles/ngx-bootstrap-sortable.umd.js \
./node_modules/ngx-bootstrap/tabs/bundles/ngx-bootstrap-tabs.umd.js \
./node_modules/ngx-bootstrap/timepicker/bundles/ngx-bootstrap-timepicker.umd.js \
./node_modules/ngx-bootstrap/tooltip/bundles/ngx-bootstrap-tooltip.umd.js \
./node_modules/ngx-bootstrap/typeahead/bundles/ngx-bootstrap-typeahead.umd.js \
./node_modules/ngx-bootstrap/datepicker/bundles/ngx-bootstrap-datepicker.umd.js \
./node_modules/ngx-bootstrap/accordion/bundles/ngx-bootstrap-accordion.umd.js)
# Create the directory to place the concatinated ngx-bootstrap UMD files
exec $(mkdir -p "./dist/tmp/libs/ngx-bootstrap")
# Concatinated the all bootstrap umd files
exec $(cat ${arr[*]} > ./dist/tmp/libs/ngx-bootstrap/ngx-bootstrap.umd.js)
}
buildUmdFiles() {
execCommand "rollup" "ngx-toastr" "${ROLLUP} -c ./config/rollup.ngx-toastr.config.mjs"
execCommand "rollup" "angular-websocket" "${ROLLUP} -c ./config/rollup.angular-websocket.config.mjs"
execCommand "rollup" "ng-circle-progress" "${ROLLUP} -c ./config/rollup.ng-circle-progress.config.mjs"
execCommand "rollup" "ngx-libs" "${ROLLUP} -c ./config/rollup.ngx-libs.config.mjs"
}
buildAngularUmdLibs() {
execCommand "rollup" "ng-libs-umd" "${ROLLUP} -c ./config/rollup.ng-libs.config.mjs"
}
buildWMComponentUmdLibs() {
execCommand "rollup" "wm-components-umd" "${ROLLUP} -c ./config/rollup.wm-components.config.mjs"
}
bundleWebLibs() {
bundleJS
cpRuntimeFoundationCss
}
bundleJS() {
echo "uglify: web-libs"
${TERSER} \
./dist/tmp/libs/tslib/tslib.umd.js \
./dist/tmp/libs/core-js/core-js.umd.js \
./node_modules/zone.js/bundles/zone.umd.js \
./node_modules/rxjs/bundles/rxjs.umd.js \
./node_modules/@angular/compiler/bundles/compiler.umd.js \
./node_modules/@angular/core/bundles/core-signals.umd.js \
./node_modules/@angular/core/bundles/core.umd.js \
./node_modules/@angular/common/bundles/common.umd.js \
./node_modules/@angular/animations/bundles/animations.umd.js \
./node_modules/@angular/animations/bundles/animations-browser.umd.js \
./node_modules/@angular/platform-browser/bundles/platform-browser.umd.js \
./node_modules/@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js \
./node_modules/@angular/platform-browser/bundles/platform-browser-animations.umd.js \
./node_modules/@angular/common/bundles/common-http.umd.js \
./node_modules/@angular/router/bundles/router.umd.js \
./node_modules/@angular/forms/bundles/forms.umd.js \
./node_modules/ngx-toastr/bundles/ngx-toastr.umd.js \
./dist/tmp/libs/angular-websocket/angular-websocket.umd.js \
./dist/tmp/libs/ng-circle-progress/ng-circle-progress.umd.js \
./node_modules/ngx-color-picker/bundles/ngx-color-picker.umd.js \
./node_modules/lodash/lodash.js \
./node_modules/moment/moment.js \
./node_modules/moment-timezone/moment-timezone.js \
./node_modules/x2js/x2js.js \
./node_modules/d3/dist/d3.min.js \
./node_modules/he/he.js \
./node_modules/@wavemaker/nvd3/build/nv.d3.min.js \
./node_modules/jquery/dist/jquery.min.js \
./node_modules/fullcalendar/main.min.js \
./node_modules/jssha/dist/sha256.js \
./node_modules/summernote/dist/summernote-lite.js \
./node_modules/jquery-ui/ui/disable-selection.js \
./node_modules/jquery-ui/ui/version.js \
./node_modules/jquery-ui/ui/widget.js \
./node_modules/jquery-ui/ui/scroll-parent.js \
./node_modules/jquery-ui/ui/plugin.js \
./node_modules/jquery-ui/ui/data.js \
./node_modules/jquery-ui/ui/widgets/mouse.js \
./node_modules/jquery-ui/ui/widgets/resizable.js \
./node_modules/jquery-ui/ui/widgets/sortable.js \
./node_modules/jquery-ui/ui/widgets/draggable.js \
./node_modules/jquery-ui/ui/widgets/droppable.js \
./node_modules/hammerjs/hammer.min.js \
./node_modules/iscroll/build/iscroll.js \
./node_modules/js-cookie/src/js.cookie.js \
./projects/components/widgets/data/table/src/datatable.js \
./projects/swipey/src/swipey.jquery.plugin.js \
./projects/jquery.ui.touch-punch/jquery.ui.touch-punch.min.js \
../wavemaker-ui-variables/dist/umd/index.js \
../custom-widgets-m3/dist/umd/index.js \
./node_modules/imask/dist/imask.min.js \
./node_modules/angular-imask/bundles/angular-imask.umd.js \
./node_modules/@metrichor/jmespath/dist/jmespath.umd.js \
./dist/tmp/libs/ngx-bootstrap/ngx-bootstrap.umd.js \
./node_modules/tabbable/dist/index.umd.js \
./node_modules/@wavemaker/focus-trap/dist/focus-trap.umd.js \
./node_modules/@ztree/ztree_v3/js/jquery.ztree.all.js \
./projects/components/widgets/basic/tree/src/keyboard-navigation.js \
-o ./dist/bundles/wmapp/scripts/wm-libs.js -b
./node_modules/.bin/terser ./dist/bundles/wmapp/scripts/wm-libs.js \
-c -o ./dist/bundles/wmapp/scripts/wm-libs.min.js -m -b beautify=false,ascii_only=true
if [[ "$?" -eq "0" ]]; then
echo "uglify: web-libs - success"
else
echo -e "uglify: web-libs - failure"
fi
}
cpRuntimeFoundationCss() {
echo "Copying foundation folder to bundle directory"
# Create destination directory if it doesn't exist
mkdir -p ./dist/bundles/wmapp/styles/foundation
# The foundation folder will be built through build-foundation-css target in studio front end build.xml
# Copy the entire foundation folder including CSS and fonts
cp -r ../wavemaker-foundation-css/dist/styles/foundation/* ./dist/bundles/wmapp/styles/foundation/
if [[ "$?" -eq "0" ]]; then
echo "Foundation folder copied successfully"
else
echo "Failed to copy foundation folder"
exit 1
fi
}
bundleMobileLibs() {
echo "uglify: mobile-libs"
${TERSER} \
./dist/tmp/libs/tslib/tslib.umd.js \
./dist/tmp/libs/core-js/core-js.umd.js \
./node_modules/zone.js/bundles/zone.umd.js \
./node_modules/rxjs/bundles/rxjs.umd.js \
./node_modules/@angular/compiler/bundles/compiler.umd.js \
./node_modules/@angular/core/bundles/core-signals.umd.js \
./node_modules/@angular/core/bundles/core.umd.js \
./node_modules/@angular/common/bundles/common.umd.js \
./node_modules/@angular/animations/bundles/animations.umd.js \
./node_modules/@angular/animations/bundles/animations-browser.umd.js \
./node_modules/@angular/platform-browser/bundles/platform-browser.umd.js \
./node_modules/@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js \
./node_modules/@angular/platform-browser/bundles/platform-browser-animations.umd.js \
./node_modules/@angular/common/bundles/common-http.umd.js \
./node_modules/@angular/router/bundles/router.umd.js \
./node_modules/@angular/forms/bundles/forms.umd.js \
./dist/tmp/libs/ngx-bootstrap/ngx-bootstrap.umd.js \
./node_modules/ngx-toastr/bundles/ngx-toastr.umd.js \
./dist/tmp/libs/angular-websocket/angular-websocket.umd.js \
./dist/tmp/libs/ng-circle-progress/ng-circle-progress.umd.js \
./node_modules/ngx-color-picker/bundles/ngx-color-picker.umd.js \
./node_modules/lodash/lodash.js \
./node_modules/moment/moment.js \
./node_modules/moment-timezone/moment-timezone.js \
./node_modules/x2js/x2js.js \
./node_modules/d3/dist/d3.min.js \
./node_modules/he/he.js \
./node_modules/@wavemaker/nvd3/build/nv.d3.min.js \
./node_modules/jquery/dist/jquery.min.js \
./node_modules/fullcalendar/main.min.js \
./node_modules/jssha/dist/sha256.js \
./node_modules/summernote/dist/summernote-lite.js \
./node_modules/jquery-ui/ui/disable-selection.js \
./node_modules/jquery-ui/ui/version.js \
./node_modules/jquery-ui/ui/widget.js \
./node_modules/jquery-ui/ui/scroll-parent.js \
./node_modules/jquery-ui/ui/plugin.js \
./node_modules/jquery-ui/ui/data.js \
./node_modules/jquery-ui/ui/widgets/mouse.js \
./node_modules/jquery-ui/ui/widgets/resizable.js \
./node_modules/jquery-ui/ui/widgets/sortable.js \
./node_modules/jquery-ui/ui/widgets/draggable.js \
./node_modules/jquery-ui/ui/widgets/droppable.js \
./node_modules/hammerjs/hammer.min.js \
./projects/components/widgets/data/table/src/datatable.js \
./dist/tmp/libs/awesome-cordova/awesome-cordova-core.umd.js \
./dist/tmp/libs/awesome-cordova/awesome-cordova-plugins.umd.js \
./node_modules/iscroll/build/iscroll.js \
./node_modules/js-cookie/src/js.cookie.js \
./projects/swipey/src/swipey.jquery.plugin.js \
./projects/jquery.ui.touch-punch/jquery.ui.touch-punch.min.js \
./node_modules/imask/dist/imask.min.js \
../wavemaker-ui-variables/dist/umd/index.js \
../custom-widgets-m3/dist/umd/index.js \
./node_modules/@metrichor/jmespath/dist/jmespath.umd.js \
./node_modules/angular-imask/bundles/angular-imask.umd.js \
./node_modules/tabbable/dist/index.umd.js \
./node_modules/@wavemaker/focus-trap/dist/focus-trap.umd.js \
./node_modules/@ztree/ztree_v3/js/jquery.ztree.all.js \
./projects/components/widgets/basic/tree/src/keyboard-navigation.js \
-o ./dist/bundles/wmmobile/scripts/wm-libs.js -b
./node_modules/.bin/terser ./dist/bundles/wmmobile/scripts/wm-libs.js \
-c -o ./dist/bundles/wmmobile/scripts/wm-libs.min.js -m -b beautify=false,ascii_only=true
if [[ "$?" -eq "0" ]]; then
echo "uglify: mobile-libs - success"
else
echo -e "uglify: mobile-libs - failure"
fi
}
buildWebLibs() {
buildCoreJs
buildTsLib
buildNgxBootstrap
buildAngularUmdLibs
buildUmdFiles
bundleWebLibs
}
buildIonicNative() {
execCommand "rollup" "awesome-cordova" "${ROLLUP} -c ./projects/mobile/awesome-cordova/rollup.awesome-cordova.config.mjs"
}
buildMobileLibs() {
buildIonicNative
bundleMobileLibs
}
buildLibs() {
hasLibChanges
if [[ "$?" -eq "0" ]]; then
npm install
npm update
buildWebLibs
buildMobileLibs
if [[ "$?" -eq "0" ]]; then
touch ./dist/LIB_${SUCCESS_FILE}
fi
else
hasLibJsChanges
if [[ "$?" -eq "0" ]]; then
bundleWebLibs
bundleMobileLibs
if [[ "$?" -eq "0" ]]; then
touch ./dist/LIB_${SUCCESS_FILE}
fi
else
echo "No changes in package.json. use --force to re-build libs"
fi
fi
}
buildLibs
buildApp
buildDocs
copyLocale
copyDist
end=`date +%s`
runtime=$((end-start))
echo "Execution time: ${runtime}sec"