underpost 2.6.2 → 2.6.3

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/.nycrc CHANGED
@@ -3,7 +3,7 @@
3
3
  "include": ["test"],
4
4
  "output": "reports",
5
5
  "reporter": ["html", "text", "lcov", "text-lcov", "cobertura"],
6
- "sourceMap": false,
7
- "instrument": false,
6
+ "sourceMap": true,
7
+ "instrument": true,
8
8
  "all": true
9
9
  }
package/Dockerfile CHANGED
@@ -76,11 +76,13 @@ RUN apt-get install -y mongodb-org
76
76
  RUN sed -i "s,\\(^[[:blank:]]*bindIp:\\) .*,\\1 0.0.0.0," /etc/mongod.conf
77
77
 
78
78
  # Bundle app source
79
- COPY . .
79
+ # COPY . .
80
80
 
81
- RUN npm install
81
+ # Install underpost cli
82
+ RUN npm install -g underpost
82
83
 
83
- VOLUME [ "/code/logs" ]
84
+
85
+ VOLUME [ "/code/app/logs" ]
84
86
 
85
87
  EXPOSE 22 80 443 3306 27017
86
88
  EXPOSE 3000-3020
package/README.md CHANGED
@@ -49,3 +49,48 @@ underpost new my-project-name
49
49
  ```
50
50
 
51
51
  After template installation, the server will be running on [http://localhost:4001](http://localhost:4001)
52
+
53
+ #### Usage
54
+
55
+ ```bash
56
+ cd my-project-name
57
+ ```
58
+
59
+ Build client bundle
60
+
61
+ ```bash
62
+ npm run build
63
+ ```
64
+
65
+ Run dev client server
66
+
67
+ ```bash
68
+ npm run dev
69
+ ```
70
+
71
+ Run dev api server
72
+
73
+ ```bash
74
+ npm run dev-api
75
+ ```
76
+
77
+ Run on `pm2`
78
+
79
+ ```bash
80
+ npm run pm2
81
+ ```
82
+
83
+ Run on `docker-compose`
84
+
85
+ ```bash
86
+ npm run start:docker
87
+ ```
88
+
89
+ Run on `docker`
90
+
91
+ ```bash
92
+ # build image
93
+ docker build . -t engine
94
+ # run image
95
+ docker run --name engine-instance -p 41061:3001 -p 41062:3002 engine
96
+ ```
package/bin/deploy.js CHANGED
@@ -441,24 +441,44 @@ try {
441
441
  if (!proxyInstance) for (const host of Object.keys(serverConf)) port += Object.keys(serverConf[host]).length;
442
442
  }
443
443
  break;
444
+ case 'uml':
445
+ {
446
+ shellExec(`node bin/deploy fix-uml ${process.argv.slice(3).join(' ')}`);
447
+ shellExec(`node bin/deploy build-uml ${process.argv.slice(3).join(' ')}`);
448
+ }
449
+ break;
444
450
 
451
+ case 'fix-uml': {
452
+ // comment:
453
+ // '--add-opens=java.xml/com.sun.org.apache.xalan.internal.xsltc.trax="ALL-UNNAMED"'
454
+ // in plantuml.js src
455
+
456
+ // const deployId = process.argv[3];
457
+ // const clientId = process.argv[4];
458
+ // const folder = `./src/client/public/${clientId ? clientId : 'default'}/docs/plantuml`;
459
+ // const privateConfFolder = `./engine-private/conf/${deployId}`;
460
+ // const confData = !deployId
461
+ // ? Config.default
462
+ // : {
463
+ // client: JSON.parse(fs.readFileSync(`${privateConfFolder}/conf.client.json`, 'utf8')),
464
+ // ssr: JSON.parse(fs.readFileSync(`${privateConfFolder}/conf.ssr.json`, 'utf8')),
465
+ // server: JSON.parse(fs.readFileSync(`${privateConfFolder}/conf.server.json`, 'utf8')),
466
+ // cron: JSON.parse(fs.readFileSync(`${privateConfFolder}/conf.cron.json`, 'utf8')),
467
+ // };
468
+
469
+ fs.writeFileSync(
470
+ `./node_modules/plantuml/lib/plantuml.js`,
471
+ fs
472
+ .readFileSync(`./node_modules/plantuml/lib/plantuml.js`, 'utf8')
473
+ .replace(`'--add-opens=java.xml/com.sun.org.apache.xalan.internal.xsltc.trax="ALL-UNNAMED"'`, `//`),
474
+ );
475
+ }
445
476
  case 'build-uml':
446
477
  {
447
- // comment:
448
- // '--add-opens=java.xml/com.sun.org.apache.xalan.internal.xsltc.trax="ALL-UNNAMED"'
449
- // in plantuml.js src
450
-
451
- const deployId = process.argv[3];
452
- const clientId = process.argv[4];
453
- const folder = `./src/client/public/${clientId ? clientId : 'default'}/plantuml`;
454
- const confData = !deployId
455
- ? Config.default
456
- : {
457
- client: '',
458
- ssr: '',
459
- server: '',
460
- cron: '',
461
- };
478
+ const host = process.argv[3];
479
+ const path = process.argv[4];
480
+ const folder = `./public/${host}${path}/docs/plantuml`;
481
+ const confData = Config.default;
462
482
 
463
483
  if (!fs.existsSync(folder)) fs.mkdirSync(folder, { recursive: true });
464
484
 
@@ -469,7 +489,7 @@ try {
469
489
  ${JSON.stringify(confData[typeConf])}
470
490
  @endjson
471
491
  `);
472
- fs.writeFileSync(`${folder}/${typeConf}-conf-default.svg`, svg);
492
+ fs.writeFileSync(`${folder}/${typeConf}-conf.svg`, svg);
473
493
  }
474
494
  {
475
495
  const svg = await plantuml(`
@@ -477,7 +497,7 @@ try {
477
497
  ${JSON.stringify(toJsonSchema(confData[typeConf]))}
478
498
  @endjson
479
499
  `);
480
- fs.writeFileSync(`${folder}/${typeConf}-schema-default.svg`, svg);
500
+ fs.writeFileSync(`${folder}/${typeConf}-schema.svg`, svg);
481
501
  }
482
502
  }
483
503
  }
@@ -547,7 +567,12 @@ try {
547
567
  originPackageJson.version = newVersion;
548
568
  fs.writeFileSync(`package.json`, JSON.stringify(originPackageJson, null, 4), 'utf8');
549
569
 
550
- {
570
+ const originPackageLockJson = JSON.parse(fs.readFileSync(`package-lock.json`, 'utf8'));
571
+ originPackageLockJson.version = newVersion;
572
+ originPackageLockJson.packages[''].version = newVersion;
573
+ fs.writeFileSync(`package-lock.json`, JSON.stringify(originPackageLockJson, null, 4), 'utf8');
574
+
575
+ if (fs.existsSync(`./engine-private/conf`)) {
551
576
  const files = await fs.readdir(`./engine-private/conf`, { recursive: true });
552
577
  for (const relativePath of files) {
553
578
  const filePah = `./engine-private/conf/${relativePath.replaceAll(`\\`, '/')}`;
@@ -567,13 +592,14 @@ try {
567
592
  'utf8',
568
593
  );
569
594
 
570
- fs.writeFileSync(
571
- `./.github/workflows/docker-image.yml`,
572
- fs
573
- .readFileSync(`./.github/workflows/docker-image.yml`, 'utf8')
574
- .replaceAll(`underpost-engine:v${version}`, `underpost-engine:v${newVersion}`),
575
- 'utf8',
576
- );
595
+ if (fs.existsSync(`./.github/workflows/docker-image.yml`))
596
+ fs.writeFileSync(
597
+ `./.github/workflows/docker-image.yml`,
598
+ fs
599
+ .readFileSync(`./.github/workflows/docker-image.yml`, 'utf8')
600
+ .replaceAll(`underpost-engine:v${version}`, `underpost-engine:v${newVersion}`),
601
+ 'utf8',
602
+ );
577
603
 
578
604
  fs.writeFileSync(
579
605
  `./src/client/components/core/Docs.js`,
package/bin/index.js CHANGED
@@ -11,19 +11,24 @@ const logger = loggerFactory(import.meta);
11
11
 
12
12
  await logger.setUpInfo();
13
13
 
14
+ const globalBinFolder = `${shellExec(`npm root -g`, { stdout: true, silent: true }).trim()}/underpost`;
15
+
14
16
  switch (process.argv[2]) {
15
17
  case 'new':
16
18
  {
17
19
  const projectName = process.argv[3] || 'my-project';
18
- const globalBinFolder = shellExec(`npm root -g`, { stdout: true, silent: true }).trim();
19
20
  const destFolder = `${process.cwd()}/${projectName}`;
20
21
  fs.mkdirSync(destFolder, { recursive: true });
21
- fs.copySync(`${globalBinFolder}/underpost`, destFolder);
22
+ fs.copySync(globalBinFolder, destFolder);
22
23
  shellCd(`${destFolder}`);
23
24
  shellExec(`npm run install-template`);
24
25
  shellExec(`npm run dev`);
25
26
  }
26
27
  break;
28
+ case 'test': {
29
+ shellCd(globalBinFolder);
30
+ shellExec(`npm test`);
31
+ }
27
32
  default:
28
33
  break;
29
34
  }
package/conf.js CHANGED
@@ -238,6 +238,11 @@ const DefaultConf = {
238
238
  },
239
239
  ],
240
240
  },
241
+ backups: [
242
+ {
243
+ deployGroupId: 'default-group',
244
+ },
245
+ ],
241
246
  },
242
247
  };
243
248
 
@@ -58,7 +58,7 @@ services:
58
58
  cpus: '0.25'
59
59
  memory: 20M
60
60
  labels: # labels in Compose file instead of Dockerfile
61
- engine.version: '2.6.2'
61
+ engine.version: '2.6.3'
62
62
  networks:
63
63
  - load-balancer
64
64
 
package/package.json CHANGED
@@ -1,128 +1,129 @@
1
- {
2
- "type": "module",
3
- "main": "src/server.js",
4
- "name": "underpost",
5
- "version": "2.6.2",
6
- "description": "pwa api rest template",
7
- "scripts": {
8
- "start": "env-cmd -f .env.production node --max-old-space-size=8192 src/server",
9
- "pm2": "env-cmd -f .env.production pm2 start src/server.js --node-args=\"--max-old-space-size=8192\" --name engine && pm2 logs",
10
- "ssl": "env-cmd -f .env.production node bin/ssl",
11
- "pm2-delete": "pm2 delete engine",
12
- "build": "node bin/deploy build-full-client --no-warnings",
13
- "dev": "env-cmd -f .env.development node src/client.dev --no-warnings",
14
- "dev-api": "env-cmd -f .env.development nodemon --watch src --ignore src/client src/api",
15
- "docs": "jsdoc -c jsdoc.json",
16
- "backup": "node bin/db default.net/ export",
17
- "install-template": "npm install && npm run build",
18
- "install-global": "npm install -g pm2 && npm install -g jsdoc && npm install -g prettier && npm install -g env-cmd",
19
- "install-test": "npm install -g mocha && npm install -g c8 && npm install -g nyc && npm install -g coveralls",
20
- "install-vs-extensions": "node bin/vs import",
21
- "preinstall": "npm config set audit false && npm config set loglevel error",
22
- "restore-preinstall": "npm config set audit true && npm config set loglevel notice",
23
- "install": "npm run install-global && npm run install-test && npm run restore-preinstall --no-audit --no-warnings",
24
- "docker:start": "docker-compose up",
25
- "prettier": "prettier --write .",
26
- "coveralls": "nyc npm run test --reporter=text-lcov | coveralls -v",
27
- "test": "env-cmd -f .env.test c8 mocha",
28
- "update": "npm update -g && npm update && npm audit fix --force && npm audit fix --force",
29
- "underpost-publish": "npm publish --access public",
30
- "underpost-unpublish": "npm unpublish underpost@2.5.x",
31
- "login": "npm adduser",
32
- "bin": "npm link --force"
33
- },
34
- "bin": {
35
- "underpost": "bin/index.js"
36
- },
37
- "repository": {
38
- "type": "git",
39
- "url": "git+https://github.com/underpostnet/pwa-microservices-template.git"
40
- },
41
- "keywords": [
42
- "pwa",
43
- "template",
44
- "microservices",
45
- "api",
46
- "server",
47
- "proxy",
48
- "client"
49
- ],
50
- "author": "https://github.com/underpostnet",
51
- "license": "MIT",
52
- "bugs": {
53
- "url": "https://github.com/underpostnet/pwa-microservices-template/issues"
54
- },
55
- "homepage": "https://github.com/underpostnet/pwa-microservices-template#readme",
56
- "dependencies": {
57
- "@fortawesome/fontawesome-free": "^6.4.2",
58
- "@loadingio/css-spinner": "^2.0.2",
59
- "@neodrag/vanilla": "^2.0.3",
60
- "@pinata/sdk": "^2.1.0",
61
- "adm-zip": "^0.5.10",
62
- "ag-grid-community": "31.0.0",
63
- "axios": "^1.5.1",
64
- "cli-progress": "^3.12.0",
65
- "cli-spinners": "^3.0.0",
66
- "color": "^4.2.3",
67
- "colors": "^1.4.0",
68
- "compression": "^1.7.4",
69
- "copy-paste": "^1.5.3",
70
- "cors": "^2.8.5",
71
- "d3": "^7.9.0",
72
- "deepmerge": "^4.3.1",
73
- "detect-port": "^1.5.1",
74
- "dotenv": "^16.3.1",
75
- "easymde": "^2.18.0",
76
- "env-cmd": "^10.1.0",
77
- "eventemitter3": "^5.0.1",
78
- "express": "^4.18.2",
79
- "express-fileupload": "^1.4.3",
80
- "favicons": "^7.2.0",
81
- "font-awesome-assets": "^0.0.9",
82
- "fs-extra": "^11.1.1",
83
- "fullcalendar": "^6.1.15",
84
- "html-minifier-terser": "^7.2.0",
85
- "http-proxy-middleware": "^2.0.6",
86
- "ignore-walk": "^6.0.4",
87
- "is-admin": "^4.0.0",
88
- "is-ip": "^5.0.1",
89
- "jimp": "^0.22.12",
90
- "joystick-controller": "^1.0.15",
91
- "json-colorizer": "^2.2.2",
92
- "jsonwebtoken": "^9.0.2",
93
- "kill-port-process": "^3.2.0",
94
- "log-update": "^6.0.0",
95
- "mariadb": "^3.2.2",
96
- "marked": "^12.0.1",
97
- "mongoose": "^8.0.1",
98
- "morgan": "^1.10.0",
99
- "nodemailer": "^6.9.9",
100
- "nodemon": "^3.0.1",
101
- "pathfinding": "^0.4.18",
102
- "peer": "^1.0.2",
103
- "peerjs": "^1.5.2",
104
- "pixi.js": "7.4.0",
105
- "prom-client": "^15.1.2",
106
- "public-ip": "^6.0.1",
107
- "read": "^2.1.0",
108
- "sharp": "^0.32.5",
109
- "shelljs": "^0.8.5",
110
- "sitemap": "^7.1.1",
111
- "socket.io": "^4.7.2",
112
- "sortablejs": "^1.15.0",
113
- "swagger-ui-express": "^5.0.0",
114
- "systeminformation": "^5.21.17",
115
- "text-to-image": "^5.2.0",
116
- "uglify-js": "^3.17.4",
117
- "validator": "^13.11.0",
118
- "winston": "^3.11.0"
119
- },
120
- "devDependencies": {
121
- "chai": "^5.1.0",
122
- "clean-jsdoc-theme": "^4.3.0",
123
- "mocha": "^10.4.0",
124
- "plantuml": "^0.0.2",
125
- "swagger-autogen": "^2.23.7",
126
- "to-json-schema": "^0.2.5"
127
- }
128
- }
1
+ {
2
+ "type": "module",
3
+ "main": "src/server.js",
4
+ "name": "underpost",
5
+ "version": "2.6.3",
6
+ "description": "pwa api rest template",
7
+ "scripts": {
8
+ "start": "env-cmd -f .env.production node --max-old-space-size=8192 src/server",
9
+ "pm2": "env-cmd -f .env.production pm2 start src/server.js --node-args=\"--max-old-space-size=8192\" --name engine && pm2 logs",
10
+ "ssl": "env-cmd -f .env.production node bin/ssl",
11
+ "pm2-delete": "pm2 delete engine",
12
+ "build": "node bin/deploy build-full-client --no-warnings",
13
+ "dev": "env-cmd -f .env.development node src/client.dev --no-warnings",
14
+ "dev-api": "env-cmd -f .env.development nodemon --watch src --ignore src/client src/api",
15
+ "docs": "jsdoc -c jsdoc.json",
16
+ "backup": "node bin/db default.net/ export",
17
+ "install-template": "npm install && npm run build",
18
+ "install-global": "npm install -g pm2 && npm install -g jsdoc && npm install -g prettier && npm install -g env-cmd",
19
+ "install-test": "npm install -g mocha && npm install -g c8 && npm install -g nyc && npm install -g coveralls",
20
+ "install-vs-extensions": "node bin/vs import",
21
+ "preinstall": "npm config set audit false && npm config set loglevel error",
22
+ "restore-preinstall": "npm config set audit true && npm config set loglevel notice",
23
+ "install": "npm run install-global && npm run install-test && npm run restore-preinstall --no-audit --no-warnings",
24
+ "docker:start": "docker-compose up",
25
+ "prettier": "prettier --write .",
26
+ "coveralls": "nyc npm run test --reporter=text-lcov | coveralls -v",
27
+ "test": "env-cmd -f .env.test c8 mocha",
28
+ "update": "npm update -g && npm update && npm audit fix --force && npm audit fix --force",
29
+ "underpost-publish": "npm publish --access public",
30
+ "underpost-unpublish": "npm unpublish underpost@2.5.x",
31
+ "login": "npm adduser",
32
+ "bin": "npm link --force"
33
+ },
34
+ "bin": {
35
+ "underpost": "bin/index.js"
36
+ },
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "git+https://github.com/underpostnet/pwa-microservices-template.git"
40
+ },
41
+ "keywords": [
42
+ "pwa",
43
+ "template",
44
+ "microservices",
45
+ "api",
46
+ "server",
47
+ "proxy",
48
+ "client"
49
+ ],
50
+ "author": "https://github.com/underpostnet",
51
+ "license": "MIT",
52
+ "bugs": {
53
+ "url": "https://github.com/underpostnet/pwa-microservices-template/issues"
54
+ },
55
+ "homepage": "https://github.com/underpostnet/pwa-microservices-template#readme",
56
+ "dependencies": {
57
+ "@fortawesome/fontawesome-free": "^6.4.2",
58
+ "@loadingio/css-spinner": "^2.0.2",
59
+ "@neodrag/vanilla": "^2.0.3",
60
+ "@pinata/sdk": "^2.1.0",
61
+ "adm-zip": "^0.5.10",
62
+ "ag-grid-community": "31.0.0",
63
+ "axios": "^1.5.1",
64
+ "cli-progress": "^3.12.0",
65
+ "cli-spinners": "^3.0.0",
66
+ "color": "^4.2.3",
67
+ "colors": "^1.4.0",
68
+ "compression": "^1.7.4",
69
+ "copy-paste": "^1.5.3",
70
+ "cors": "^2.8.5",
71
+ "d3": "^7.9.0",
72
+ "deepmerge": "^4.3.1",
73
+ "detect-port": "^1.5.1",
74
+ "dotenv": "^16.3.1",
75
+ "easymde": "^2.18.0",
76
+ "env-cmd": "^10.1.0",
77
+ "eventemitter3": "^5.0.1",
78
+ "express": "^4.18.2",
79
+ "express-fileupload": "^1.4.3",
80
+ "favicons": "^7.2.0",
81
+ "font-awesome-assets": "^0.0.9",
82
+ "fs-extra": "^11.1.1",
83
+ "fullcalendar": "^6.1.15",
84
+ "html-minifier-terser": "^7.2.0",
85
+ "http-proxy-middleware": "^2.0.6",
86
+ "ignore-walk": "^6.0.4",
87
+ "is-admin": "^4.0.0",
88
+ "is-ip": "^5.0.1",
89
+ "jimp": "^0.22.12",
90
+ "joystick-controller": "^1.0.15",
91
+ "json-colorizer": "^2.2.2",
92
+ "jsonwebtoken": "^9.0.2",
93
+ "kill-port-process": "^3.2.0",
94
+ "log-update": "^6.0.0",
95
+ "mariadb": "^3.2.2",
96
+ "marked": "^12.0.1",
97
+ "mongoose": "^8.0.1",
98
+ "morgan": "^1.10.0",
99
+ "nodemailer": "^6.9.9",
100
+ "nodemon": "^3.0.1",
101
+ "pathfinding": "^0.4.18",
102
+ "peer": "^1.0.2",
103
+ "peerjs": "^1.5.2",
104
+ "pixi.js": "7.4.0",
105
+ "prom-client": "^15.1.2",
106
+ "public-ip": "^6.0.1",
107
+ "read": "^2.1.0",
108
+ "sharp": "^0.32.5",
109
+ "shelljs": "^0.8.5",
110
+ "simple-icons": "^13.9.0",
111
+ "sitemap": "^7.1.1",
112
+ "socket.io": "^4.7.2",
113
+ "sortablejs": "^1.15.0",
114
+ "swagger-ui-express": "^5.0.0",
115
+ "systeminformation": "^5.21.17",
116
+ "text-to-image": "^5.2.0",
117
+ "uglify-js": "^3.17.4",
118
+ "validator": "^13.11.0",
119
+ "winston": "^3.11.0",
120
+ "chai": "^5.1.0"
121
+ },
122
+ "devDependencies": {
123
+ "clean-jsdoc-theme": "^4.3.0",
124
+ "mocha": "^10.4.0",
125
+ "plantuml": "^0.0.2",
126
+ "swagger-autogen": "^2.23.7",
127
+ "to-json-schema": "^0.2.5"
128
+ }
129
+ }
@@ -12,6 +12,7 @@ const BtnIcon = {
12
12
  style: '',
13
13
  attrs: '',
14
14
  label: '',
15
+ labelStyle: '',
15
16
  tabHref: '',
16
17
  tooltipHtml: '',
17
18
  },
@@ -41,7 +42,9 @@ const BtnIcon = {
41
42
  href="${options.tabHref}"
42
43
  style="${renderCssAttr({ style: { width: '100%', height: '100%', top: '0%', left: '0%' } })}"
43
44
  >
44
- <span class="in btn-label-content"> ${label}</span></a
45
+ <span class="in btn-label-content" ${options?.labelStyle ? `style='${options.labelStyle}'` : ''}>
46
+ ${label}</span
47
+ ></a
45
48
  >`
46
49
  : label}
47
50
  </button>`;
@@ -657,6 +657,28 @@ function validatePassword(password) {
657
657
  return errors;
658
658
  }
659
659
 
660
+ function componentFromStr(numStr, percent) {
661
+ const num = Math.max(0, parseInt(numStr, 10));
662
+ return percent ? Math.floor((255 * Math.min(100, num)) / 100) : Math.min(255, num);
663
+ }
664
+
665
+ function rgbToHex(rgb) {
666
+ const rgbRegex = /^rgb\(\s*(-?\d+)(%?)\s*,\s*(-?\d+)(%?)\s*,\s*(-?\d+)(%?)\s*\)$/;
667
+ let result,
668
+ r,
669
+ g,
670
+ b,
671
+ hex = '';
672
+ if ((result = rgbRegex.exec(rgb))) {
673
+ r = componentFromStr(result[1], result[2]);
674
+ g = componentFromStr(result[3], result[4]);
675
+ b = componentFromStr(result[5], result[6]);
676
+
677
+ hex = '' + (0x1000000 + (r << 16) + (g << 8) + b).toString(16).slice(1);
678
+ }
679
+ return hex;
680
+ }
681
+
660
682
  export {
661
683
  s4,
662
684
  range,
@@ -705,4 +727,6 @@ export {
705
727
  getMostFrequentValue,
706
728
  getFillMatrix,
707
729
  validatePassword,
730
+ componentFromStr,
731
+ rgbToHex,
708
732
  };
@@ -130,6 +130,10 @@ const CssCommonCore = async () => {
130
130
  .title-view-modal .view-title-icon {
131
131
  font-size: 21px !important;
132
132
  }
133
+ .plantuml-svg {
134
+ width: 100%;
135
+ height: auto;
136
+ }
133
137
  </style>
134
138
  <style>
135
139
  .lds-dual-ring-mini,
@@ -1,5 +1,6 @@
1
1
  import { BtnIcon } from './BtnIcon.js';
2
- import { Css, dynamicCol, Themes } from './Css.js';
2
+ import { rgbToHex } from './CommonJs.js';
3
+ import { Css, darkTheme, dynamicCol, renderCssAttr, ThemeEvents, Themes } from './Css.js';
3
4
  import { DropDown } from './DropDown.js';
4
5
  import { Modal, renderMenuLabel, renderViewTitle } from './Modal.js';
5
6
  import { listenQueryPathInstance, setQueryPath } from './Router.js';
@@ -8,6 +9,8 @@ import { getProxyPath, getQueryParams, htmls, s } from './VanillaJs.js';
8
9
 
9
10
  // https://mintlify.com/docs/quickstart
10
11
 
12
+ const umlTypes = ['server', 'cron', 'client', 'ssr'];
13
+
11
14
  const Docs = {
12
15
  RenderModal: async function (type, modalOptions) {
13
16
  const docData = this.Data.find((d) => d.type === type);
@@ -22,8 +25,14 @@ const Docs = {
22
25
  title: renderViewTitle(docData),
23
26
  id: ModalId,
24
27
  html: async () => {
28
+ if (docData.renderHtml) return await docData.renderHtml();
25
29
  return html`
26
- <iframe class="in iframe-${ModalId}" style="width: 100%; border: none;" src="${docData.url()}"> </iframe>
30
+ <iframe
31
+ class="in iframe-${ModalId}"
32
+ style="width: 100%; border: none; background: white"
33
+ src="${docData.url()}"
34
+ >
35
+ </iframe>
27
36
  `;
28
37
  },
29
38
  maximize: true,
@@ -40,12 +49,20 @@ const Docs = {
40
49
  Modal.Data[ModalId].onObserverListener[ModalId]();
41
50
  },
42
51
  Data: [
52
+ {
53
+ type: 'repo',
54
+ icon: html`<i class="fab fa-github"></i>`,
55
+ text: `Last Release`,
56
+ url: function () {
57
+ return `https://github.com/underpostnet/engine/`;
58
+ },
59
+ },
43
60
  {
44
61
  type: 'src',
45
62
  icon: html`<i class="fa-brands fa-osi"></i>`,
46
63
  text: 'Source Docs',
47
64
  url: function () {
48
- return `${getProxyPath()}docs/engine/2.6.2`;
65
+ return `${getProxyPath()}docs/engine/2.6.3`;
49
66
  },
50
67
  },
51
68
  {
@@ -57,14 +74,59 @@ const Docs = {
57
74
  },
58
75
  },
59
76
  {
60
- type: 'repo',
61
- icon: html`<i class="fab fa-github"></i>`,
62
- text: `Last Release`,
77
+ type: 'coverage',
78
+ icon: html`<img height="20" width="20" class="doc-icon-coverage" />`,
79
+ text: `Coverage report`,
63
80
  url: function () {
64
- return `https://github.com/underpostnet/engine/`;
81
+ return `${getProxyPath()}docs/coverage`;
82
+ },
83
+ themeEvent: () => {
84
+ s(`.doc-icon-coverage`).src = `https://cdn.simpleicons.org/coveralls/${rgbToHex(
85
+ window.getComputedStyle(s('html')).color,
86
+ )}`;
65
87
  },
66
88
  },
67
- ],
89
+ {
90
+ type: 'coverage-link',
91
+ icon: html`<img height="20" width="20" class="doc-icon-coverage-link" />`,
92
+ text: `Coverage`,
93
+ url: function () {
94
+ return `https://coveralls.io/github/underpostnet/engine`;
95
+ },
96
+ themeEvent: () => {
97
+ s(`.doc-icon-coverage-link`).src = `https://cdn.simpleicons.org/coveralls/${rgbToHex(
98
+ window.getComputedStyle(s('html')).color,
99
+ )}`;
100
+ },
101
+ },
102
+ ].concat(
103
+ umlTypes.map((umlType) => {
104
+ const umlId = `uml-${umlType}`;
105
+ return {
106
+ type: umlId,
107
+ icon: html`<i class="fas fa-sitemap"></i>`,
108
+ text: Translate.Render(`${umlType} config uml`),
109
+ renderHtml: function () {
110
+ return html` <div class="in section-mp">
111
+ <div class="in sub-title-modal"><i class="fas fa-project-diagram"></i> Schema</div>
112
+ </div>
113
+ <div class="in section-mp">
114
+ <a href="${getProxyPath()}docs/plantuml/${umlType}-schema.svg" target="_blank"
115
+ ><img class="in plantuml-svg" src="${getProxyPath()}docs/plantuml/${umlType}-schema.svg"
116
+ /></a>
117
+ </div>
118
+ <div class="in section-mp">
119
+ <div class="in sub-title-modal"><i class="fas fa-project-diagram"></i> Instance example</div>
120
+ </div>
121
+ <div class="in section-mp">
122
+ <a href="${getProxyPath()}docs/plantuml/${umlType}-conf.svg" target="_blank"
123
+ ><img class="in plantuml-svg" src="${getProxyPath()}docs/plantuml/${umlType}-conf.svg"
124
+ /></a>
125
+ </div>`;
126
+ },
127
+ };
128
+ }),
129
+ ),
68
130
  Init: async function (options) {
69
131
  const { idModal } = options;
70
132
  setTimeout(() => {
@@ -76,10 +138,28 @@ const Docs = {
76
138
  setTimeout(() => setQueryPath({ path: 'docs', queryPath: 'api' }));
77
139
  await this.RenderModal('api', options.modalOptions);
78
140
  };
141
+ s(`.btn-docs-coverage`).onclick = async () => {
142
+ setTimeout(() => setQueryPath({ path: 'docs', queryPath: 'coverage' }));
143
+ await this.RenderModal('coverage', options.modalOptions);
144
+ };
145
+
146
+ s(`.btn-docs-coverage-link`).onclick = () => {
147
+ const docData = this.Data.find((d) => d.type === 'coverage-link');
148
+ location.href = docData.url();
149
+ };
79
150
  s(`.btn-docs-repo`).onclick = () => {
80
151
  const docData = this.Data.find((d) => d.type === 'repo');
81
152
  location.href = docData.url();
82
153
  };
154
+
155
+ for (const umlType of umlTypes) {
156
+ const umlId = `uml-${umlType}`;
157
+ s(`.btn-docs-${umlId}`).onclick = async () => {
158
+ setTimeout(() => setQueryPath({ path: 'docs', queryPath: umlId }));
159
+ await this.RenderModal(umlId, { ...options.modalOptions, handleType: 'bar' });
160
+ };
161
+ }
162
+
83
163
  // if (!getQueryParams().p) s(`.btn-docs-src`).click();
84
164
  listenQueryPathInstance({
85
165
  id: options.idModal,
@@ -91,10 +171,29 @@ const Docs = {
91
171
  });
92
172
  let docMenuRender = '';
93
173
  for (const docData of this.Data) {
174
+ if (docData.themeEvent) {
175
+ ThemeEvents[`doc-icon-${docData.type}`] = docData.themeEvent;
176
+ setTimeout(ThemeEvents[`doc-icon-${docData.type}`]);
177
+ }
178
+ let tabHref, style, labelStyle;
179
+ switch (docData.type) {
180
+ case 'repo':
181
+ case 'coverage-link':
182
+ tabHref = docData.url();
183
+ style = renderCssAttr({ style: { height: '45px' } });
184
+ labelStyle = renderCssAttr({ style: { top: '8px', left: '9px' } });
185
+ break;
186
+
187
+ default:
188
+ break;
189
+ }
94
190
  docMenuRender += html` <div class="in">
95
191
  ${await BtnIcon.Render({
96
192
  class: `inl section-mp btn-custom btn-docs-${docData.type}`,
97
193
  label: html`${docData.icon} ${docData.text}`,
194
+ tabHref,
195
+ style,
196
+ labelStyle,
98
197
  })}
99
198
  </div>`;
100
199
  }
@@ -109,6 +109,9 @@ const sa = (el) => document.querySelectorAll(el); // .forEach((currentValue, cur
109
109
  // s(`.${idModal}`).offsetWidth
110
110
  // s(`.${idModal}`).offsetHeight
111
111
 
112
+ // get css style tag data definitions
113
+ // window.getComputedStyle(el).color;
114
+
112
115
  /**
113
116
  * The `copyData` function uses the Clipboard API to copy the provided data to the clipboard and
114
117
  * returns a promise that resolves to true if successful or false if unsuccessful.
@@ -108,6 +108,6 @@ SrrComponent = ({ ttiLoadTimeLimit }) => {
108
108
  const CacheControl = ${CacheControl};
109
109
  CacheControl({ ttiLoadTimeLimit: ${ttiLoadTimeLimit ? ttiLoadTimeLimit : 1000 * 70 * 1} });
110
110
  </script>
111
- <div class="clean-cache-container">v2.6.2</div>
111
+ <div class="clean-cache-container">v2.6.3</div>
112
112
  `;
113
113
  };
@@ -26,7 +26,8 @@ const BackUpManagement = {
26
26
  if (!fs.existsSync('./engine-private/cron-backups'))
27
27
  fs.mkdirSync('./engine-private/cron-backups', { recursive: true });
28
28
 
29
- for (const deployGroupId of backups) {
29
+ for (const deployGroupData of backups) {
30
+ const { deployGroupId } = deployGroupData;
30
31
  const dataDeploy = getDataDeploy({ deployGroupId });
31
32
 
32
33
  for (const deployObj of dataDeploy) {
@@ -104,6 +104,7 @@ const buildClient = async (options = { liveClientBuildPaths: [], instances: [] }
104
104
  const confClient = JSON.parse(fs.readFileSync(`./conf/conf.client.json`, 'utf8'));
105
105
  const confServer = JSON.parse(fs.readFileSync(`./conf/conf.server.json`, 'utf8'));
106
106
  const confSSR = JSON.parse(fs.readFileSync(`./conf/conf.ssr.json`, 'utf8'));
107
+ const packageData = JSON.parse(fs.readFileSync(`./package.json`, 'utf8'));
107
108
  const acmeChallengePath = `/.well-known/acme-challenge`;
108
109
  const publicPath = `./public`;
109
110
 
@@ -133,7 +134,6 @@ const buildClient = async (options = { liveClientBuildPaths: [], instances: [] }
133
134
  apis,
134
135
  iconsBuild,
135
136
  docsBuild,
136
- swaggerApiVersion,
137
137
  apiBaseProxyPath,
138
138
  apiBaseHost,
139
139
  ttiLoadTimeLimit,
@@ -559,13 +559,24 @@ Sitemap: https://${host}${path === '/' ? '' : path}/sitemap.xml`,
559
559
  logger.warn('build jsdoc view', jsDocsConfig.opts.destination);
560
560
  shellExec(`npm run docs`, { silent: true });
561
561
 
562
+ // coverage
563
+ if (!fs.existsSync(`./coverage`)) {
564
+ shellExec(`npm test`);
565
+ }
566
+ const coverageBuildPath = `${jsDocsConfig.opts.destination}/coverage`;
567
+ fs.mkdirSync(coverageBuildPath, { recursive: true });
568
+ fs.copySync(`./coverage`, coverageBuildPath);
569
+
570
+ // uml
571
+ shellExec(`node bin/deploy uml ${host} ${path}`);
572
+
562
573
  // https://swagger-autogen.github.io/docs/
563
574
 
564
575
  const basePath = path === '/' ? `${process.env.BASE_API}` : `/${process.env.BASE_API}`;
565
576
 
566
577
  const doc = {
567
578
  info: {
568
- version: swaggerApiVersion ? swaggerApiVersion : '0.0.1', // by default: '1.0.0'
579
+ version: packageData.version, // by default: '1.0.0'
569
580
  title: metadata?.title ? `${metadata.title}` : 'REST API', // by default: 'REST API'
570
581
  description: metadata?.description ? metadata.description : '', // by default: ''
571
582
  },
package/startup.js CHANGED
@@ -8,4 +8,4 @@ shellExec(`sudo /opt/lampp/lampp start`, { async: true });
8
8
 
9
9
  shellExec(`/usr/bin/mongod -f /etc/mongod.conf`, { async: true });
10
10
 
11
- shellExec(`npm start`);
11
+ shellExec(`underpost new app`);