underpost 2.8.31 → 2.8.42

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.
Files changed (53) hide show
  1. package/.github/workflows/ghpkg.yml +10 -7
  2. package/.github/workflows/pwa-microservices-template.page.yml +10 -3
  3. package/.vscode/extensions.json +9 -0
  4. package/.vscode/settings.json +10 -4
  5. package/AUTHORS.md +16 -5
  6. package/CHANGELOG.md +8 -0
  7. package/Dockerfile +19 -26
  8. package/README.md +1 -1
  9. package/bin/build.js +283 -0
  10. package/bin/db.js +2 -24
  11. package/bin/deploy.js +59 -49
  12. package/bin/file.js +3 -2
  13. package/bin/index.js +34 -41
  14. package/bin/util.js +9 -89
  15. package/bin/vs.js +22 -0
  16. package/conf.js +27 -143
  17. package/docker-compose.yml +1 -1
  18. package/manifests/core/kustomization.yaml +11 -0
  19. package/manifests/kind-config.yaml +12 -0
  20. package/manifests/letsencrypt-prod.yaml +15 -0
  21. package/package.json +4 -33
  22. package/src/api/user/user.model.js +7 -2
  23. package/src/client/components/core/CalendarCore.js +3 -0
  24. package/src/client/components/core/CommonJs.js +25 -0
  25. package/src/client/components/core/Modal.js +5 -5
  26. package/src/client/components/core/Panel.js +3 -1
  27. package/src/client/components/core/Translate.js +16 -4
  28. package/src/client/components/core/Validator.js +9 -1
  29. package/src/client/services/default/default.management.js +4 -2
  30. package/src/index.js +8 -1
  31. package/src/runtime/lampp/Lampp.js +1 -13
  32. package/src/runtime/xampp/Xampp.js +0 -13
  33. package/src/server/auth.js +3 -3
  34. package/src/server/client-build.js +3 -13
  35. package/src/server/conf.js +294 -27
  36. package/src/server/dns.js +2 -3
  37. package/src/server/logger.js +10 -5
  38. package/src/server/network.js +0 -36
  39. package/src/server/process.js +1 -1
  40. package/src/server/project.js +39 -0
  41. package/src/server/proxy.js +4 -26
  42. package/src/server/runtime.js +6 -7
  43. package/manifests/test/underpost-engine-pod.yaml +0 -108
  44. package/src/server/prompt-optimizer.js +0 -28
  45. /package/manifests/{underpost-engine-backup-access.yaml → core/underpost-engine-backup-access.yaml} +0 -0
  46. /package/manifests/{underpost-engine-backup-pv-pvc.yaml → core/underpost-engine-backup-pv-pvc.yaml} +0 -0
  47. /package/manifests/{underpost-engine-headless-service.yaml → core/underpost-engine-headless-service.yaml} +0 -0
  48. /package/manifests/{underpost-engine-mongodb-backup-cronjob.yaml → core/underpost-engine-mongodb-backup-cronjob.yaml} +0 -0
  49. /package/manifests/{test → core}/underpost-engine-mongodb-configmap.yaml +0 -0
  50. /package/manifests/{underpost-engine-pv-pvc.yaml → core/underpost-engine-pv-pvc.yaml} +0 -0
  51. /package/manifests/{underpost-engine-statefulset.yaml → core/underpost-engine-statefulset.yaml} +0 -0
  52. /package/manifests/{test → deployment}/mongo-express.yaml +0 -0
  53. /package/manifests/{test → deployment}/phpmyadmin.yaml +0 -0
@@ -19,6 +19,7 @@ jobs:
19
19
  id-token: write
20
20
  steps:
21
21
  - uses: actions/checkout@v3
22
+
22
23
  - uses: actions/setup-node@v4
23
24
  with:
24
25
  node-version: '22.x'
@@ -32,10 +33,10 @@ jobs:
32
33
  git config --global credential.helper ""
33
34
  git config credential.helper ""
34
35
  git config --global user.name 'underpostnet'
35
- git config --global user.email 'fcoverdugoa@underpost.net'
36
+ git config --global user.email 'development@underpost.net'
36
37
  git config --global credential.interactive always
37
38
  git config user.name 'underpostnet'
38
- git config user.email 'fcoverdugoa@underpost.net'
39
+ git config user.email 'development@underpost.net'
39
40
  git config credential.interactive always
40
41
 
41
42
  - name: Clone github package repository
@@ -59,6 +60,7 @@ jobs:
59
60
  id-token: write
60
61
  steps:
61
62
  - uses: actions/checkout@v3
63
+
62
64
  - uses: actions/setup-node@v4
63
65
  with:
64
66
  node-version: '22.x'
@@ -86,25 +88,26 @@ jobs:
86
88
 
87
89
  - name: Clone github package repository
88
90
  run: |
89
- git clone https://github.com/underpostnet/pwa-microservices-template-ghpkg.git
91
+ git clone --bare https://github.com/underpostnet/pwa-microservices-template-ghpkg.git
90
92
  rm -rf ./.git
91
- cp -a ./pwa-microservices-template-ghpkg/.git ./.git
92
- rm -rf ./pwa-microservices-template-ghpkg
93
+ cp -rf -a ./pwa-microservices-template-ghpkg.git ./.git
94
+ rm -rf ./pwa-microservices-template-ghpkg.git
93
95
 
94
96
  - name: Set git credentials
95
97
  run: |
96
98
  git config --global credential.helper ""
97
99
  git config credential.helper ""
98
100
  git config --global user.name 'underpostnet'
99
- git config --global user.email 'fcoverdugoa@underpost.net'
101
+ git config --global user.email 'development@underpost.net'
100
102
  git config --global credential.interactive always
101
103
  git config user.name 'underpostnet'
102
- git config user.email 'fcoverdugoa@underpost.net'
104
+ git config user.email 'development@underpost.net'
103
105
  git config credential.interactive always
104
106
 
105
107
  - name: Push to github package repository
106
108
  run: |
107
109
  pwd
110
+ git init
108
111
  git status
109
112
  git remote set-url origin git@github.com:underpostnet/pwa-microservices-template-ghpkg.git
110
113
  git add .
@@ -32,6 +32,10 @@ jobs:
32
32
  steps:
33
33
  - name: Checkout
34
34
  uses: actions/checkout@v4
35
+ # with:
36
+ # lfs: true
37
+ # - name: Checkout LFS objects
38
+ # run: git lfs checkout
35
39
  - uses: actions/setup-node@v4
36
40
  with:
37
41
  node-version: '22.x'
@@ -39,9 +43,12 @@ jobs:
39
43
  - name: Build the site
40
44
  run: |
41
45
  npm install
42
- node bin/deploy update-default-conf
43
- npm run build-production github-pages underpostnet.github.io /pwa-microservices-template-ghpkg
44
-
46
+ node bin/deploy update-default-conf ghpkg
47
+ env-cmd -f .env.production node bin/deploy build-full-client github-pages underpostnet.github.io /pwa-microservices-template-ghpkg
48
+ # git lfs install
49
+ # git lfs track
50
+ # git lfs ls-files
51
+ # git lfs pull
45
52
  - name: Setup Pages
46
53
  uses: actions/configure-pages@v5
47
54
  - name: Upload artifact
@@ -2,7 +2,16 @@
2
2
  "recommendations": [
3
3
  "antiantisepticeye.vscode-color-picker",
4
4
  "bashmish.es6-string-css",
5
+ "eamodio.gitlens",
5
6
  "esbenp.prettier-vscode",
7
+ "foxundermoon.shell-format",
8
+ "github.vscode-github-actions",
9
+ "mintlify.document",
10
+ "ms-python.black-formatter",
11
+ "ms-python.debugpy",
12
+ "ms-python.python",
13
+ "ms-python.vscode-pylance",
14
+ "streetsidesoftware.code-spell-checker",
6
15
  "tabnine.tabnine-vscode",
7
16
  "tobermory.es6-string-html"
8
17
  ]
@@ -48,6 +48,7 @@
48
48
  "Microdata",
49
49
  "minami",
50
50
  "MMORPG",
51
+ "mongosh",
51
52
  "mysqldump",
52
53
  "neodrag",
53
54
  "nexodev",
@@ -69,9 +70,6 @@
69
70
  "xfwd",
70
71
  "youtu"
71
72
  ],
72
- "[dockerfile]": {
73
- "editor.defaultFormatter": "ms-azuretools.vscode-docker"
74
- },
75
73
  "[php]": {
76
74
  "editor.defaultFormatter": "bmewburn.vscode-intelephense-client"
77
75
  },
@@ -107,5 +105,13 @@
107
105
  },
108
106
  "[solidity]": {
109
107
  "editor.defaultFormatter": "JuanBlanco.solidity"
110
- }
108
+ },
109
+ "[dockerfile]": {
110
+ "editor.defaultFormatter": "foxundermoon.shell-format"
111
+ },
112
+ "[ignore]": {
113
+ "editor.defaultFormatter": "foxundermoon.shell-format"
114
+ },
115
+ "docwriter.progress.trackTypes": true,
116
+ "docwriter.hotkey.mac": "⌘ + ."
111
117
  }
package/AUTHORS.md CHANGED
@@ -1,10 +1,21 @@
1
1
  # Authors
2
2
 
3
- #### Ordered by first contribution.
4
3
 
5
- - fcoverdugo ([fcoverdugoa@underpost.net](mailto:fcoverdugoa@underpost.net))
6
- - underpost.net ([52893447+underpostnet@users.noreply.github.com](mailto:52893447+underpostnet@users.noreply.github.com))
7
- - fcoverdugoa ([52893447+underpostnet@users.noreply.github.com](mailto:52893447+underpostnet@users.noreply.github.com))
8
- - underpostnet ([fcoverdugoa@underpost.net](mailto:fcoverdugoa@underpost.net))
4
+ Author: fcoverdugoa <52893447+underpostnet@users.noreply.github.com>
5
+
6
+
7
+ Author: fcoverdugoa <fcoverdugoa@underpost.net>
8
+
9
+
10
+ Author: fcoverdugo <fcoverdugoa@underpost.net>
11
+
12
+
13
+ Author: underpost.net <52893447+underpostnet@users.noreply.github.com>
14
+
15
+
16
+ Author: underpostnet <fcoverdugoa@underpost.net>
17
+
18
+
19
+
9
20
 
10
21
  #### Generated by [underpost.net](https://underpost.net)
package/CHANGELOG.md CHANGED
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ #### [v2.8.31](https://github.com/underpostnet/engine/compare/v2.8.1...v2.8.31)
8
+
9
+ > 5 February 2025
10
+
11
+ - build(clipboardy): 🛠 add cli copy paste [`18acbde`](https://github.com/underpostnet/engine/commit/18acbded151da88499a3a0f1c1bfdbdef2abfc6b)
12
+ - HealthcareAppointmentService advance [`228257c`](https://github.com/underpostnet/engine/commit/228257c0aa2d875014e72f2550bb44aa6b009bed)
13
+ - healthcare appoiment service advance [`207a299`](https://github.com/underpostnet/engine/commit/207a299ffc815870a574524907d5b6b3d9924f1a)
14
+
7
15
  #### [v2.8.1](https://github.com/underpostnet/engine/compare/v2.8.0...v2.8.1)
8
16
 
9
17
  > 20 January 2025
package/Dockerfile CHANGED
@@ -9,39 +9,33 @@ WORKDIR /code
9
9
  # Set root password to root, format is 'user:password'.
10
10
  RUN echo 'root:root' | chpasswd
11
11
 
12
- RUN apt-get update --fix-missing && \
13
- apt-get upgrade -y && \
14
- # install sudo
15
- apt-get -y install sudo && \
16
- # net-tools provides netstat commands
17
- apt-get -y install curl net-tools && \
18
- apt-get -yq install openssh-server supervisor && \
19
- # Few handy utilities which are nice to have
20
- apt-get -y install nano vim less --no-install-recommends && \
21
- apt-get clean
12
+ RUN apt-get update --fix-missing
13
+ RUN apt-get upgrade -y
14
+ # install sudo
15
+ RUN apt-get -y install sudo
16
+ # net-tools provides netstat commands
17
+ RUN apt-get -y install curl net-tools
18
+ RUN apt-get -yq install openssh-server supervisor
19
+ # Few handy utilities which are nice to have
20
+ RUN apt-get -y install nano vim less --no-install-recommends
21
+ RUN apt-get clean
22
22
 
23
23
  # install ssh
24
- RUN mkdir -p /var/run/sshd && \
25
- # Allow root login via password
26
- sed -ri 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
24
+ RUN mkdir -p /var/run/sshd
25
+ # Allow root login via password
26
+ RUN sed -ri 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
27
27
 
28
28
  # copy supervisor config file to start openssh-server
29
29
  COPY supervisord-openssh-server.conf /etc/supervisor/conf.d/supervisord-openssh-server.conf
30
30
 
31
31
  # install open ssl git and others tools
32
- RUN apt-get install -yq --no-install-recommends \
33
- libssl-dev \
34
- curl \
35
- wget \
36
- git \
37
- gnupg
32
+ RUN apt-get install -yq --no-install-recommends libssl-dev curl wget git gnupg
38
33
 
39
34
  # install nodejs https://github.com/nodesource/distributions/blob/master/README.md#deb
40
- RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
41
- apt-get install -y nodejs \
42
- build-essential && \
43
- node --version && \
44
- npm --version
35
+ RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
36
+ RUN apt-get install -y nodejs build-essential
37
+ RUN node --version
38
+ RUN npm --version
45
39
 
46
40
  # local test
47
41
 
@@ -55,7 +49,6 @@ RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
55
49
  # EXPOSE 4000-4004
56
50
  # CMD [ "npm", "run", "dev" ]
57
51
 
58
-
59
52
  # EXPOSE 3000-3004
60
53
  # CMD [ "npm", "start" ]
61
54
 
@@ -73,4 +66,4 @@ EXPOSE 22 80 443 3306 27017
73
66
  # EXPOSE 22
74
67
  EXPOSE 4000-4004
75
68
 
76
- CMD [ "node", "./startup.cjs" ]
69
+ CMD [ "node", "./startup.cjs" ]
package/README.md CHANGED
@@ -16,7 +16,7 @@ template
16
16
 
17
17
  <div align="center">
18
18
 
19
- <a target="_top" href='https://www.npmjs.com/package/npm/v/10.2.3' ><img alt='npm' src='https://img.shields.io/badge/npm v10.2.3-100000?style=flat&logo=npm&logoColor=white&labelColor=CB3837&color=727273'/></a> <a target="_top" href='https://nodejs.org/download/release/v22.9.0/' ><img alt='nodedotjs' src='https://img.shields.io/badge/node v22.9.0-100000?style=flat&logo=nodedotjs&logoColor=white&labelColor=5FA04E&color=727273'/></a> <a target="_top" href='https://pgp.mongodb.com/' ><img alt='mongodb' src='https://img.shields.io/badge/mongodb_server v7.0-100000?style=flat&logo=mongodb&logoColor=white&labelColor=47A248&color=727273'/></a>
19
+ <a target="_top" href='https://www.npmjs.com/package/npm/v/11.1.0' ><img alt='npm' src='https://img.shields.io/badge/npm v11.1.0-100000?style=flat&logo=npm&logoColor=white&labelColor=CB3837&color=727273'/></a> <a target="_top" href='https://nodejs.org/download/release/v22.9.0/' ><img alt='nodedotjs' src='https://img.shields.io/badge/node v23.8.0-100000?style=flat&logo=nodedotjs&logoColor=white&labelColor=5FA04E&color=727273'/></a> <a target="_top" href='https://pgp.mongodb.com/' ><img alt='mongodb' src='https://img.shields.io/badge/mongodb_server v7.0-100000?style=flat&logo=mongodb&logoColor=white&labelColor=47A248&color=727273'/></a>
20
20
 
21
21
  </div>
22
22
 
package/bin/build.js ADDED
@@ -0,0 +1,283 @@
1
+ import fs from 'fs-extra';
2
+ import { loggerFactory } from '../src/server/logger.js';
3
+ import { shellExec } from '../src/server/process.js';
4
+ import dotenv from 'dotenv';
5
+ import { getCapVariableName } from '../src/client/components/core/CommonJs.js';
6
+ import { buildProxyRouter, buildPortProxyRouter, Config, getPathsSSR, buildKindPorts } from '../src/server/conf.js';
7
+
8
+ const baseConfPath = './engine-private/conf/dd-cron/.env.production';
9
+ if (fs.existsSync(baseConfPath)) dotenv.config({ path: baseConfPath, override: true });
10
+
11
+ const logger = loggerFactory(import.meta);
12
+
13
+ // (async () => {
14
+ // return;
15
+ // const files = await fs.readdir(`./src`);
16
+ // for (const relativePath of files) {
17
+ // }
18
+ // })();
19
+
20
+ const confName = process.argv[2];
21
+ const basePath = '../pwa-microservices-template';
22
+ const repoName = `engine-${confName.split('dd-')[1]}`;
23
+ const privateRepoName = `${repoName}-private`;
24
+ const privateRepoNameBackUp = `${repoName}-cron-backups`;
25
+ const gitPrivateUrl = `https://${process.env.GITHUB_TOKEN}@github.com/underpostnet/${privateRepoName}.git`;
26
+ const gitPrivateBackUpUrl = `https://${process.env.GITHUB_TOKEN}@github.com/underpostnet/${privateRepoNameBackUp}.git`;
27
+
28
+ logger.info('', {
29
+ confName,
30
+ repoName,
31
+ privateRepoName,
32
+ privateRepoNameBackUp,
33
+ basePath,
34
+ });
35
+
36
+ if (process.argv.includes('info')) process.exit(0);
37
+
38
+ if (process.argv.includes('proxy')) {
39
+ const env = process.argv.includes('development') ? 'development' : 'production';
40
+ process.env.NODE_ENV = env;
41
+ process.env.PORT = process.env.NODE_ENV === 'development' ? 4000 : 3000;
42
+ process.argv[2] = 'proxy';
43
+ process.argv[3] = fs.readFileSync('./engine-private/deploy/dd-router', 'utf8').trim();
44
+
45
+ await Config.build();
46
+ process.env.NODE_ENV = 'production';
47
+ const router = buildPortProxyRouter(443, buildProxyRouter());
48
+ const confServer = JSON.parse(fs.readFileSync(`./engine-private/conf/${confName}/conf.server.json`, 'utf8'));
49
+ const confHosts = Object.keys(confServer);
50
+
51
+ for (const host of Object.keys(router)) {
52
+ if (!confHosts.find((_host) => host.match(_host))) {
53
+ delete router[host];
54
+ }
55
+ }
56
+
57
+ const ports = Object.values(router).map((p) => p.split(':')[2]);
58
+
59
+ const fromPort = ports[0];
60
+ const toPort = ports[ports.length - 1];
61
+
62
+ logger.info('port range', { fromPort, toPort, router });
63
+
64
+ const deploymentYamlFilePath = `./engine-private/conf/${confName}/build/${env}/deployment.yaml`;
65
+
66
+ const deploymentYamlParts = fs.readFileSync(deploymentYamlFilePath, 'utf8').split('ports:');
67
+ deploymentYamlParts[1] =
68
+ buildKindPorts(fromPort, toPort) +
69
+ ` type: LoadBalancer
70
+ `;
71
+
72
+ fs.writeFileSync(
73
+ deploymentYamlFilePath,
74
+ deploymentYamlParts.join(`ports:
75
+ `),
76
+ );
77
+
78
+ let proxyYaml = '';
79
+ let secretYaml = '';
80
+
81
+ for (const host of Object.keys(confServer)) {
82
+ if (env === 'production')
83
+ secretYaml += `
84
+ ---
85
+ apiVersion: cert-manager.io/v1
86
+ kind: Certificate
87
+ metadata:
88
+ name: ${host}
89
+ spec:
90
+ commonName: ${host}
91
+ dnsNames:
92
+ - ${host}
93
+ issuerRef:
94
+ name: letsencrypt-prod
95
+ kind: ClusterIssuer
96
+ secretName: ${host}`;
97
+
98
+ const pathPortConditions = [];
99
+ for (const path of Object.keys(confServer[host])) {
100
+ const { peer } = confServer[host][path];
101
+ const port = parseInt(router[`${host}${path === '/' ? '' : path}`].split(':')[2]);
102
+ // logger.info('', { host, port, path });
103
+ pathPortConditions.push({
104
+ port,
105
+ path,
106
+ });
107
+
108
+ if (peer) {
109
+ // logger.info('', { host, port: port + 1, path: '/peer' });
110
+ pathPortConditions.push({
111
+ port: port + 1,
112
+ path: '/peer',
113
+ });
114
+ }
115
+ }
116
+ // logger.info('', { host, pathPortConditions });
117
+ proxyYaml += `
118
+ ---
119
+ apiVersion: projectcontour.io/v1
120
+ kind: HTTPProxy
121
+ metadata:
122
+ name: ${host}
123
+ spec:
124
+ virtualhost:
125
+ fqdn: ${host}${
126
+ env === 'development'
127
+ ? ''
128
+ : `
129
+ tls:
130
+ secretName: ${host}`
131
+ }
132
+ routes:`;
133
+ for (const conditionObj of pathPortConditions) {
134
+ const { path, port } = conditionObj;
135
+ proxyYaml += `
136
+ - conditions:
137
+ - prefix: ${path}
138
+ enableWebsockets: true
139
+ services:
140
+ - name: ${confName}-${env}-service
141
+ port: ${port}`;
142
+ }
143
+ }
144
+ const yamlPath = `./engine-private/conf/${confName}/build/${env}/proxy.yaml`;
145
+ fs.writeFileSync(yamlPath, proxyYaml, 'utf8');
146
+ if (env === 'production') {
147
+ const yamlPath = `./engine-private/conf/${confName}/build/${env}/secret.yaml`;
148
+ fs.writeFileSync(yamlPath, secretYaml, 'utf8');
149
+ }
150
+
151
+ process.exit(0);
152
+ }
153
+ if (process.argv.includes('conf')) {
154
+ if (!fs.existsSync(`../${privateRepoName}`)) {
155
+ shellExec(`cd .. && git clone ${gitPrivateUrl}`, { silent: true });
156
+ } else {
157
+ shellExec(`cd ../${privateRepoName} && git pull`);
158
+ }
159
+ const toPath = `../${privateRepoName}/conf/${confName}`;
160
+ fs.removeSync(toPath);
161
+ fs.mkdirSync(toPath, { recursive: true });
162
+ fs.copySync(`./engine-private/conf/${confName}`, toPath);
163
+ shellExec(
164
+ `cd ../${privateRepoName}` +
165
+ ` && git add .` +
166
+ ` && git commit -m "ci(engine-core-conf): ⚙️ Update ${confName} conf"` +
167
+ ` && git push`,
168
+ );
169
+ process.exit(0);
170
+ }
171
+
172
+ if (process.argv.includes('cron-backups')) {
173
+ if (!fs.existsSync(`../${privateRepoNameBackUp}`)) {
174
+ shellExec(`cd .. && git clone ${gitPrivateBackUpUrl}`, { silent: true });
175
+ } else {
176
+ shellExec(`cd ../${privateRepoNameBackUp} && git pull`);
177
+ }
178
+ const serverConf = JSON.parse(fs.readFileSync(`./engine-private/conf/${confName}/conf.server.json`, 'utf8'));
179
+ for (const host of Object.keys(serverConf)) {
180
+ for (let path of Object.keys(serverConf[host])) {
181
+ path = path.replaceAll('/', '-');
182
+ const toPath = `../${privateRepoNameBackUp}/${host}${path}`;
183
+ const fromPath = `./engine-private/cron-backups/${host}${path}`;
184
+ if (fs.existsSync(fromPath)) {
185
+ if (fs.existsSync(toPath)) fs.removeSync(toPath);
186
+ logger.info('Build', { fromPath, toPath });
187
+ fs.copySync(fromPath, toPath);
188
+ }
189
+ }
190
+ }
191
+ shellExec(
192
+ `cd ../${privateRepoNameBackUp}` +
193
+ ` && git add .` +
194
+ ` && git commit -m "ci(engine-core-cron-backups): ⚙️ Update ${confName} cron backups"` +
195
+ ` && git push`,
196
+ );
197
+ process.exit(0);
198
+ }
199
+
200
+ if (process.argv.includes('test')) {
201
+ fs.mkdirSync(`${basePath}/engine-private/conf`, { recursive: true });
202
+ fs.copySync(`./engine-private/conf/${confName}`, `${basePath}/engine-private/conf/${confName}`);
203
+ }
204
+
205
+ const { DefaultConf } = await import(`../conf.${confName}.js`);
206
+
207
+ {
208
+ for (const host of Object.keys(DefaultConf.server)) {
209
+ for (const path of Object.keys(DefaultConf.server[host])) {
210
+ const { apis, ws } = DefaultConf.server[host][path];
211
+ if (apis)
212
+ for (const api of apis) {
213
+ {
214
+ const originPath = `./src/api/${api}`;
215
+ logger.info(`Build`, originPath);
216
+ fs.copySync(originPath, `${basePath}/src/api/${api}`);
217
+ }
218
+ {
219
+ const originPath = `./src/client/services/${api}`;
220
+ logger.info(`Build`, originPath);
221
+ fs.copySync(originPath, `${basePath}/src/client/services/${api}`);
222
+ }
223
+ }
224
+
225
+ if (ws && ws !== 'core' && ws !== 'default') {
226
+ fs.copySync(`./src/ws/${ws}`, `${basePath}/src/ws/${ws}`);
227
+ }
228
+ }
229
+ }
230
+ }
231
+
232
+ {
233
+ for (const client of Object.keys(DefaultConf.client)) {
234
+ const capName = getCapVariableName(client);
235
+ for (const component of Object.keys(DefaultConf.client[client].components)) {
236
+ const originPath = `./src/client/components/${component}`;
237
+ if (fs.existsSync(originPath)) {
238
+ logger.info(`Build`, originPath);
239
+ fs.copySync(originPath, `${basePath}/src/client/components/${component}`);
240
+ }
241
+ }
242
+ {
243
+ const originPath = `./src/client/${capName}.index.js`;
244
+ if (fs.existsSync(originPath)) {
245
+ logger.info(`Build`, originPath);
246
+ fs.copyFileSync(originPath, `${basePath}/src/client/${capName}.index.js`);
247
+ }
248
+ }
249
+ {
250
+ const originPath = `./src/client/public/${client}`;
251
+ if (fs.existsSync(originPath)) {
252
+ logger.info(`Build`, originPath);
253
+ fs.copySync(originPath, `${basePath}/src/client/public/${client}`);
254
+ }
255
+ }
256
+ }
257
+ }
258
+
259
+ {
260
+ for (const client of Object.keys(DefaultConf.ssr)) {
261
+ const ssrPaths = getPathsSSR(DefaultConf.ssr[client]);
262
+ for (const originPath of ssrPaths) {
263
+ if (fs.existsSync(originPath)) {
264
+ logger.info(`Build`, originPath);
265
+ fs.copySync(originPath, `${basePath}/${originPath}`);
266
+ }
267
+ }
268
+ }
269
+
270
+ fs.copyFileSync(`./conf.${confName}.js`, `${basePath}/conf.js`);
271
+ fs.copyFileSync(
272
+ `./.github/workflows/engine.${confName.split('dd-')[1]}.ci.yml`,
273
+ `${basePath}/.github/workflows/engine.${confName.split('dd-')[1]}.ci.yml`,
274
+ );
275
+
276
+ const packageJson = JSON.parse(fs.readFileSync(`${basePath}/package.json`, 'utf8'));
277
+ packageJson.name = repoName;
278
+ fs.writeFileSync(
279
+ `${basePath}/package.json`,
280
+ JSON.stringify(packageJson, null, 4).replaceAll('pwa-microservices-template', repoName),
281
+ 'utf8',
282
+ );
283
+ }
package/bin/db.js CHANGED
@@ -4,10 +4,9 @@ import { loggerFactory } from '../src/server/logger.js';
4
4
  import { MariaDB } from '../src/db/mariadb/MariaDB.js';
5
5
  import { Xampp } from '../src/runtime/xampp/Xampp.js';
6
6
  import { Lampp } from '../src/runtime/lampp/Lampp.js';
7
- import { getCapVariableName, getRestoreCronCmd, loadConf } from '../src/server/conf.js';
7
+ import { getCapVariableName, getRestoreCronCmd, loadConf, splitFileFactory } from '../src/server/conf.js';
8
8
  import { DataBaseProvider } from '../src/db/DataBaseProvider.js';
9
9
  import { hashPassword } from '../src/server/auth.js';
10
- import splitFile from 'split-file';
11
10
 
12
11
  const logger = loggerFactory(import.meta);
13
12
 
@@ -101,28 +100,7 @@ try {
101
100
 
102
101
  cmd = `mysqldump -u ${user} -p${password} ${name} > ${cmdBackupPath}`;
103
102
  shellExec(cmd);
104
- const stats = fs.statSync(cmdBackupPath);
105
- const maxSizeInBytes = 1024 * 1024 * 50; // 50 mb
106
- const fileSizeInBytes = stats.size;
107
- if (fileSizeInBytes > maxSizeInBytes) {
108
- await new Promise((resolve) => {
109
- splitFile
110
- .splitFileBySize(cmdBackupPath, maxSizeInBytes) // 50 mb
111
- .then((names) => {
112
- fs.writeFileSync(
113
- `${cmdBackupPath.split('/').slice(0, -1).join('/')}/${name}-parths.json`,
114
- JSON.stringify(names, null, 4),
115
- 'utf8',
116
- );
117
- resolve();
118
- })
119
- .catch((err) => {
120
- console.log('Error: ', err);
121
- resolve();
122
- });
123
- });
124
- fs.removeSync(cmdBackupPath);
125
- }
103
+ await splitFileFactory(name, cmdBackupPath);
126
104
  }
127
105
  break;
128
106
  case 'import':