bpm-core 0.0.130 → 0.0.131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/bpm-core.mjs +146 -88
- package/fesm2022/bpm-core.mjs.map +1 -1
- package/lib/components/shared-components/form-field/shared-imports.d.ts +3 -3
- package/lib/testComponent/request-details-section/request-details-section.component.d.ts +3 -11
- package/package.json +2 -2
- package/src/lib/assets/scss/_general.scss +0 -205
- package/src/lib/assets/scss/base.scss +0 -2
- package/cli/deploy/build.js +0 -62
- package/cli/deploy/git-operations-handler.js +0 -104
- package/cli/deploy/index.js +0 -61
- package/cli/deploy/jenkins-manager.js +0 -107
- package/cli/generate/index.js +0 -10
- package/cli/generate/mock/form-node.js +0 -77
- package/cli/generate/mock/index.js +0 -209
- package/cli/generate/mock/lov.js +0 -18
- package/cli/generate/new/angular-template/.editorconfig +0 -13
- package/cli/generate/new/angular-template/README.md +0 -7
- package/cli/generate/new/angular-template/angular.json.ejs +0 -167
- package/cli/generate/new/angular-template/build.sh +0 -6
- package/cli/generate/new/angular-template/extra-webpack.config.js.ejs +0 -5
- package/cli/generate/new/angular-template/karma.conf.js +0 -44
- package/cli/generate/new/angular-template/package.json.ejs +0 -67
- package/cli/generate/new/angular-template/protractor.conf.js +0 -28
- package/cli/generate/new/angular-template/src/app/app.component.html +0 -35
- package/cli/generate/new/angular-template/src/app/app.component.scss +0 -0
- package/cli/generate/new/angular-template/src/app/app.component.ts +0 -81
- package/cli/generate/new/angular-template/src/app/config/segment-dynamic-loader.config.ts.ejs +0 -8
- package/cli/generate/new/angular-template/src/app/i18n/ar.ts.ejs +0 -18
- package/cli/generate/new/angular-template/src/app/i18n/en.ts.ejs +0 -18
- package/cli/generate/new/angular-template/src/app/page-components/@@comp-template@@/@@.component.html.ejs +0 -33
- package/cli/generate/new/angular-template/src/app/page-components/@@comp-template@@/@@.component.ts.ejs +0 -128
- package/cli/generate/new/angular-template/src/app/page-components/@@comp-template@@/_html-field.ejs +0 -97
- package/cli/generate/new/angular-template/src/app/page-components/@@comp-template@@/_html-table.ejs +0 -27
- package/cli/generate/new/angular-template/src/app/page-components/@@comp-template@@/_ts-field.ejs +0 -3
- package/cli/generate/new/angular-template/src/app/shared/pipes/translate.pipe.ts +0 -32
- package/cli/generate/new/angular-template/src/app/shared/services/i18n.service.ts +0 -32
- package/cli/generate/new/angular-template/src/app/shared/services/segment-dynamic-loader.service.ts.ejs +0 -49
- package/cli/generate/new/angular-template/src/app/shared/services/state-machine.service.ts +0 -119
- package/cli/generate/new/angular-template/src/app/shared/types/lov.enum.ts.ejs +0 -7
- package/cli/generate/new/angular-template/src/app/templates/print-section/print-section.component.html +0 -5
- package/cli/generate/new/angular-template/src/app/templates/print-section/print-section.component.scss +0 -0
- package/cli/generate/new/angular-template/src/app/templates/print-section/print-section.component.ts.ejs +0 -156
- package/cli/generate/new/angular-template/src/app/templates/print.ts.ejs +0 -392
- package/cli/generate/new/angular-template/src/environments/environment.local.ts.ejs +0 -40
- package/cli/generate/new/angular-template/src/environments/environment.prod.ts +0 -25
- package/cli/generate/new/angular-template/src/environments/environment.ts +0 -25
- package/cli/generate/new/angular-template/src/favicon.ico +0 -0
- package/cli/generate/new/angular-template/src/index.html.ejs +0 -14
- package/cli/generate/new/angular-template/src/main.ts +0 -49
- package/cli/generate/new/angular-template/src/polyfills.ts +0 -65
- package/cli/generate/new/angular-template/src/styles.scss.ejs +0 -121
- package/cli/generate/new/angular-template/src/test.ts +0 -26
- package/cli/generate/new/angular-template/tsconfig.app.json +0 -15
- package/cli/generate/new/angular-template/tsconfig.json +0 -50
- package/cli/generate/new/angular-template/tsconfig.spec.json +0 -18
- package/cli/generate/new/angular-template/tslint.json +0 -143
- package/cli/generate/new/copy-and-generate.js +0 -120
- package/cli/generate/new/field.js +0 -4
- package/cli/generate/new/index.js +0 -47
- package/cli/generate/new/service-data.js +0 -284
- package/cli/index.js +0 -14
- package/cli/utilities/utilities.js +0 -114
- package/src/lib/assets/scss/_charts.scss +0 -190
|
@@ -7,6 +7,6 @@ import { ReactiveFormsModule } from "@angular/forms";
|
|
|
7
7
|
import { InfoItemComponent } from "./info-item/info-item.component";
|
|
8
8
|
import { NgClass } from "@angular/common";
|
|
9
9
|
import { TranslatePipe } from "../../../pipes/translate.pipe";
|
|
10
|
-
export declare const MatDatePickerImports: (typeof
|
|
11
|
-
export declare const MatFormImports: (typeof
|
|
12
|
-
export declare const Shareds: (typeof
|
|
10
|
+
export declare const MatDatePickerImports: (typeof MatDatepickerToggle | typeof MatDatepickerInput | typeof MatDatepickerModule)[];
|
|
11
|
+
export declare const MatFormImports: (typeof MatFormFieldModule | typeof MatFormField | typeof MatInput)[];
|
|
12
|
+
export declare const Shareds: (typeof FormLabelComponent | typeof ValidationErrorsComponent | typeof InfoItemComponent | typeof ReactiveFormsModule | typeof NgClass | typeof TranslatePipe)[];
|
|
@@ -2,7 +2,6 @@ import { DestroyRef, OnInit } from '@angular/core';
|
|
|
2
2
|
import { Form, Section } from "../../interfaces";
|
|
3
3
|
import { ActionStateService, CoreI18nService } from "../../services";
|
|
4
4
|
import { FormBuilder, FormGroup, ValidatorFn } from "@angular/forms";
|
|
5
|
-
import { InputMappers } from '../../directives/input-map-filter/input-mappers';
|
|
6
5
|
import * as i0 from "@angular/core";
|
|
7
6
|
export declare class RequestDetailsSectionComponent implements OnInit {
|
|
8
7
|
i18n: CoreI18nService;
|
|
@@ -15,7 +14,7 @@ export declare class RequestDetailsSectionComponent implements OnInit {
|
|
|
15
14
|
isLoading: boolean;
|
|
16
15
|
className: string;
|
|
17
16
|
formGroup: FormGroup;
|
|
18
|
-
options:
|
|
17
|
+
options: string[];
|
|
19
18
|
private readonly DEFAULT_PAGE_SIZE;
|
|
20
19
|
private readonly DEFAULT_PAGE_NUMBER;
|
|
21
20
|
pageNumber: number;
|
|
@@ -54,16 +53,12 @@ export declare class RequestDetailsSectionComponent implements OnInit {
|
|
|
54
53
|
totalElements: number;
|
|
55
54
|
constructor(i18n: CoreI18nService, fb: FormBuilder, actionStateService: ActionStateService);
|
|
56
55
|
ngOnInit(): void;
|
|
57
|
-
radio: {
|
|
58
|
-
key: string;
|
|
59
|
-
value: string;
|
|
60
|
-
};
|
|
61
|
-
timePicker: string;
|
|
62
|
-
timePickerChange(e: any): void;
|
|
63
56
|
initializeTableConfig(): void;
|
|
64
57
|
initializeColumns(): void;
|
|
65
58
|
initializeColumnConfig(): void;
|
|
66
59
|
createForm(): void;
|
|
60
|
+
onAddRow(event: any): void;
|
|
61
|
+
onRemoveRow(event: any): void;
|
|
67
62
|
editAsset(asset: any): void;
|
|
68
63
|
startsWithDMOEOrCR(): ValidatorFn;
|
|
69
64
|
deleteAsset(asset: any): void;
|
|
@@ -72,9 +67,6 @@ export declare class RequestDetailsSectionComponent implements OnInit {
|
|
|
72
67
|
customCallSubmit(action: string): void;
|
|
73
68
|
resetForm(): void;
|
|
74
69
|
pageChanged(event: any): void;
|
|
75
|
-
filterFn: import("bpm-core").InputFilterFn;
|
|
76
|
-
mapFn: typeof InputMappers.toUpperCase;
|
|
77
|
-
log(event: any): void;
|
|
78
70
|
static ɵfac: i0.ɵɵFactoryDeclaration<RequestDetailsSectionComponent, never>;
|
|
79
71
|
static ɵcmp: i0.ɵɵComponentDeclaration<RequestDetailsSectionComponent, "app-request-details-section", never, { "isReadOnly": { "alias": "isReadOnly"; "required": false; }; "section": { "alias": "section"; "required": false; }; "form": { "alias": "form"; "required": false; }; "lov": { "alias": "lov"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, never, true, never>;
|
|
80
72
|
}
|
package/package.json
CHANGED
|
@@ -1335,205 +1335,6 @@ div.mat-mdc-select-panel {
|
|
|
1335
1335
|
overflow: auto !important;
|
|
1336
1336
|
}
|
|
1337
1337
|
|
|
1338
|
-
full-calendar.fc .fc-scroller-liquid-absolute,
|
|
1339
|
-
full-calendar.fc .fc-scroller {
|
|
1340
|
-
overflow: auto !important;
|
|
1341
|
-
}
|
|
1342
|
-
|
|
1343
|
-
full-calendar.fc {
|
|
1344
|
-
--fc-padding: 12px;
|
|
1345
|
-
--fc-header-bc: var(--light-gray);
|
|
1346
|
-
--fc-border-color: #dee0e2;
|
|
1347
|
-
--fc-day-size: 30px;
|
|
1348
|
-
--fc-day-fs: 14px;
|
|
1349
|
-
--fc-toolbar-button-size: 33px;
|
|
1350
|
-
--fc-toolbar-button-radius: 0;
|
|
1351
|
-
--fc-toolbar-button-shadow: 0px 7px 10px 0px rgba(0, 0, 0, 0.03);
|
|
1352
|
-
--fc-toolbar-fs: 16px;
|
|
1353
|
-
--fc-toolbar-fw: var(--font-medium);
|
|
1354
|
-
--fc-highlight-color: transparent;
|
|
1355
|
-
//--fc-daygrid-event-dot-width: 9px;
|
|
1356
|
-
--fc-event-height: auto;
|
|
1357
|
-
--fc-toolbar-button-bc: var(--light-gray);
|
|
1358
|
-
--fc-toolbar-button-radius: 100%;
|
|
1359
|
-
--fc-toolbar-button-size: 30px;
|
|
1360
|
-
--fc-toolbar-button-shadow: none;
|
|
1361
|
-
--fc-border: 1px var(--gray);
|
|
1362
|
-
--fc-shadow: none;
|
|
1363
|
-
--fc-event-text-color: var(--black);
|
|
1364
|
-
|
|
1365
|
-
.fc-view table {
|
|
1366
|
-
.fc-col-header {
|
|
1367
|
-
--fc-header-fc: #00;
|
|
1368
|
-
--fc-header-fs: 12px;
|
|
1369
|
-
--fc-header-fw: 400;
|
|
1370
|
-
border: 1px solid;
|
|
1371
|
-
|
|
1372
|
-
th {
|
|
1373
|
-
// text-align: center;
|
|
1374
|
-
// border-right: 0px;
|
|
1375
|
-
// border-left: 0px;
|
|
1376
|
-
a {
|
|
1377
|
-
color: var(--dark-gray);
|
|
1378
|
-
font-size: 14px;
|
|
1379
|
-
font-weight: 500;
|
|
1380
|
-
}
|
|
1381
|
-
}
|
|
1382
|
-
}
|
|
1383
|
-
|
|
1384
|
-
tbody .fc-scroller-harness {
|
|
1385
|
-
td {
|
|
1386
|
-
height: 122px;
|
|
1387
|
-
|
|
1388
|
-
&.fc-day-other {
|
|
1389
|
-
// background: var(--light-gray) !important;
|
|
1390
|
-
}
|
|
1391
|
-
|
|
1392
|
-
.fc-daygrid-day-frame {
|
|
1393
|
-
// background-color: initial;
|
|
1394
|
-
}
|
|
1395
|
-
|
|
1396
|
-
&:hover {
|
|
1397
|
-
.fc-daygrid-event-harness {
|
|
1398
|
-
// display: none;
|
|
1399
|
-
}
|
|
1400
|
-
|
|
1401
|
-
.fc-daygrid-day-bottom:empty {
|
|
1402
|
-
// background-image: url(../images/plus.svg);
|
|
1403
|
-
display: block;
|
|
1404
|
-
width: 100%;
|
|
1405
|
-
height: 100%;
|
|
1406
|
-
background-position: center center;
|
|
1407
|
-
background-repeat: no-repeat;
|
|
1408
|
-
cursor: pointer;
|
|
1409
|
-
position: absolute;
|
|
1410
|
-
z-index: 140;
|
|
1411
|
-
top: 0;
|
|
1412
|
-
}
|
|
1413
|
-
}
|
|
1414
|
-
|
|
1415
|
-
.fc-daygrid-event-harness {
|
|
1416
|
-
width: 100%;
|
|
1417
|
-
display: flex;
|
|
1418
|
-
justify-content: end;
|
|
1419
|
-
// background: white;
|
|
1420
|
-
height: 100%;
|
|
1421
|
-
z-index: 20;
|
|
1422
|
-
align-items: start;
|
|
1423
|
-
}
|
|
1424
|
-
|
|
1425
|
-
.fc-daygrid-day-events {
|
|
1426
|
-
position: initial;
|
|
1427
|
-
height: 100%;
|
|
1428
|
-
}
|
|
1429
|
-
|
|
1430
|
-
.fc-daygrid-day-frame {
|
|
1431
|
-
height: 100%;
|
|
1432
|
-
}
|
|
1433
|
-
|
|
1434
|
-
.fc-event {
|
|
1435
|
-
padding: 8px 12px;
|
|
1436
|
-
border-radius: 4px;
|
|
1437
|
-
margin: 0;
|
|
1438
|
-
gap: 8px;
|
|
1439
|
-
// width: 100%;
|
|
1440
|
-
text-align: center;
|
|
1441
|
-
cursor: pointer;
|
|
1442
|
-
overflow: hidden;
|
|
1443
|
-
text-overflow: ellipsis;
|
|
1444
|
-
white-space: nowrap;
|
|
1445
|
-
|
|
1446
|
-
.fc-event-time {
|
|
1447
|
-
display: none;
|
|
1448
|
-
}
|
|
1449
|
-
|
|
1450
|
-
.fc-event-title {
|
|
1451
|
-
font-weight: 400;
|
|
1452
|
-
font-size: 12px;
|
|
1453
|
-
}
|
|
1454
|
-
|
|
1455
|
-
.fc-daygrid-event-dot {
|
|
1456
|
-
margin: 0 !important;
|
|
1457
|
-
}
|
|
1458
|
-
|
|
1459
|
-
&.created {
|
|
1460
|
-
background: #007bff;
|
|
1461
|
-
}
|
|
1462
|
-
|
|
1463
|
-
&.submit {
|
|
1464
|
-
background: #868e96;
|
|
1465
|
-
}
|
|
1466
|
-
|
|
1467
|
-
&.progress {
|
|
1468
|
-
background: #ffc107;
|
|
1469
|
-
}
|
|
1470
|
-
|
|
1471
|
-
&.executed {
|
|
1472
|
-
background: #dc3545;
|
|
1473
|
-
}
|
|
1474
|
-
|
|
1475
|
-
&.closed {
|
|
1476
|
-
background: #28a745;
|
|
1477
|
-
}
|
|
1478
|
-
|
|
1479
|
-
&.type {
|
|
1480
|
-
margin-bottom: 8px;
|
|
1481
|
-
padding: 0;
|
|
1482
|
-
display: flex;
|
|
1483
|
-
align-items: center;
|
|
1484
|
-
justify-content: center;
|
|
1485
|
-
width: 30px !important;
|
|
1486
|
-
height: 30px;
|
|
1487
|
-
|
|
1488
|
-
.fc-event-title-container {
|
|
1489
|
-
.fc-event-title {
|
|
1490
|
-
margin-bottom: 0;
|
|
1491
|
-
font-size: 14px;
|
|
1492
|
-
line-height: 14px;
|
|
1493
|
-
}
|
|
1494
|
-
|
|
1495
|
-
&::after {
|
|
1496
|
-
display: none;
|
|
1497
|
-
}
|
|
1498
|
-
}
|
|
1499
|
-
}
|
|
1500
|
-
}
|
|
1501
|
-
|
|
1502
|
-
.fc-daygrid-day-bottom {
|
|
1503
|
-
color: var(--coral);
|
|
1504
|
-
justify-content: end;
|
|
1505
|
-
display: flex;
|
|
1506
|
-
|
|
1507
|
-
a {
|
|
1508
|
-
padding: 5px;
|
|
1509
|
-
}
|
|
1510
|
-
}
|
|
1511
|
-
}
|
|
1512
|
-
}
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
|
-
.fc-daygrid-body {
|
|
1516
|
-
border-right: 1px solid rgb(222, 224, 226);
|
|
1517
|
-
border-left: 1px solid rgb(222, 224, 226);
|
|
1518
|
-
}
|
|
1519
|
-
|
|
1520
|
-
.fc-toolbar.fc-header-toolbar {
|
|
1521
|
-
margin-bottom: 20px;
|
|
1522
|
-
|
|
1523
|
-
.fc-toolbar-chunk {
|
|
1524
|
-
gap: 35px;
|
|
1525
|
-
|
|
1526
|
-
.fc-toolbar-title {
|
|
1527
|
-
min-width: auto;
|
|
1528
|
-
}
|
|
1529
|
-
|
|
1530
|
-
.fc-prev-button,
|
|
1531
|
-
.fc-next-button {
|
|
1532
|
-
}
|
|
1533
|
-
}
|
|
1534
|
-
}
|
|
1535
|
-
}
|
|
1536
|
-
|
|
1537
1338
|
.fc-theme-standard .fc-popover {
|
|
1538
1339
|
border-radius: 5px;
|
|
1539
1340
|
|
|
@@ -1574,12 +1375,6 @@ full-calendar.fc {
|
|
|
1574
1375
|
line-height: 1;
|
|
1575
1376
|
}
|
|
1576
1377
|
|
|
1577
|
-
full-calendar.fc .fc-view table {
|
|
1578
|
-
// border-left-width: 1px;
|
|
1579
|
-
// border-top-width: 1px;
|
|
1580
|
-
// border-radius: 8px;
|
|
1581
|
-
}
|
|
1582
|
-
|
|
1583
1378
|
.CustomType {
|
|
1584
1379
|
margin-bottom: 8px !important;
|
|
1585
1380
|
// padding: 12px !important;
|
package/cli/deploy/build.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.LibraryBuild = exports.Build = void 0;
|
|
27
|
-
const utilities_1 = require("../utilities/utilities");
|
|
28
|
-
const fs = __importStar(require("fs"));
|
|
29
|
-
class Build {
|
|
30
|
-
constructor() { }
|
|
31
|
-
async runBuild(servicePath) {
|
|
32
|
-
await this.runNgBuild(servicePath);
|
|
33
|
-
this.renameBuildFiles(servicePath);
|
|
34
|
-
this.removeUnneededBuildFiles(servicePath);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
exports.Build = Build;
|
|
38
|
-
class LibraryBuild extends Build {
|
|
39
|
-
runNgBuild(servicePath) {
|
|
40
|
-
return (0, utilities_1.runCommand)('npx ng build --aot -c production --output-hashing none', servicePath);
|
|
41
|
-
}
|
|
42
|
-
isWebpackBuildRequired() {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
renameBuildFiles(servicePath) {
|
|
46
|
-
const filesToRenameAfterBuild = [
|
|
47
|
-
{ from: `${servicePath}/dist/main.js`, to: `${servicePath}/dist/wm-main.bundle.js` },
|
|
48
|
-
{ from: `${servicePath}/dist/styles.css`, to: `${servicePath}/dist/wm-styles.bundle.css` },
|
|
49
|
-
{ from: `${servicePath}/dist/polyfills.js`, to: `${servicePath}/dist/wm-polyfills.bundle.js` },
|
|
50
|
-
{ from: `${servicePath}/dist/scripts.js`, to: `${servicePath}/dist/wm-scripts.bundle.js` },
|
|
51
|
-
{ from: `${servicePath}/dist/runtime.js`, to: `${servicePath}/dist/wm-inline.bundle.js` }
|
|
52
|
-
];
|
|
53
|
-
filesToRenameAfterBuild.forEach(item => fs.renameSync(item.from, item.to));
|
|
54
|
-
}
|
|
55
|
-
removeUnneededBuildFiles(servicePath) {
|
|
56
|
-
const scssDirPath = `${servicePath}/dis/assets/scss`;
|
|
57
|
-
if (fs.existsSync(scssDirPath)) {
|
|
58
|
-
fs.rmdirSync(scssDirPath, { recursive: true });
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
exports.LibraryBuild = LibraryBuild;
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.GitOperationsHandler = void 0;
|
|
27
|
-
const fs = __importStar(require("fs"));
|
|
28
|
-
const path = __importStar(require("path"));
|
|
29
|
-
const util_1 = require("util");
|
|
30
|
-
const child_process_1 = require("child_process");
|
|
31
|
-
const utilities_1 = require("../utilities/utilities");
|
|
32
|
-
class GitOperationsHandler {
|
|
33
|
-
constructor() { }
|
|
34
|
-
async sync(localBuildRepoPath, serviceRemoteDir, servicePath, commitMessage, logger, env) {
|
|
35
|
-
if (await this.getCurrentBranch(localBuildRepoPath) !== env) {
|
|
36
|
-
throw new Error(`Current branch in build repo is not "${env}". Please switch to the correct branch and try again.`);
|
|
37
|
-
}
|
|
38
|
-
logger.log('Pulling latest changes from remote repo...');
|
|
39
|
-
await this.pull(localBuildRepoPath);
|
|
40
|
-
logger.log('Copying build files to service directory in build repo...');
|
|
41
|
-
await this.copyBuildFilesToServiceDirInBuildRepo(localBuildRepoPath, serviceRemoteDir, servicePath);
|
|
42
|
-
logger.log(`Files copied from "${servicePath}" to "${path.join(localBuildRepoPath, serviceRemoteDir)}".`);
|
|
43
|
-
logger.log('Committing changes to local build repo...');
|
|
44
|
-
await this.commit(localBuildRepoPath, commitMessage);
|
|
45
|
-
logger.log('Pushing changes to remote repo...');
|
|
46
|
-
await this.push(localBuildRepoPath);
|
|
47
|
-
}
|
|
48
|
-
async pull(localBuildRepoPath) {
|
|
49
|
-
return await (0, utilities_1.runCommand)('git pull', localBuildRepoPath);
|
|
50
|
-
}
|
|
51
|
-
copyBuildFilesToServiceDirInBuildRepo(localBuildRepoPath, serviceDirNameInBuildRepo, servicePath) {
|
|
52
|
-
const from = path.join(servicePath, 'dist');
|
|
53
|
-
const to = path.join(localBuildRepoPath, serviceDirNameInBuildRepo);
|
|
54
|
-
return this.copyFiles(from, to);
|
|
55
|
-
}
|
|
56
|
-
async commit(localBuildRepoPath, commitMessage) {
|
|
57
|
-
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
58
|
-
try {
|
|
59
|
-
const { stdout: status } = await execAsync('git status --porcelain', { cwd: localBuildRepoPath });
|
|
60
|
-
if (status.trim().length === 0) {
|
|
61
|
-
throw new Error('No changes to commit');
|
|
62
|
-
}
|
|
63
|
-
await execAsync('git add .', { cwd: localBuildRepoPath });
|
|
64
|
-
await execAsync(`git commit -m "${commitMessage}"`, { cwd: localBuildRepoPath });
|
|
65
|
-
}
|
|
66
|
-
catch (error) {
|
|
67
|
-
throw new Error('Failed to commit', { cause: error });
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
push(localBuildRepoPath) {
|
|
71
|
-
return (0, utilities_1.runCommand)('git push', localBuildRepoPath);
|
|
72
|
-
}
|
|
73
|
-
async copyFiles(srcDir, destDir) {
|
|
74
|
-
try {
|
|
75
|
-
await fs.promises.mkdir(destDir, { recursive: true });
|
|
76
|
-
const items = await fs.promises.readdir(srcDir, { withFileTypes: true });
|
|
77
|
-
for (const item of items) {
|
|
78
|
-
const srcPath = path.join(srcDir, item.name);
|
|
79
|
-
const destPath = path.join(destDir, item.name);
|
|
80
|
-
if (item.isDirectory()) {
|
|
81
|
-
await this.copyFiles(srcPath, destPath);
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
await fs.promises.copyFile(srcPath, destPath);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
catch (error) {
|
|
89
|
-
const errorMsg = `Error copying files: ${error.message}`;
|
|
90
|
-
throw Error(errorMsg);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
async getCurrentBranch(localBuildRepoPath) {
|
|
94
|
-
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
95
|
-
try {
|
|
96
|
-
const { stdout: currentBranch } = await execAsync('git rev-parse --abbrev-ref HEAD', { cwd: localBuildRepoPath });
|
|
97
|
-
return currentBranch.trim();
|
|
98
|
-
}
|
|
99
|
-
catch (error) {
|
|
100
|
-
throw new Error('Failed to get current branch', { cause: error });
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
exports.GitOperationsHandler = GitOperationsHandler;
|
package/cli/deploy/index.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.deployCommand = void 0;
|
|
27
|
-
const path = __importStar(require("path"));
|
|
28
|
-
const commander_1 = require("commander");
|
|
29
|
-
const build_1 = require("./build");
|
|
30
|
-
const git_operations_handler_1 = require("./git-operations-handler");
|
|
31
|
-
const jenkins_manager_1 = require("./jenkins-manager");
|
|
32
|
-
const utilities_1 = require("../utilities/utilities");
|
|
33
|
-
exports.deployCommand = new commander_1.Command('deploy');
|
|
34
|
-
exports.deployCommand
|
|
35
|
-
.description('Deploy a service to a specific environment, deployment process includes building the service, syncing with the remote repository, and running a Jenkins job if credentials are provided.')
|
|
36
|
-
.requiredOption('--env <string>', 'The env you want to deploy to it (dev, sit, or bat)')
|
|
37
|
-
.requiredOption('--repo-path <string>', 'The path for the local build repo make sure it is switched to env branch you want to deploy to it')
|
|
38
|
-
.requiredOption('--commit-msg <string>', 'The commit message for the changes you want to commit to the build repo')
|
|
39
|
-
.requiredOption('--remote-dir <string>', 'The remote directory name in the build repo where the service files will be copied to')
|
|
40
|
-
.option('--skip-build', 'Skip Angular build (optional)', false)
|
|
41
|
-
.option('--username <string>', 'Jenkins username (optional, if not provided Jenkins job will not run)')
|
|
42
|
-
.option('--token <string>', 'Jenkins token or password (optional, if not provided Jenkins job will not run)')
|
|
43
|
-
.action(async (options) => {
|
|
44
|
-
const cwd = process.cwd();
|
|
45
|
-
const serviceName = path.basename(cwd);
|
|
46
|
-
const env = (0, utilities_1.parseEnv)(options.env);
|
|
47
|
-
const logger = new utilities_1.Logger();
|
|
48
|
-
try {
|
|
49
|
-
if (!options.skipBuild) {
|
|
50
|
-
await logger.asyncLog('Building...')(new build_1.LibraryBuild().runBuild(cwd), 'Build Done.', 'Build Failed.');
|
|
51
|
-
}
|
|
52
|
-
await logger.asyncLog('Syncing with the remote repo...')(new git_operations_handler_1.GitOperationsHandler().sync(options.repoPath, options.remoteDir, cwd, options.commitMsg, logger, env), 'Sync Done.', 'Sync Failed.');
|
|
53
|
-
if (options.username && options.token) {
|
|
54
|
-
await logger.asyncLog('Running Jenkins job...')(new jenkins_manager_1.JenkinsManager().run(options.username, options.token, env, logger), 'Jenkins Job Done.', 'Failed to run Jenkins job.');
|
|
55
|
-
logger.success(`${serviceName.toLocaleUpperCase()} deployed to ${options.env.toUpperCase()} successfully.`);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
catch (err) {
|
|
59
|
-
console.log(`${err.message} ${(err.cause?.message || err.cause) ? 'because ' + (err.cause?.message || err.cause) : ''}`);
|
|
60
|
-
}
|
|
61
|
-
});
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JenkinsManager = void 0;
|
|
4
|
-
class JenkinsManager {
|
|
5
|
-
async run(username, token, env, logger) {
|
|
6
|
-
const jobName = this.getJobName(env);
|
|
7
|
-
try {
|
|
8
|
-
const buildNumber = await this.triggerJenkinsAndGetBuildNumber(username, token, jobName, logger);
|
|
9
|
-
await this.waitForBuildToFinish(buildNumber, username, token, jobName, logger);
|
|
10
|
-
}
|
|
11
|
-
catch (err) {
|
|
12
|
-
throw new Error(`Failed to run Jenkins job`, { cause: err });
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
async triggerJenkinsAndGetBuildNumber(username, token, jobName, logger) {
|
|
16
|
-
const JENKINS_URL = 'http://172.20.151.119:9090';
|
|
17
|
-
const auth = btoa(`${username}:${token}`);
|
|
18
|
-
try {
|
|
19
|
-
const triggerResponse = await fetch(`${JENKINS_URL}/job/${jobName}/build`, {
|
|
20
|
-
method: 'POST',
|
|
21
|
-
headers: {
|
|
22
|
-
'Authorization': `Basic ${auth}`
|
|
23
|
-
},
|
|
24
|
-
redirect: 'manual'
|
|
25
|
-
});
|
|
26
|
-
if (triggerResponse.status !== 201) {
|
|
27
|
-
throw new Error(`Failed to trigger build:, ${triggerResponse.statusText}`);
|
|
28
|
-
}
|
|
29
|
-
const queueUrl = triggerResponse.headers.get('Location');
|
|
30
|
-
if (!queueUrl) {
|
|
31
|
-
throw new Error('No queue URL returned');
|
|
32
|
-
}
|
|
33
|
-
logger.log(`Build queued.`);
|
|
34
|
-
let buildNumber = null;
|
|
35
|
-
const maxAttempts = 20;
|
|
36
|
-
const delay = 3000;
|
|
37
|
-
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
38
|
-
const queueRes = await fetch(`${queueUrl}api/json`, {
|
|
39
|
-
headers: {
|
|
40
|
-
'Authorization': `Basic ${auth}`
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
const queueData = await queueRes.json();
|
|
44
|
-
if (queueData.executable && queueData.executable.number) {
|
|
45
|
-
buildNumber = queueData.executable.number;
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
logger.log(`Waiting for build to start... (${attempt + 1})`);
|
|
49
|
-
await new Promise(resolve => setTimeout(resolve, delay));
|
|
50
|
-
}
|
|
51
|
-
if (buildNumber) {
|
|
52
|
-
logger.log(`Build started with number: ${buildNumber}`);
|
|
53
|
-
return buildNumber;
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
throw new Error('Failed to get build number.');
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
catch (err) {
|
|
60
|
-
throw new Error(`Error triggering Jenkins build: ${err.message}`);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
async waitForBuildToFinish(buildNumber, username, token, jobName, logger) {
|
|
64
|
-
const JENKINS_URL = 'http://172.20.151.119:9090';
|
|
65
|
-
const auth = btoa(`${username}:${token}`);
|
|
66
|
-
const maxAttempts = 40;
|
|
67
|
-
const delay = 5000;
|
|
68
|
-
for (let i = 0; i < maxAttempts; i++) {
|
|
69
|
-
const res = await fetch(`${JENKINS_URL}/job/${jobName}/${buildNumber}/api/json`, {
|
|
70
|
-
headers: {
|
|
71
|
-
'Authorization': `Basic ${auth}`
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
const data = await res.json();
|
|
75
|
-
if (!data.building) {
|
|
76
|
-
const result = data.result;
|
|
77
|
-
if (result === 'SUCCESS') {
|
|
78
|
-
logger.log(`Build #${buildNumber} completed successfully.`);
|
|
79
|
-
return data;
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
throw new Error(`Build #${buildNumber} failed.`);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
logger.log(`Build #${buildNumber} is still running... (${i + 1})`);
|
|
86
|
-
await new Promise(resolve => setTimeout(resolve, delay));
|
|
87
|
-
}
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
getJobName(env) {
|
|
91
|
-
if (!env) {
|
|
92
|
-
throw new Error('Environment is required to get the job name');
|
|
93
|
-
}
|
|
94
|
-
env = env.toLowerCase();
|
|
95
|
-
const jobNameMap = {
|
|
96
|
-
dev: 'wmbpm-web-dev',
|
|
97
|
-
sit: 'wmbpm-web-sit',
|
|
98
|
-
bat: 'wmbpm-web-bat'
|
|
99
|
-
};
|
|
100
|
-
const jobName = jobNameMap[env];
|
|
101
|
-
if (!jobName) {
|
|
102
|
-
throw new Error(`No job name found for environment: ${env}`);
|
|
103
|
-
}
|
|
104
|
-
return jobName;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
exports.JenkinsManager = JenkinsManager;
|
package/cli/generate/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateCommand = void 0;
|
|
4
|
-
const commander_1 = require("commander");
|
|
5
|
-
const mock_1 = require("./mock");
|
|
6
|
-
const new_1 = require("./new");
|
|
7
|
-
exports.generateCommand = new commander_1.Command('generate');
|
|
8
|
-
exports.generateCommand.alias('g');
|
|
9
|
-
exports.generateCommand.addCommand(mock_1.generateMockDataCommand);
|
|
10
|
-
exports.generateCommand.addCommand(new_1.generateNewProjectCommand);
|