@underpostnet/underpost 3.0.2 → 3.0.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/CHANGELOG.md +323 -290
- package/CLI-HELP.md +2 -1
- package/README.md +2 -2
- package/bin/build.js +0 -1
- package/manifests/cronjobs/dd-cron/dd-cron-backup.yaml +1 -1
- package/manifests/cronjobs/dd-cron/dd-cron-dns.yaml +1 -1
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
- package/manifests/deployment/dd-test-development/deployment.yaml +2 -2
- package/package.json +6 -2
- package/src/cli/index.js +6 -0
- package/src/cli/run.js +30 -2
- package/src/client/components/core/Modal.js +2 -0
- package/src/client/components/core/PublicProfile.js +3 -3
- package/src/client/components/core/Router.js +34 -1
- package/src/client/components/core/Worker.js +1 -1
- package/src/index.js +1 -1
package/CLI-HELP.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
## underpost ci/cd cli v3.0.
|
|
1
|
+
## underpost ci/cd cli v3.0.3
|
|
2
2
|
|
|
3
3
|
### Usage: `underpost [options] [command]`
|
|
4
4
|
```
|
|
@@ -899,6 +899,7 @@ Options:
|
|
|
899
899
|
--monitor-status-max-attempts <attempts> Sets the maximum number of status check attempts (default: 600).
|
|
900
900
|
--dry-run Preview operations without executing them.
|
|
901
901
|
--create-job-now After applying cron manifests, immediately create a Job from each CronJob (forwarded to cron runner).
|
|
902
|
+
--host-aliases <host-aliases> Adds entries to the Pod /etc/hosts via hostAliases. Format: semicolon-separated entries of "ip=hostname1,hostname2" (e.g., "127.0.0.1=foo.local,bar.local;10.1.2.3=foo.remote,bar.remote").
|
|
902
903
|
-h, --help display help for command
|
|
903
904
|
|
|
904
905
|
```
|
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
<div align="center">
|
|
18
18
|
|
|
19
|
-
[](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml) [](https://www.npmjs.com/package/underpost) [](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml) [](https://www.npmjs.com/package/underpost) [](https://socket.dev/npm/package/underpost/overview/3.0.3) [](https://coveralls.io/github/underpostnet/engine?branch=master) [](https://www.npmjs.org/package/underpost) [](https://www.npmjs.com/package/underpost)
|
|
20
20
|
|
|
21
21
|
</div>
|
|
22
22
|
|
|
@@ -60,7 +60,7 @@ npm run dev
|
|
|
60
60
|
|
|
61
61
|
<a target="_top" href="https://www.nexodev.org/docs?cid=src">See Docs here.</a>
|
|
62
62
|
|
|
63
|
-
## underpost ci/cd cli v3.0.
|
|
63
|
+
## underpost ci/cd cli v3.0.3
|
|
64
64
|
|
|
65
65
|
### Usage: `underpost [options] [command]`
|
|
66
66
|
```
|
package/bin/build.js
CHANGED
|
@@ -221,5 +221,4 @@ const { DefaultConf } = await import(`../conf.${confName}.js`);
|
|
|
221
221
|
fs.copySync(`./src/ws/${confName.split('-')[1]}`, `${basePath}/src/ws/${confName.split('-')[1]}`);
|
|
222
222
|
}
|
|
223
223
|
shellExec(`cd ${basePath} && npm install --ignore-scripts`);
|
|
224
|
-
shellExec(`cd ${basePath} && npm run fix`);
|
|
225
224
|
}
|
|
@@ -17,7 +17,7 @@ spec:
|
|
|
17
17
|
spec:
|
|
18
18
|
containers:
|
|
19
19
|
- name: dd-default-development-blue
|
|
20
|
-
image: localhost/rockylinux9-underpost:v3.0.
|
|
20
|
+
image: localhost/rockylinux9-underpost:v3.0.3
|
|
21
21
|
# resources:
|
|
22
22
|
# requests:
|
|
23
23
|
# memory: "124Ki"
|
|
@@ -100,7 +100,7 @@ spec:
|
|
|
100
100
|
spec:
|
|
101
101
|
containers:
|
|
102
102
|
- name: dd-default-development-green
|
|
103
|
-
image: localhost/rockylinux9-underpost:v3.0.
|
|
103
|
+
image: localhost/rockylinux9-underpost:v3.0.3
|
|
104
104
|
# resources:
|
|
105
105
|
# requests:
|
|
106
106
|
# memory: "124Ki"
|
|
@@ -18,7 +18,7 @@ spec:
|
|
|
18
18
|
spec:
|
|
19
19
|
containers:
|
|
20
20
|
- name: dd-test-development-blue
|
|
21
|
-
image: localhost/rockylinux9-underpost:v3.0.
|
|
21
|
+
image: localhost/rockylinux9-underpost:v3.0.3
|
|
22
22
|
|
|
23
23
|
command:
|
|
24
24
|
- /bin/sh
|
|
@@ -103,7 +103,7 @@ spec:
|
|
|
103
103
|
spec:
|
|
104
104
|
containers:
|
|
105
105
|
- name: dd-test-development-green
|
|
106
|
-
image: localhost/rockylinux9-underpost:v3.0.
|
|
106
|
+
image: localhost/rockylinux9-underpost:v3.0.3
|
|
107
107
|
|
|
108
108
|
command:
|
|
109
109
|
- /bin/sh
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"type": "module",
|
|
3
3
|
"main": "src/index.js",
|
|
4
4
|
"name": "@underpostnet/underpost",
|
|
5
|
-
"version": "3.0.
|
|
5
|
+
"version": "3.0.3",
|
|
6
6
|
"description": "pwa api rest template",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"start": "env-cmd -f .env.production node --max-old-space-size=8192 src/server",
|
|
@@ -111,6 +111,10 @@
|
|
|
111
111
|
},
|
|
112
112
|
"overrides": {
|
|
113
113
|
"minimatch": "^10.2.2",
|
|
114
|
-
"glob": "^11.0.0"
|
|
114
|
+
"glob": "^11.0.0",
|
|
115
|
+
"diff": ">=8.0.3",
|
|
116
|
+
"js-yaml": ">=3.14.2",
|
|
117
|
+
"debug": ">=4.3.6",
|
|
118
|
+
"serialize-javascript": ">=7.0.3"
|
|
115
119
|
}
|
|
116
120
|
}
|
package/src/cli/index.js
CHANGED
|
@@ -612,6 +612,12 @@ program
|
|
|
612
612
|
'--create-job-now',
|
|
613
613
|
'After applying cron manifests, immediately create a Job from each CronJob (forwarded to cron runner).',
|
|
614
614
|
)
|
|
615
|
+
.option(
|
|
616
|
+
'--host-aliases <host-aliases>',
|
|
617
|
+
'Adds entries to the Pod /etc/hosts via hostAliases. ' +
|
|
618
|
+
'Format: semicolon-separated entries of "ip=hostname1,hostname2" ' +
|
|
619
|
+
'(e.g., "127.0.0.1=foo.local,bar.local;10.1.2.3=foo.remote,bar.remote").',
|
|
620
|
+
)
|
|
615
621
|
.description('Runs specified scripts using various runners.')
|
|
616
622
|
.action(Underpost.run.callback);
|
|
617
623
|
|
package/src/cli/run.js
CHANGED
|
@@ -32,7 +32,6 @@ const logger = loggerFactory(import.meta);
|
|
|
32
32
|
* @property {string} podName - The name of the pod to run.
|
|
33
33
|
* @property {string} nodeName - The name of the node to run.
|
|
34
34
|
* @property {number} port - Custom port to use.
|
|
35
|
-
* @property {boolean} etcHosts - Whether to modify /etc/hosts.
|
|
36
35
|
* @property {string} volumeHostPath - The host path for the volume.
|
|
37
36
|
* @property {string} volumeMountPath - The mount path for the volume.
|
|
38
37
|
* @property {string} imageName - The name of the image to run.
|
|
@@ -85,9 +84,12 @@ const logger = loggerFactory(import.meta);
|
|
|
85
84
|
* @property {string} monitorStatusKindType - The monitor status kind type option.
|
|
86
85
|
* @property {string} monitorStatusDeltaMs - The monitor status delta in milliseconds.
|
|
87
86
|
* @property {string} monitorStatusMaxAttempts - The maximum number of attempts for monitor status.
|
|
87
|
+
* @property {boolean} logs - Whether to enable logs.
|
|
88
88
|
* @property {boolean} dryRun - Whether to perform a dry run.
|
|
89
89
|
* @property {boolean} createJobNow - Whether to create the job immediately.
|
|
90
|
-
* @property {
|
|
90
|
+
* @property {string|Array<{ip: string, hostnames: string[]}>} hostAliases - Adds entries to the Pod /etc/hosts via Kubernetes hostAliases.
|
|
91
|
+
* As a string (CLI): semicolon-separated entries of "ip=hostname1,hostname2" (e.g., "127.0.0.1=foo.local,bar.local;10.1.2.3=foo.remote").
|
|
92
|
+
* As an array (programmatic): objects with `ip` and `hostnames` fields (e.g., [{ ip: "127.0.0.1", hostnames: ["foo.local"] }]).
|
|
91
93
|
* @memberof UnderpostRun
|
|
92
94
|
*/
|
|
93
95
|
const DEFAULT_OPTION = {
|
|
@@ -150,6 +152,7 @@ const DEFAULT_OPTION = {
|
|
|
150
152
|
logs: false,
|
|
151
153
|
dryRun: false,
|
|
152
154
|
createJobNow: false,
|
|
155
|
+
hostAliases: '',
|
|
153
156
|
};
|
|
154
157
|
|
|
155
158
|
/**
|
|
@@ -1840,6 +1843,30 @@ EOF
|
|
|
1840
1843
|
const imagePullPolicy = options.imagePullPolicy || 'IfNotPresent';
|
|
1841
1844
|
const hostNetwork = options.hostNetwork ? options.hostNetwork : '';
|
|
1842
1845
|
const apiVersion = options.apiVersion || 'v1';
|
|
1846
|
+
// Parse hostAliases option:
|
|
1847
|
+
// - string from CLI: "ip1=host1,host2;ip2=host3,host4"
|
|
1848
|
+
// - array from programmatic callers: [{ ip: "127.0.0.1", hostnames: ["foo.local"] }]
|
|
1849
|
+
const hostAliases = options.hostAliases
|
|
1850
|
+
? Array.isArray(options.hostAliases)
|
|
1851
|
+
? options.hostAliases
|
|
1852
|
+
: options.hostAliases
|
|
1853
|
+
.split(';')
|
|
1854
|
+
.filter((entry) => entry.trim())
|
|
1855
|
+
.map((entry) => {
|
|
1856
|
+
const [ip, hostnamesStr] = entry.split('=');
|
|
1857
|
+
const hostnames = hostnamesStr ? hostnamesStr.split(',').map((h) => h.trim()) : [];
|
|
1858
|
+
return { ip: ip.trim(), hostnames };
|
|
1859
|
+
})
|
|
1860
|
+
: [];
|
|
1861
|
+
const hostAliasesYaml =
|
|
1862
|
+
hostAliases.length > 0
|
|
1863
|
+
? ` hostAliases:\n${hostAliases
|
|
1864
|
+
.map(
|
|
1865
|
+
(alias) =>
|
|
1866
|
+
` - ip: "${alias.ip}"\n hostnames:\n${alias.hostnames.map((h) => ` - "${h}"`).join('\n')}`,
|
|
1867
|
+
)
|
|
1868
|
+
.join('\n')}`
|
|
1869
|
+
: '';
|
|
1843
1870
|
const labels = options.labels
|
|
1844
1871
|
? options.labels
|
|
1845
1872
|
.split(',')
|
|
@@ -1870,6 +1897,7 @@ spec:
|
|
|
1870
1897
|
restartPolicy: ${restartPolicy}
|
|
1871
1898
|
${runtimeClassName ? ` runtimeClassName: ${runtimeClassName}` : ''}
|
|
1872
1899
|
${hostNetwork ? ` hostNetwork: ${hostNetwork}` : ''}
|
|
1900
|
+
${hostAliasesYaml}
|
|
1873
1901
|
containers:
|
|
1874
1902
|
- name: ${containerName}
|
|
1875
1903
|
image: ${imageName}
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
coreUI,
|
|
24
24
|
sanitizeRoute,
|
|
25
25
|
getQueryParams,
|
|
26
|
+
setRouterReady,
|
|
26
27
|
} from './Router.js';
|
|
27
28
|
import { NotificationManager } from './NotificationManager.js';
|
|
28
29
|
import { EventsUI } from './EventsUI.js';
|
|
@@ -1401,6 +1402,7 @@ const Modal = {
|
|
|
1401
1402
|
}
|
|
1402
1403
|
});
|
|
1403
1404
|
setTimeout(window.onresize);
|
|
1405
|
+
setRouterReady();
|
|
1404
1406
|
});
|
|
1405
1407
|
})();
|
|
1406
1408
|
break;
|
|
@@ -196,7 +196,7 @@ const PublicProfile = {
|
|
|
196
196
|
user: { _id: userId, username },
|
|
197
197
|
} = options;
|
|
198
198
|
const idModal = options.idModal || getId();
|
|
199
|
-
const profileId = `public-profile-${
|
|
199
|
+
const profileId = `public-profile-${username}`;
|
|
200
200
|
const waveAnimationId = `${profileId}-wave`;
|
|
201
201
|
const profileImageClass = `${profileId}-image`;
|
|
202
202
|
const profileContainerId = `${profileId}-container`;
|
|
@@ -673,7 +673,7 @@ const PublicProfile = {
|
|
|
673
673
|
"
|
|
674
674
|
>
|
|
675
675
|
<div
|
|
676
|
-
class="${profileId}-image-container"
|
|
676
|
+
class="${profileId}-image-container public-profile-image-container"
|
|
677
677
|
style="
|
|
678
678
|
position: relative;
|
|
679
679
|
width: 160px;
|
|
@@ -688,7 +688,7 @@ const PublicProfile = {
|
|
|
688
688
|
"
|
|
689
689
|
>
|
|
690
690
|
<img
|
|
691
|
-
class="${profileImageClass}"
|
|
691
|
+
class="${profileImageClass} public-profile-image"
|
|
692
692
|
style="
|
|
693
693
|
width: 100%;
|
|
694
694
|
height: 100%;
|
|
@@ -39,6 +39,36 @@ const coreUI = ['modal-menu', 'main-body', 'main-body-top', 'bottom-bar', 'board
|
|
|
39
39
|
*/
|
|
40
40
|
const closeModalRouteChangeEvents = {};
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Deferred promise that resolves once the full UI (including deferred slide-menu DOM
|
|
44
|
+
* setup in Modal) is ready. Any code that depends on the complete DOM — route handlers,
|
|
45
|
+
* session callbacks, panel updates, etc. — can simply `await RouterReady` instead of
|
|
46
|
+
* scattering individual null-checks across every microfrontend.
|
|
47
|
+
*
|
|
48
|
+
* Resolved by calling `setRouterReady()`, which should happen exactly once at the end
|
|
49
|
+
* of Modal's deferred slide-menu `setTimeout` block.
|
|
50
|
+
* @type {Promise<void>}
|
|
51
|
+
* @memberof PwaRouter
|
|
52
|
+
*/
|
|
53
|
+
let _routerReadyResolve;
|
|
54
|
+
const RouterReady = new Promise((resolve) => {
|
|
55
|
+
_routerReadyResolve = resolve;
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Signals that the deferred UI setup is complete and the router (and any other
|
|
60
|
+
* awaiter of `RouterReady`) may safely access the full DOM.
|
|
61
|
+
* This must be called exactly once – typically at the end of Modal's deferred
|
|
62
|
+
* slide-menu `setTimeout` block.
|
|
63
|
+
* @memberof PwaRouter
|
|
64
|
+
*/
|
|
65
|
+
const setRouterReady = () => {
|
|
66
|
+
if (_routerReadyResolve) {
|
|
67
|
+
_routerReadyResolve();
|
|
68
|
+
_routerReadyResolve = undefined;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
42
72
|
/**
|
|
43
73
|
* Determines the base path for the application, often used for routing within a sub-directory.
|
|
44
74
|
* It checks the current URL's pathname and `window.Routes` to return the appropriate proxy path.
|
|
@@ -209,7 +239,8 @@ const Router = function (options = { Routes: () => {}, e: new PopStateEvent() })
|
|
|
209
239
|
* @param {object} RouterInstance - The router instance configuration, including the `Routes` function.
|
|
210
240
|
* @memberof PwaRouter
|
|
211
241
|
*/
|
|
212
|
-
const LoadRouter = function (RouterInstance) {
|
|
242
|
+
const LoadRouter = async function (RouterInstance) {
|
|
243
|
+
await RouterReady;
|
|
213
244
|
Router(RouterInstance);
|
|
214
245
|
window.onpopstate = (e) => {
|
|
215
246
|
Router({ ...RouterInstance, e });
|
|
@@ -466,4 +497,6 @@ export {
|
|
|
466
497
|
sanitizeRoute,
|
|
467
498
|
queryParamsChangeListeners,
|
|
468
499
|
listenQueryParamsChange,
|
|
500
|
+
setRouterReady,
|
|
501
|
+
RouterReady,
|
|
469
502
|
};
|
|
@@ -135,7 +135,7 @@ class PwaWorker {
|
|
|
135
135
|
const isInstall = await this.status();
|
|
136
136
|
if (!isInstall) await this.install();
|
|
137
137
|
await render();
|
|
138
|
-
LoadRouter(this.RouterInstance);
|
|
138
|
+
await LoadRouter(this.RouterInstance);
|
|
139
139
|
LoadingAnimation.removeSplashScreen();
|
|
140
140
|
if (this.devMode()) {
|
|
141
141
|
// const delayLiveReload = 1250;
|