underpost 3.2.11 → 3.2.14

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.
@@ -1,187 +1,31 @@
1
- import fs from 'fs-extra';
1
+ #! /usr/bin/env node
2
2
 
3
- import { loggerFactory } from '../src/server/logger.js';
4
- import { getDirname, newInstance, uniqueArray } from '../src/client/components/core/CommonJs.js';
5
- import { shellExec } from '../src/server/process.js';
6
- import walk from 'ignore-walk';
7
- import { validateTemplatePath } from '../src/server/conf.js';
3
+ import { Command } from 'commander';
4
+ import fs from 'fs-extra';
8
5
  import dotenv from 'dotenv';
9
-
10
- const logger = loggerFactory(import.meta);
6
+ import { loggerFactory } from '../src/server/logger.js';
7
+ import { buildTemplate } from '../src/server/conf.js';
11
8
 
12
9
  if (fs.existsSync('./engine-private/conf/dd-cron/.env.production'))
13
- dotenv.config({
14
- path: `./engine-private/conf/dd-cron/.env.production`,
15
- override: true,
16
- });
10
+ dotenv.config({ path: `./engine-private/conf/dd-cron/.env.production`, override: true });
17
11
  else dotenv.config();
18
12
 
19
- // Engine-only paths stripped from the template after the source sync.
20
- const TEMPLATE_DELETE_PATHS = [
21
- './.github',
22
- './manifests/deployment/dd-lampp-development',
23
- './manifests/deployment/dd-cyberia-development',
24
- './manifests/deployment/dd-core-development',
25
- './manifests/deployment/dd-template-development',
26
- './src/server/object-layer.js',
27
- './src/server/atlas-sprite-sheet-generator.js',
28
- './src/server/shape-generator.js',
29
- './src/server/semantic-layer-generator.js',
30
- './src/server/semantic-layer-generator-floor.js',
31
- './src/server/semantic-layer-generator-skin.js',
32
- './src/server/semantic-layer-generator-resource.js',
33
- './src/server/besu-genesis-generator.js',
34
- './src/grpc/cyberia',
35
- './src/runtime/cyberia-server',
36
- './src/runtime/cyberia-client',
37
- './test/shape-generator.test.js',
38
- './src/client/public/cyberia-docs',
39
- 'bin/cyberia.js',
40
- './hardhat',
41
- ];
42
-
43
- // Workflow + service files re-added to the template after the engine-only strip above.
44
- const TEMPLATE_RESTORE_PATHS = [
45
- `./.github/workflows/pwa-microservices-template-page.cd.yml`,
46
- `./.github/workflows/pwa-microservices-template-test.ci.yml`,
47
- `./.github/workflows/npmpkg.ci.yml`,
48
- `./.github/workflows/ghpkg.ci.yml`,
49
- `./.github/workflows/gitlab.ci.yml`,
50
- `./.github/workflows/publish.ci.yml`,
51
- `./.github/workflows/release.cd.yml`,
52
- `./src/client/services/user/guest.service.js`,
53
- './src/api/user/guest.service.js',
54
- './src/ws/IoInterface.js',
55
- './src/ws/IoServer.js',
56
- ];
57
-
58
- const TEMPLATE_KEYWORDS = [
59
- 'underpost',
60
- 'underpost-platform',
61
- 'cli',
62
- 'toolchain',
63
- 'ci-cd',
64
- 'devops',
65
- 'kubernetes',
66
- 'k3s',
67
- 'kubeadm',
68
- 'lxd',
69
- 'bare-metal',
70
- 'container-orchestration',
71
- 'image-management',
72
- 'pwa',
73
- 'workbox',
74
- 'microservices',
75
- ];
76
-
77
- const TEMPLATE_DESCRIPTION =
78
- 'Underpost Platform — end-to-end CI/CD and application-delivery toolchain CLI. Covers bare metal, Kubernetes, K3s, kubeadm, LXD, container/image orchestration, secrets, databases, cron jobs, monitoring, SSH, runners, PWA + Workbox delivery, and release orchestration. Extensible via downstream CLIs.';
79
-
80
- /**
81
- * Builds the pwa-microservices-template from scratch out of the current engine source tree.
82
- *
83
- * Clones (or resets) the template repo next to the engine, syncs every engine-tracked file the
84
- * template is allowed to carry (validateTemplatePath), strips engine-only modules, restores the
85
- * template's own CI workflows + guest services, and rewrites package.json / package-lock.json /
86
- * README so the template is a standalone, installable project.
87
- *
88
- * Usage: node bin/build.template [srcPath=./] [toPath=../pwa-microservices-template]
89
- */
90
- const srcPath = (process.argv[2] ?? './').replaceAll(`'`, '');
91
- const toPath = (process.argv[3] ?? '../pwa-microservices-template').replaceAll(`'`, '');
92
- const githubUsername = process.env.GITHUB_USERNAME;
93
-
94
- logger.info('Build template', { srcPath, toPath });
95
-
96
- try {
97
- const sourceFiles = (
98
- await new Promise((resolve) =>
99
- walk(
100
- {
101
- path: srcPath,
102
- ignoreFiles: [`.gitignore`],
103
- includeEmpty: false,
104
- follow: false,
105
- },
106
- (...args) => resolve(args[1]),
107
- ),
108
- )
109
- ).filter((p) => !p.startsWith('.git'));
110
-
111
- // Clone the template from 0 if missing; otherwise reset it to a clean pristine checkout.
112
- if (!fs.existsSync(toPath)) {
113
- shellExec(`cd .. && node engine/bin clone ${githubUsername}/pwa-microservices-template`);
114
- } else {
115
- shellExec(`cd ${toPath} && git reset && git checkout . && git clean -f -d`);
116
- shellExec(`node bin pull ${toPath} ${githubUsername}/pwa-microservices-template`);
117
- shellExec(`sudo rm -rf ${toPath}/engine-private`);
118
- shellExec(`sudo rm -rf ${toPath}/logs`);
119
- }
120
- shellExec(`cd ${toPath} && git config core.filemode false`);
121
-
122
- for (const copyPath of sourceFiles) {
123
- if (copyPath === 'NaN') continue;
124
- const absolutePath = `${srcPath}/${copyPath}`;
125
- if (!validateTemplatePath(absolutePath)) continue;
126
-
127
- const folder = getDirname(`${toPath}/${copyPath}`);
128
- if (!fs.existsSync(folder)) fs.mkdirSync(folder, { recursive: true });
129
-
130
- logger.info('build', `${toPath}/${copyPath}`);
131
- fs.copyFileSync(absolutePath, `${toPath}/${copyPath}`);
132
- }
133
-
134
- fs.copySync(`./.vscode`, `${toPath}/.vscode`);
135
- fs.copySync(`./src/client/public/default`, `${toPath}/src/client/public/default`);
136
-
137
- // Preserve the template's own README + package.json identity before merging engine metadata.
138
- for (const checkoutPath of ['README.md', 'package.json']) shellExec(`cd ${toPath} && git checkout ${checkoutPath}`);
139
-
140
- for (const deletePath of TEMPLATE_DELETE_PATHS) {
141
- const target = `${toPath}/${deletePath}`;
142
- if (fs.existsSync(target)) fs.removeSync(target);
143
- }
144
-
145
- fs.mkdirSync(`${toPath}/.github/workflows`, { recursive: true });
146
- for (const restorePath of TEMPLATE_RESTORE_PATHS) fs.copyFileSync(restorePath, `${toPath}/${restorePath}`);
147
-
148
- // ── package.json: take engine deps/scripts/version, keep template identity. ──
149
- const originPackageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
150
- const templatePackageJson = JSON.parse(fs.readFileSync(`${toPath}/package.json`, 'utf8'));
151
- const templateName = templatePackageJson.name;
152
-
153
- templatePackageJson.dependencies = originPackageJson.dependencies;
154
- templatePackageJson.devDependencies = originPackageJson.devDependencies;
155
- templatePackageJson.version = originPackageJson.version;
156
- templatePackageJson.scripts = originPackageJson.scripts;
157
- templatePackageJson.overrides = originPackageJson.overrides;
158
- templatePackageJson.name = templateName;
159
- templatePackageJson.description = TEMPLATE_DESCRIPTION;
160
- templatePackageJson.keywords = uniqueArray(TEMPLATE_KEYWORDS.concat(templatePackageJson.keywords || []));
161
- delete templatePackageJson.scripts['update:template'];
162
- fs.writeFileSync(`${toPath}/package.json`, JSON.stringify(templatePackageJson, null, 4), 'utf8');
13
+ const logger = loggerFactory(import.meta);
163
14
 
164
- // ── package-lock.json: mirror engine packages, keep template name/version on the root entry. ──
165
- const originPackageLockJson = JSON.parse(fs.readFileSync('./package-lock.json', 'utf8'));
166
- const templatePackageLockJson = JSON.parse(fs.readFileSync(`${toPath}/package-lock.json`, 'utf8'));
167
- const originBasePackageLock = newInstance(templatePackageLockJson.packages['']);
168
- templatePackageLockJson.name = templateName;
169
- templatePackageLockJson.version = originPackageLockJson.version;
170
- templatePackageLockJson.packages = originPackageLockJson.packages;
171
- templatePackageLockJson.packages[''].name = templateName;
172
- templatePackageLockJson.packages[''].version = originPackageLockJson.version;
173
- templatePackageLockJson.packages[''].hasInstallScript = originBasePackageLock.hasInstallScript;
174
- templatePackageLockJson.packages[''].license = originBasePackageLock.license;
175
- fs.writeFileSync(`${toPath}/package-lock.json`, JSON.stringify(templatePackageLockJson, null, 4), 'utf8');
15
+ const program = new Command();
16
+
17
+ program
18
+ .name('build.template')
19
+ .description('Rebuild the standalone pwa-microservices-template from scratch out of the engine source tree.')
20
+ .argument('[src-path]', 'Engine source root to sync from.', './')
21
+ .argument('[to-path]', 'Template output path.', '../pwa-microservices-template')
22
+ .action(async (srcPath, toPath) => {
23
+ try {
24
+ await buildTemplate({ srcPath: srcPath.replaceAll(`'`, ''), toPath: toPath.replaceAll(`'`, '') });
25
+ } catch (error) {
26
+ logger.error(error, error.stack);
27
+ process.exit(1);
28
+ }
29
+ });
176
30
 
177
- fs.writeFileSync(
178
- `${toPath}/README.md`,
179
- fs
180
- .readFileSync('./README.md', 'utf8')
181
- .replace('<!-- template-title -->', '#### Base template for pwa/api-rest projects.'),
182
- 'utf8',
183
- );
184
- } catch (error) {
185
- logger.error(error, error.stack);
186
- process.exit(1);
187
- }
31
+ await program.parseAsync();
package/bin/deploy.js CHANGED
@@ -283,7 +283,10 @@ ${shellExec(`git log | grep Author: | sort -u`, { stdout: true }).split(`\n`).jo
283
283
  }
284
284
 
285
285
  case 'cli-docs': {
286
- buildCliDoc(program, process.argv[3], process.argv[4]);
286
+ const version = Underpost.version;
287
+ const newVersion =
288
+ process.argv[4] && !process.argv[4].startsWith('v') ? `v${process.argv[4]}` : process.argv[4] || version;
289
+ buildCliDoc(program, process.argv[3] || version, newVersion);
287
290
  break;
288
291
  }
289
292
 
package/bin/index.js CHANGED
@@ -6,8 +6,8 @@ import { loggerFactory } from '../src/server/logger.js';
6
6
  const logger = loggerFactory(import.meta);
7
7
 
8
8
  try {
9
- program.parse();
9
+ await program.parseAsync();
10
10
  } catch (error) {
11
11
  logger.error(error);
12
12
  process.exit(1);
13
- }
13
+ }
package/conf.js CHANGED
@@ -95,16 +95,8 @@ const DefaultConf = /**/ {
95
95
  { path: '/default-management', client: 'Default', ssr: 'Default' },
96
96
  { client: 'Default', ssr: 'Default', path: '/404', title: '404 Not Found' },
97
97
  { client: 'Default', ssr: 'Default', path: '/500', title: '500 Server Error' },
98
- {
99
- path: '/blog',
100
- client: 'Default',
101
- ssr: 'Default',
102
- },
103
- {
104
- path: '/chat',
105
- client: 'Default',
106
- ssr: 'Default',
107
- },
98
+ { path: '/blog', client: 'Default', ssr: 'Default' },
99
+ { path: '/chat', client: 'Default', ssr: 'Default' },
108
100
  ],
109
101
  dists: [
110
102
  {
@@ -121,10 +113,7 @@ const DefaultConf = /**/ {
121
113
  import_name_build: '/dist/sortablejs/sortable.complete.esm.js',
122
114
  },
123
115
  { folder: './node_modules/validator', public_folder: '/dist/validator' },
124
- {
125
- folder: './node_modules/easymde/dist',
126
- public_folder: '/dist/easymde',
127
- },
116
+ { folder: './node_modules/easymde/dist', public_folder: '/dist/easymde' },
128
117
  {
129
118
  folder: './node_modules/marked/lib',
130
119
  public_folder: '/dist/marked',
@@ -157,7 +146,6 @@ const DefaultConf = /**/ {
157
146
  import_name: 'dexie',
158
147
  import_name_build: '/dist/dexie/dexie.mjs',
159
148
  },
160
-
161
149
  { folder: './node_modules/peerjs/dist', public_folder: '/dist/peerjs' },
162
150
  ],
163
151
  services: ['default', 'core', 'user', 'test', 'file', 'document'],
@@ -201,40 +189,26 @@ const DefaultConf = /**/ {
201
189
  proxy: [80, 443],
202
190
  db: {
203
191
  provider: 'env:DB_PROVIDER:mongoose',
204
- host: 'env:DB_HOST:mongodb://mongodb-0.mongodb-service:27017',
192
+ host: 'env:DB_HOST:mongodb://127.0.0.1:27017',
205
193
  name: 'env:DB_NAME:default',
206
194
  replicaSet: 'env:DB_REPLICA_SET:rs0',
195
+ authSource: 'env:DB_AUTH_SOURCE:admin',
196
+ user: 'env:DB_USER:',
197
+ password: 'env:DB_PASSWORD:',
207
198
  },
208
199
  mailer: {
209
- sender: {
210
- email: 'env:MAILER_SENDER_EMAIL:noreply@default.net',
211
- name: 'env:MAILER_SENDER_NAME:Default',
212
- },
200
+ sender: { email: 'env:MAILER_SENDER_EMAIL:noreply@default.net', name: 'env:MAILER_SENDER_NAME:Default' },
213
201
  transport: {
214
202
  host: 'env:SMTP_HOST:smtp.default.com',
215
203
  port: 'env:SMTP_PORT:int:465',
216
204
  secure: 'env:SMTP_SECURE:bool:true',
217
- auth: {
218
- user: 'env:SMTP_AUTH_USER:',
219
- pass: 'env:SMTP_AUTH_PASS:',
220
- },
205
+ auth: { user: 'env:SMTP_AUTH_USER:', pass: 'env:SMTP_AUTH_PASS:' },
221
206
  },
222
207
  },
223
- valkey: {
224
- port: 'env:VALKEY_PORT:int:6379',
225
- host: 'env:VALKEY_HOST:127.0.0.1',
226
- },
227
- },
228
- },
229
- 'www.default.net': {
230
- '/': {
231
- client: null,
232
- runtime: 'nodejs',
233
- apis: [],
234
- origins: [],
235
- proxy: [80, 443],
208
+ valkey: { port: 'env:VALKEY_PORT:int:6379', host: 'env:VALKEY_HOST:127.0.0.1' },
236
209
  },
237
210
  },
211
+ 'www.default.net': { '/': { client: null, runtime: 'nodejs', apis: [], origins: [], proxy: [80, 443] } },
238
212
  },
239
213
  cron: {
240
214
  records: {
@@ -23,14 +23,14 @@ spec:
23
23
  spec:
24
24
  containers:
25
25
  - name: dd-cron-backup
26
- image: underpost/underpost-engine:v3.2.11
26
+ image: underpost/underpost-engine:v3.2.14
27
27
  command:
28
28
  - /bin/sh
29
29
  - -c
30
30
  - >
31
31
  cd /home/dd/engine &&
32
32
  node bin env dd-cron production &&
33
- node bin cron dd-lampp,dd-cyberia,dd-core,dd-test backup --git --kubeadm
33
+ node bin cron dd-lampp,dd-cyberia,dd-core,dd-prototype,dd-test backup --git --kubeadm
34
34
  volumeMounts:
35
35
  - mountPath: /home/dd/engine
36
36
  name: underpost-cron-container-volume
@@ -23,7 +23,7 @@ spec:
23
23
  spec:
24
24
  containers:
25
25
  - name: dd-cron-dns
26
- image: underpost/underpost-engine:v3.2.11
26
+ image: underpost/underpost-engine:v3.2.14
27
27
  command:
28
28
  - /bin/sh
29
29
  - -c
@@ -17,7 +17,7 @@ spec:
17
17
  spec:
18
18
  containers:
19
19
  - name: dd-default-development-blue
20
- image: underpost/underpost-engine:v3.2.11
20
+ image: underpost/underpost-engine:v3.2.14
21
21
  # resources:
22
22
  # requests:
23
23
  # memory: "124Ki"
@@ -98,7 +98,7 @@ spec:
98
98
  spec:
99
99
  containers:
100
100
  - name: dd-default-development-green
101
- image: underpost/underpost-engine:v3.2.11
101
+ image: underpost/underpost-engine:v3.2.14
102
102
  # resources:
103
103
  # requests:
104
104
  # memory: "124Ki"
package/package.json CHANGED
@@ -2,12 +2,13 @@
2
2
  "type": "module",
3
3
  "main": "src/index.js",
4
4
  "name": "underpost",
5
- "version": "3.2.11",
5
+ "version": "3.2.14",
6
6
  "description": "Underpost Platform — end-to-end CI/CD and application-delivery toolchain CLI. Covers bare metal, Kubernetes, K3s, kubeadm, LXD, container/image orchestration, secrets, databases, cron jobs, monitoring, SSH, runners, PWA + Workbox delivery, and release orchestration. Extensible via downstream CLIs.",
7
7
  "scripts": {
8
8
  "start": "node --max-old-space-size=8192 src/server",
9
9
  "build": "node bin client",
10
10
  "test": "NODE_ENV=test c8 mocha",
11
+ "test:monitor": "NODE_ENV=test c8 mocha test/deploy-monitor.test.js",
11
12
  "dev": "NODE_ENV=development nodemon src/server",
12
13
  "dev:container": "NODE_ENV=development node src/server",
13
14
  "prod:container": "NODE_ENV=production node src/server",
@@ -45,18 +46,12 @@
45
46
  "k3s",
46
47
  "kubeadm",
47
48
  "lxd",
48
- "bare-metal",
49
+ "baremetal",
49
50
  "container-orchestration",
50
51
  "image-management",
51
52
  "pwa",
52
53
  "workbox",
53
- "microservices",
54
- "template",
55
- "builder",
56
- "engine",
57
- "server",
58
- "proxy",
59
- "client"
54
+ "microservices"
60
55
  ],
61
56
  "author": "https://github.com/underpostnet",
62
57
  "license": "MIT",
@@ -78,12 +73,12 @@
78
73
  "clipboardy": "^5.3.1",
79
74
  "cloudinary": "^2.10.0",
80
75
  "colors": "^1.4.0",
81
- "commander": "^14.0.3",
76
+ "commander": "^15.0.0",
82
77
  "compression": "^1.7.4",
83
78
  "cookie-parser": "^1.4.7",
84
79
  "cors": "^2.8.6",
85
80
  "d3": "^7.9.0",
86
- "dexie": "^4.2.1",
81
+ "dexie": "^4.4.3",
87
82
  "dotenv": "^17.4.2",
88
83
  "easymde": "^2.21.0",
89
84
  "esbuild": "^0.28.0",
@@ -93,7 +88,7 @@
93
88
  "express-rate-limit": "^8.5.2",
94
89
  "express-slow-down": "^3.1.0",
95
90
  "fast-json-stable-stringify": "^2.1.0",
96
- "favicons": "^7.2.0",
91
+ "favicons": "^7.3.0",
97
92
  "fs-extra": "^11.3.5",
98
93
  "fullcalendar": "^6.1.15",
99
94
  "helmet": "^8.2.0",
@@ -106,9 +101,9 @@
106
101
  "mariadb": "^3.2.2",
107
102
  "mocha": "^11.7.6",
108
103
  "marked": "^18.0.4",
109
- "mongoose": "^9.6.2",
104
+ "mongoose": "^9.6.3",
110
105
  "morgan": "^1.10.0",
111
- "nodemailer": "^8.0.9",
106
+ "nodemailer": "^8.0.10",
112
107
  "nodemon": "^3.0.1",
113
108
  "peer": "^1.0.2",
114
109
  "peerjs": "^1.5.5",