cyberia 3.0.2 → 3.1.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/{.env.production → .env.example} +20 -2
- package/.github/workflows/engine-cyberia.cd.yml +41 -10
- package/.github/workflows/engine-cyberia.ci.yml +53 -14
- package/.github/workflows/ghpkg.ci.yml +1 -1
- package/.github/workflows/gitlab.ci.yml +1 -1
- package/.github/workflows/hardhat.ci.yml +82 -0
- package/.github/workflows/npmpkg.ci.yml +37 -8
- package/.github/workflows/publish.ci.yml +5 -5
- package/.github/workflows/publish.cyberia.ci.yml +5 -5
- package/.github/workflows/pwa-microservices-template-page.cd.yml +3 -3
- package/.github/workflows/pwa-microservices-template-test.ci.yml +1 -1
- package/.github/workflows/release.cd.yml +3 -2
- package/.vscode/extensions.json +9 -8
- package/.vscode/settings.json +3 -2
- package/CHANGELOG.md +533 -290
- package/CLI-HELP.md +79 -53
- package/WHITE-PAPER.md +1540 -0
- package/bin/build.js +16 -11
- package/bin/cyberia.js +959 -8
- package/bin/deploy.js +103 -270
- package/bin/file.js +2 -1
- package/bin/index.js +959 -8
- package/bin/vs.js +3 -3
- package/conf.js +277 -77
- package/deployment.yaml +218 -4
- package/hardhat/.env.example +31 -0
- package/hardhat/README.md +531 -0
- package/hardhat/WHITE-PAPER.md +1540 -0
- package/hardhat/contracts/ObjectLayerToken.sol +391 -0
- package/hardhat/deployments/.gitkeep +0 -0
- package/hardhat/deployments/hardhat-ObjectLayerToken.json +11 -0
- package/hardhat/hardhat.config.js +136 -0
- package/hardhat/ignition/modules/ObjectLayerToken.js +21 -0
- package/hardhat/networks/besu-object-layer.network.json +138 -0
- package/hardhat/package-lock.json +7628 -0
- package/hardhat/package.json +45 -0
- package/hardhat/scripts/deployObjectLayerToken.js +98 -0
- package/hardhat/test/ObjectLayerToken.js +590 -0
- package/jsdoc.dd-cyberia.json +59 -0
- package/jsdoc.json +20 -13
- 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-cyberia-development/deployment.yaml +490 -0
- package/manifests/deployment/dd-cyberia-development/proxy.yaml +261 -0
- package/manifests/deployment/dd-cyberia-development/pv-pvc.yaml +132 -0
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
- package/manifests/deployment/dd-test-development/deployment.yaml +52 -52
- package/manifests/deployment/dd-test-development/proxy.yaml +4 -4
- package/manifests/pv-pvc-dd.yaml +1 -1
- package/package.json +60 -50
- package/proxy.yaml +128 -9
- package/pv-pvc.yaml +132 -0
- package/scripts/k3s-node-setup.sh +1 -1
- package/scripts/ports-ls.sh +2 -0
- package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.controller.js +3 -1
- package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.model.js +1 -2
- package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.service.js +40 -7
- package/src/api/document/document.service.js +1 -1
- package/src/api/file/file.controller.js +3 -1
- package/src/api/file/file.service.js +28 -5
- package/src/api/ipfs/ipfs.service.js +2 -2
- package/src/api/object-layer/object-layer.controller.js +6 -2
- package/src/api/object-layer/object-layer.model.js +67 -21
- package/src/api/object-layer/object-layer.router.js +668 -42
- package/src/api/object-layer/object-layer.service.js +10 -16
- package/src/api/object-layer-render-frames/object-layer-render-frames.model.js +1 -2
- package/src/api/user/user.router.js +10 -5
- package/src/api/user/user.service.js +7 -7
- package/src/cli/baremetal.js +6 -10
- package/src/cli/cloud-init.js +0 -3
- package/src/cli/db.js +54 -71
- package/src/cli/deploy.js +64 -12
- package/src/cli/env.js +5 -5
- package/src/cli/fs.js +0 -2
- package/src/cli/image.js +0 -3
- package/src/cli/index.js +41 -13
- package/src/cli/monitor.js +5 -6
- package/src/cli/repository.js +329 -46
- package/src/cli/run.js +210 -122
- package/src/cli/secrets.js +1 -3
- package/src/cli/ssh.js +1 -1
- package/src/client/Itemledger.index.js +1 -959
- package/src/client/Underpost.index.js +36 -0
- package/src/client/components/core/AgGrid.js +20 -5
- package/src/client/components/core/Alert.js +2 -2
- package/src/client/components/core/Content.js +22 -3
- package/src/client/components/core/Docs.js +30 -6
- package/src/client/components/core/FileExplorer.js +71 -4
- package/src/client/components/core/Input.js +1 -1
- package/src/client/components/core/Modal.js +22 -6
- package/src/client/components/core/PublicProfile.js +3 -3
- package/src/client/components/core/RichText.js +1 -2
- package/src/client/components/core/Router.js +34 -1
- package/src/client/components/core/Worker.js +1 -1
- package/src/client/components/cryptokoyn/CssCryptokoyn.js +63 -1
- package/src/client/components/cyberia/ObjectLayerEngineModal.js +145 -119
- package/src/client/components/cyberia/ObjectLayerEngineViewer.js +64 -6
- package/src/client/components/cyberia-portal/CommonCyberiaPortal.js +1 -0
- package/src/client/components/cyberia-portal/CssCyberiaPortal.js +44 -2
- package/src/client/components/cyberia-portal/LogInCyberiaPortal.js +0 -1
- package/src/client/components/cyberia-portal/MenuCyberiaPortal.js +64 -2
- package/src/client/components/cyberia-portal/RoutesCyberiaPortal.js +1 -0
- package/src/client/components/itemledger/CssItemledger.js +62 -0
- package/src/client/components/underpost/CommonUnderpost.js +29 -0
- package/src/client/components/underpost/CssUnderpost.js +281 -0
- package/src/client/components/underpost/CyberpunkBloggerUnderpost.js +879 -0
- package/src/client/components/underpost/DocumentSearchProvider.js +448 -0
- package/src/client/components/underpost/ElementsUnderpost.js +38 -0
- package/src/client/components/underpost/LabGalleryUnderpost.js +82 -0
- package/src/client/components/underpost/LogInUnderpost.js +23 -0
- package/src/client/components/underpost/LogOutUnderpost.js +15 -0
- package/src/client/components/underpost/MenuUnderpost.js +691 -0
- package/src/client/components/underpost/RoutesUnderpost.js +47 -0
- package/src/client/components/underpost/SettingsUnderpost.js +16 -0
- package/src/client/components/underpost/SignUpUnderpost.js +9 -0
- package/src/client/components/underpost/SocketIoUnderpost.js +54 -0
- package/src/client/components/underpost/TranslateUnderpost.js +10 -0
- package/src/client/public/cryptokoyn/assets/logo/base-icon.png +0 -0
- package/src/client/public/cryptokoyn/browserconfig.xml +12 -0
- package/src/client/public/cryptokoyn/microdata.json +85 -0
- package/src/client/public/cryptokoyn/site.webmanifest +57 -0
- package/src/client/public/cryptokoyn/sitemap +3 -3
- package/src/client/public/default/sitemap +3 -3
- package/src/client/public/itemledger/browserconfig.xml +2 -2
- package/src/client/public/itemledger/manifest.webmanifest +4 -4
- package/src/client/public/itemledger/microdata.json +71 -0
- package/src/client/public/itemledger/sitemap +3 -3
- package/src/client/public/itemledger/yandex-browser-manifest.json +2 -2
- package/src/client/public/test/sitemap +3 -3
- package/src/client/services/object-layer/object-layer.management.js +23 -4
- package/src/client/ssr/body/404.js +15 -11
- package/src/client/ssr/body/500.js +15 -11
- package/src/client/ssr/body/SwaggerDarkMode.js +285 -0
- package/src/client/ssr/body/UnderpostDefaultSplashScreen.js +83 -0
- package/src/client/ssr/head/PwaItemledger.js +60 -0
- package/src/client/ssr/head/UnderpostScripts.js +6 -0
- package/src/client/ssr/offline/NoNetworkConnection.js +11 -10
- package/src/client/ssr/pages/Test.js +11 -10
- package/src/client.build.js +0 -3
- package/src/client.dev.js +0 -3
- package/src/db/DataBaseProvider.js +17 -2
- package/src/db/mariadb/MariaDB.js +14 -9
- package/src/db/mongo/MongooseDB.js +17 -1
- package/src/index.js +1 -1
- package/src/proxy.js +0 -3
- package/src/runtime/express/Express.js +15 -9
- package/src/runtime/lampp/Lampp.js +6 -13
- package/src/server/auth.js +12 -14
- package/src/server/backup.js +2 -3
- package/src/server/besu-genesis-generator.js +1630 -0
- package/src/server/client-build-docs.js +126 -17
- package/src/server/client-build-live.js +9 -18
- package/src/server/client-build.js +203 -75
- package/src/server/client-dev-server.js +14 -13
- package/src/server/conf.js +376 -164
- package/src/server/cron.js +2 -1
- package/src/server/dns.js +28 -12
- package/src/server/downloader.js +0 -2
- package/src/server/logger.js +27 -9
- package/src/server/object-layer.js +92 -16
- package/src/server/peer.js +0 -2
- package/src/server/process.js +1 -50
- package/src/server/proxy.js +4 -8
- package/src/server/runtime.js +5 -8
- package/src/server/semantic-layer-generator.js +1 -0
- package/src/server/ssr.js +0 -3
- package/src/server/start.js +19 -12
- package/src/server/tls.js +0 -2
- package/src/server.js +0 -4
- package/.env.development +0 -43
- package/.env.test +0 -43
- package/hardhat/contracts/CryptoKoyn.sol +0 -59
- package/hardhat/contracts/ItemLedger.sol +0 -73
- package/hardhat/contracts/Lock.sol +0 -34
- package/hardhat/hardhat.config.cjs +0 -45
- package/hardhat/ignition/modules/Lock.js +0 -18
- package/hardhat/networks/cryptokoyn-itemledger.network.json +0 -29
- package/hardhat/scripts/deployCryptokoyn.cjs +0 -25
- package/hardhat/scripts/deployItemledger.cjs +0 -25
- package/hardhat/test/Lock.js +0 -126
- package/hardhat/white-paper.md +0 -581
- package/white-paper.md +0 -581
|
@@ -15,9 +15,9 @@ import {
|
|
|
15
15
|
orderArrayFromAttrInt,
|
|
16
16
|
uniqueArray,
|
|
17
17
|
} from '../client/components/core/CommonJs.js';
|
|
18
|
+
import { readConfJson } from './conf.js';
|
|
18
19
|
import UglifyJS from 'uglify-js';
|
|
19
20
|
import { minify } from 'html-minifier-terser';
|
|
20
|
-
import dotenv from 'dotenv';
|
|
21
21
|
import AdmZip from 'adm-zip';
|
|
22
22
|
import * as dir from 'path';
|
|
23
23
|
import { shellExec } from './process.js';
|
|
@@ -28,8 +28,6 @@ import Underpost from '../index.js';
|
|
|
28
28
|
import { buildDocs } from './client-build-docs.js';
|
|
29
29
|
import { ssrFactory } from './ssr.js';
|
|
30
30
|
|
|
31
|
-
dotenv.config();
|
|
32
|
-
|
|
33
31
|
// Static Site Generation (SSG)
|
|
34
32
|
|
|
35
33
|
/**
|
|
@@ -77,23 +75,186 @@ const copyNonExistingFiles = (src, dest) => {
|
|
|
77
75
|
}
|
|
78
76
|
};
|
|
79
77
|
|
|
78
|
+
/** @type {string} Default XSL sitemap template used when no `sitemap` source file exists in the public directory. */
|
|
79
|
+
const defaultSitemapXsl = `<?xml version="1.0" encoding="UTF-8"?>
|
|
80
|
+
<xsl:stylesheet version="1.0"
|
|
81
|
+
xmlns:html="http://www.w3.org/TR/REC-html40"
|
|
82
|
+
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
|
|
83
|
+
xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
|
|
84
|
+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
85
|
+
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes" />
|
|
86
|
+
<xsl:template match="/">
|
|
87
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
88
|
+
<head>
|
|
89
|
+
<title>XML Sitemap</title>
|
|
90
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
91
|
+
<style type="text/css">
|
|
92
|
+
body {
|
|
93
|
+
font-family: sans-serif;
|
|
94
|
+
font-size: 16px;
|
|
95
|
+
color: #242628;
|
|
96
|
+
}
|
|
97
|
+
a {
|
|
98
|
+
color: #000;
|
|
99
|
+
text-decoration: none;
|
|
100
|
+
}
|
|
101
|
+
a:hover {
|
|
102
|
+
text-decoration: underline;
|
|
103
|
+
}
|
|
104
|
+
table {
|
|
105
|
+
border: none;
|
|
106
|
+
border-collapse: collapse;
|
|
107
|
+
width: 100%
|
|
108
|
+
}
|
|
109
|
+
th {
|
|
110
|
+
text-align: left;
|
|
111
|
+
padding-right: 30px;
|
|
112
|
+
font-size: 11px;
|
|
113
|
+
}
|
|
114
|
+
thead th {
|
|
115
|
+
border-bottom: 1px solid #7d878a;
|
|
116
|
+
cursor: pointer;
|
|
117
|
+
}
|
|
118
|
+
td {
|
|
119
|
+
font-size:11px;
|
|
120
|
+
padding: 5px;
|
|
121
|
+
}
|
|
122
|
+
tr:nth-child(odd) td {
|
|
123
|
+
background-color: rgba(0,0,0,0.04);
|
|
124
|
+
}
|
|
125
|
+
tr:hover td {
|
|
126
|
+
background-color: #e2edf2;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
#content {
|
|
130
|
+
margin: 0 auto;
|
|
131
|
+
padding: 2% 5%;
|
|
132
|
+
max-width: 800px;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.desc {
|
|
136
|
+
margin: 18px 3px;
|
|
137
|
+
line-height: 1.2em;
|
|
138
|
+
}
|
|
139
|
+
.desc a {
|
|
140
|
+
color: #5ba4e5;
|
|
141
|
+
}
|
|
142
|
+
</style>
|
|
143
|
+
</head>
|
|
144
|
+
<body>
|
|
145
|
+
<div id="content">
|
|
146
|
+
<h1>XML Sitemap</h1>
|
|
147
|
+
<p class="desc"> This is a sitemap generated by <a
|
|
148
|
+
href="{{web-url}}">{{web-url}}</a>
|
|
149
|
+
</p>
|
|
150
|
+
<xsl:if test="count(sitemap:sitemapindex/sitemap:sitemap) > 0">
|
|
151
|
+
<table id="sitemap" cellpadding="3">
|
|
152
|
+
<thead>
|
|
153
|
+
<tr>
|
|
154
|
+
<th width="75%">Sitemap</th>
|
|
155
|
+
<th width="25%">Last Modified</th>
|
|
156
|
+
</tr>
|
|
157
|
+
</thead>
|
|
158
|
+
<tbody>
|
|
159
|
+
<xsl:for-each select="sitemap:sitemapindex/sitemap:sitemap">
|
|
160
|
+
<xsl:variable name="sitemapURL">
|
|
161
|
+
<xsl:value-of select="sitemap:loc" />
|
|
162
|
+
</xsl:variable>
|
|
163
|
+
<tr>
|
|
164
|
+
<td>
|
|
165
|
+
<a href="{$sitemapURL}">
|
|
166
|
+
<xsl:value-of select="sitemap:loc" />
|
|
167
|
+
</a>
|
|
168
|
+
</td>
|
|
169
|
+
<td>
|
|
170
|
+
<xsl:value-of
|
|
171
|
+
select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)))" />
|
|
172
|
+
</td>
|
|
173
|
+
</tr>
|
|
174
|
+
</xsl:for-each>
|
|
175
|
+
</tbody>
|
|
176
|
+
</table>
|
|
177
|
+
</xsl:if>
|
|
178
|
+
<xsl:if test="count(sitemap:sitemapindex/sitemap:sitemap) < 1">
|
|
179
|
+
<p class="desc">
|
|
180
|
+
<a href="{{web-url}}sitemap.xml" class="back-link">← Back to index</a>
|
|
181
|
+
</p>
|
|
182
|
+
<table
|
|
183
|
+
id="sitemap" cellpadding="3">
|
|
184
|
+
<thead>
|
|
185
|
+
<tr>
|
|
186
|
+
<th width="70%">URL (<xsl:value-of
|
|
187
|
+
select="count(sitemap:urlset/sitemap:url)" /> total)</th>
|
|
188
|
+
<th width="15%">Images</th>
|
|
189
|
+
<th title="Last Modification Time" width="15%">Last Modified</th>
|
|
190
|
+
</tr>
|
|
191
|
+
</thead>
|
|
192
|
+
<tbody>
|
|
193
|
+
<xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'" />
|
|
194
|
+
<xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
|
|
195
|
+
<xsl:for-each select="sitemap:urlset/sitemap:url">
|
|
196
|
+
<tr>
|
|
197
|
+
<td>
|
|
198
|
+
<xsl:variable name="itemURL">
|
|
199
|
+
<xsl:value-of select="sitemap:loc" />
|
|
200
|
+
</xsl:variable>
|
|
201
|
+
<a href="{$itemURL}">
|
|
202
|
+
<xsl:value-of select="sitemap:loc" />
|
|
203
|
+
</a>
|
|
204
|
+
</td>
|
|
205
|
+
<td>
|
|
206
|
+
<xsl:value-of select="count(image:image)" />
|
|
207
|
+
</td>
|
|
208
|
+
<td>
|
|
209
|
+
<xsl:value-of
|
|
210
|
+
select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)))" />
|
|
211
|
+
</td>
|
|
212
|
+
</tr>
|
|
213
|
+
</xsl:for-each>
|
|
214
|
+
</tbody>
|
|
215
|
+
</table>
|
|
216
|
+
<p
|
|
217
|
+
class="desc">
|
|
218
|
+
<a href="{{web-url}}sitemap.xml" class="back-link">← Back to index</a>
|
|
219
|
+
</p>
|
|
220
|
+
</xsl:if>
|
|
221
|
+
</div>
|
|
222
|
+
</body>
|
|
223
|
+
</html>
|
|
224
|
+
|
|
225
|
+
</xsl:template>
|
|
226
|
+
</xsl:stylesheet>`;
|
|
227
|
+
|
|
80
228
|
/**
|
|
81
229
|
* @async
|
|
82
230
|
* @function buildClient
|
|
83
231
|
* @memberof clientBuild
|
|
84
232
|
* @param {Object} options - Options for the build process.
|
|
233
|
+
* @param {string} options.deployId - The deployment ID for which to build the client.
|
|
85
234
|
* @param {Array} options.liveClientBuildPaths - List of paths to build incrementally.
|
|
86
235
|
* @param {Array} options.instances - List of instances to build.
|
|
87
236
|
* @param {boolean} options.buildZip - Whether to create zip files of the builds.
|
|
237
|
+
* @param {boolean} options.fullBuild - Whether to perform a full build.
|
|
238
|
+
* @param {boolean} options.iconsBuild - Whether to build icons.
|
|
88
239
|
* @returns {Promise<void>} - Promise that resolves when the build is complete.
|
|
89
240
|
* @throws {Error} - If the build fails.
|
|
90
241
|
* @memberof clientBuild
|
|
91
242
|
*/
|
|
92
|
-
const buildClient = async (
|
|
243
|
+
const buildClient = async (
|
|
244
|
+
options = {
|
|
245
|
+
deployId: '',
|
|
246
|
+
liveClientBuildPaths: [],
|
|
247
|
+
instances: [],
|
|
248
|
+
buildZip: false,
|
|
249
|
+
fullBuild: false,
|
|
250
|
+
iconsBuild: false,
|
|
251
|
+
},
|
|
252
|
+
) => {
|
|
93
253
|
const logger = loggerFactory(import.meta);
|
|
94
|
-
const
|
|
95
|
-
const
|
|
96
|
-
const
|
|
254
|
+
const deployId = options.deployId || process.env.DEPLOY_ID;
|
|
255
|
+
const confClient = readConfJson(deployId, 'client');
|
|
256
|
+
const confServer = readConfJson(deployId, 'server', { loadReplicas: true });
|
|
257
|
+
const confSSR = readConfJson(deployId, 'ssr');
|
|
97
258
|
const packageData = JSON.parse(fs.readFileSync(`./package.json`, 'utf8'));
|
|
98
259
|
const acmeChallengePath = `/.well-known/acme-challenge`;
|
|
99
260
|
const publicPath = `./public`;
|
|
@@ -178,26 +339,7 @@ const buildClient = async (options = { liveClientBuildPaths: [], instances: [],
|
|
|
178
339
|
} */,
|
|
179
340
|
);
|
|
180
341
|
} else if (fs.existsSync(`./engine-private/src/client/public/${publicClientId}`)) {
|
|
181
|
-
|
|
182
|
-
case 'mysql_test':
|
|
183
|
-
if (db) {
|
|
184
|
-
fs.copySync(`./engine-private/src/client/public/${publicClientId}`, rootClientPath);
|
|
185
|
-
fs.writeFileSync(
|
|
186
|
-
`${rootClientPath}/index.php`,
|
|
187
|
-
fs
|
|
188
|
-
.readFileSync(`${rootClientPath}/index.php`, 'utf8')
|
|
189
|
-
.replace('test_servername', 'localhost')
|
|
190
|
-
.replace('test_username', db.user)
|
|
191
|
-
.replace('test_password', db.password)
|
|
192
|
-
.replace('test_dbname', db.name),
|
|
193
|
-
'utf8',
|
|
194
|
-
);
|
|
195
|
-
} else logger.error('not provided db config');
|
|
196
|
-
break;
|
|
197
|
-
|
|
198
|
-
default:
|
|
199
|
-
break;
|
|
200
|
-
}
|
|
342
|
+
fs.copySync(`./engine-private/src/client/public/${publicClientId}`, rootClientPath);
|
|
201
343
|
}
|
|
202
344
|
if (dists)
|
|
203
345
|
for (const dist of dists) {
|
|
@@ -243,17 +385,14 @@ const buildClient = async (options = { liveClientBuildPaths: [], instances: [],
|
|
|
243
385
|
client,
|
|
244
386
|
directory,
|
|
245
387
|
disabledRebuild,
|
|
246
|
-
minifyBuild,
|
|
247
388
|
db,
|
|
248
389
|
redirect,
|
|
249
390
|
apis,
|
|
250
|
-
iconsBuild,
|
|
251
|
-
docsBuild,
|
|
252
391
|
apiBaseProxyPath,
|
|
253
392
|
apiBaseHost,
|
|
254
393
|
ttiLoadTimeLimit,
|
|
255
394
|
singleReplica,
|
|
256
|
-
|
|
395
|
+
docs,
|
|
257
396
|
} = confServer[host][path];
|
|
258
397
|
if (singleReplica) continue;
|
|
259
398
|
if (!confClient[client]) confClient[client] = {};
|
|
@@ -267,9 +406,10 @@ const buildClient = async (options = { liveClientBuildPaths: [], instances: [],
|
|
|
267
406
|
const rootClientPath = directory ? directory : `${publicPath}/${host}${path}`;
|
|
268
407
|
const port = newInstance(currentPort);
|
|
269
408
|
const publicClientId = publicRef ? publicRef : client;
|
|
270
|
-
const fullBuildEnabled =
|
|
409
|
+
const fullBuildEnabled = options.fullBuild && !enableLiveRebuild;
|
|
271
410
|
// const baseHost = process.env.NODE_ENV === 'production' ? `https://${host}` : `http://localhost:${port}`;
|
|
272
411
|
const baseHost = process.env.NODE_ENV === 'production' ? `https://${host}` : ``;
|
|
412
|
+
const minifyBuild = process.env.NODE_ENV === 'production';
|
|
273
413
|
// ''; // process.env.NODE_ENV === 'production' ? `https://${host}` : ``;
|
|
274
414
|
currentPort++;
|
|
275
415
|
|
|
@@ -291,7 +431,7 @@ const buildClient = async (options = { liveClientBuildPaths: [], instances: [],
|
|
|
291
431
|
rootClientPath,
|
|
292
432
|
acmeChallengeFullPath,
|
|
293
433
|
publicClientId,
|
|
294
|
-
iconsBuild,
|
|
434
|
+
iconsBuild: options.iconsBuild,
|
|
295
435
|
metadata,
|
|
296
436
|
publicCopyNonExistingFiles,
|
|
297
437
|
});
|
|
@@ -315,11 +455,7 @@ const buildClient = async (options = { liveClientBuildPaths: [], instances: [],
|
|
|
315
455
|
'components',
|
|
316
456
|
baseHost,
|
|
317
457
|
);
|
|
318
|
-
fs.writeFileSync(
|
|
319
|
-
jsPublicPath,
|
|
320
|
-
minifyBuild || process.env.NODE_ENV === 'production' ? UglifyJS.minify(jsSrc).code : jsSrc,
|
|
321
|
-
'utf8',
|
|
322
|
-
);
|
|
458
|
+
fs.writeFileSync(jsPublicPath, minifyBuild ? UglifyJS.minify(jsSrc).code : jsSrc, 'utf8');
|
|
323
459
|
}
|
|
324
460
|
}
|
|
325
461
|
|
|
@@ -341,11 +477,7 @@ const buildClient = async (options = { liveClientBuildPaths: [], instances: [],
|
|
|
341
477
|
'services',
|
|
342
478
|
baseHost,
|
|
343
479
|
);
|
|
344
|
-
fs.writeFileSync(
|
|
345
|
-
jsPublicPath,
|
|
346
|
-
minifyBuild || process.env.NODE_ENV === 'production' ? UglifyJS.minify(jsSrc).code : jsSrc,
|
|
347
|
-
'utf8',
|
|
348
|
-
);
|
|
480
|
+
fs.writeFileSync(jsPublicPath, minifyBuild ? UglifyJS.minify(jsSrc).code : jsSrc, 'utf8');
|
|
349
481
|
}
|
|
350
482
|
}
|
|
351
483
|
|
|
@@ -363,11 +495,7 @@ const buildClient = async (options = { liveClientBuildPaths: [], instances: [],
|
|
|
363
495
|
'services',
|
|
364
496
|
baseHost,
|
|
365
497
|
);
|
|
366
|
-
fs.writeFileSync(
|
|
367
|
-
jsPublicPath,
|
|
368
|
-
minifyBuild || process.env.NODE_ENV === 'production' ? UglifyJS.minify(jsSrc).code : jsSrc,
|
|
369
|
-
'utf8',
|
|
370
|
-
);
|
|
498
|
+
fs.writeFileSync(jsPublicPath, minifyBuild ? UglifyJS.minify(jsSrc).code : jsSrc, 'utf8');
|
|
371
499
|
}
|
|
372
500
|
}
|
|
373
501
|
}
|
|
@@ -387,11 +515,7 @@ const buildClient = async (options = { liveClientBuildPaths: [], instances: [],
|
|
|
387
515
|
if (!(enableLiveRebuild && !options.liveClientBuildPaths.find((p) => p.srcBuildPath === jsSrcPath))) {
|
|
388
516
|
const jsSrc = viewFormatted(await srcFormatted(fs.readFileSync(jsSrcPath, 'utf8')), dists, path, baseHost);
|
|
389
517
|
|
|
390
|
-
fs.writeFileSync(
|
|
391
|
-
jsPublicPath,
|
|
392
|
-
minifyBuild || process.env.NODE_ENV === 'production' ? UglifyJS.minify(jsSrc).code : jsSrc,
|
|
393
|
-
'utf8',
|
|
394
|
-
);
|
|
518
|
+
fs.writeFileSync(jsPublicPath, minifyBuild ? UglifyJS.minify(jsSrc).code : jsSrc, 'utf8');
|
|
395
519
|
}
|
|
396
520
|
|
|
397
521
|
if (
|
|
@@ -418,11 +542,7 @@ const buildClient = async (options = { liveClientBuildPaths: [], instances: [],
|
|
|
418
542
|
baseHost,
|
|
419
543
|
);
|
|
420
544
|
|
|
421
|
-
fs.writeFileSync(
|
|
422
|
-
`${buildPath}${buildId}.js`,
|
|
423
|
-
minifyBuild || process.env.NODE_ENV === 'production' ? UglifyJS.minify(jsSrc).code : jsSrc,
|
|
424
|
-
'utf8',
|
|
425
|
-
);
|
|
545
|
+
fs.writeFileSync(`${buildPath}${buildId}.js`, minifyBuild ? UglifyJS.minify(jsSrc).code : jsSrc, 'utf8');
|
|
426
546
|
const title = metadata.title ? metadata.title : title;
|
|
427
547
|
|
|
428
548
|
const canonicalURL = `https://${host}${path}${
|
|
@@ -559,7 +679,7 @@ const buildClient = async (options = { liveClientBuildPaths: [], instances: [],
|
|
|
559
679
|
|
|
560
680
|
fs.writeFileSync(
|
|
561
681
|
`${buildPath}index.html`,
|
|
562
|
-
minifyBuild
|
|
682
|
+
minifyBuild
|
|
563
683
|
? await minify(htmlSrc, {
|
|
564
684
|
minifyCSS: true,
|
|
565
685
|
minifyJS: true,
|
|
@@ -573,36 +693,43 @@ const buildClient = async (options = { liveClientBuildPaths: [], instances: [],
|
|
|
573
693
|
}
|
|
574
694
|
}
|
|
575
695
|
if (!enableLiveRebuild && siteMapLinks.length > 0) {
|
|
576
|
-
const
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
// Create a stream to write to
|
|
696
|
+
const hasSitemapTemplate = fs.existsSync(`${rootClientPath}/sitemap`);
|
|
697
|
+
const sitemapBaseUrl = `https://${host}${path === '/' ? '' : path}`;
|
|
698
|
+
// Create a stream to write to — omit xslUrl so we can inject a relative href below
|
|
580
699
|
/** @type {import('sitemap').SitemapStreamOptions} */
|
|
581
|
-
const sitemapOptions = { hostname: `https://${host}
|
|
700
|
+
const sitemapOptions = { hostname: `https://${host}` };
|
|
582
701
|
|
|
583
702
|
const siteMapStream = new SitemapStream(sitemapOptions);
|
|
584
703
|
let siteMapSrc = await new Promise((resolve) =>
|
|
585
704
|
streamToPromise(Readable.from(siteMapLinks).pipe(siteMapStream)).then((data) => resolve(data.toString())),
|
|
586
705
|
);
|
|
587
706
|
|
|
707
|
+
// Inject a relative xml-stylesheet PI so the XSL loads from the same origin
|
|
708
|
+
// (works on both http://localhost:<port> and https://production-host)
|
|
709
|
+
siteMapSrc = siteMapSrc.replace(
|
|
710
|
+
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
711
|
+
'<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="sitemap.xsl"?>',
|
|
712
|
+
);
|
|
713
|
+
|
|
588
714
|
// Return a promise that resolves with your XML string
|
|
589
715
|
fs.writeFileSync(`${rootClientPath}/sitemap.xml`, siteMapSrc, 'utf8');
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
716
|
+
|
|
717
|
+
// Generate XSL stylesheet from source template or default fallback
|
|
718
|
+
const xslTemplate = hasSitemapTemplate
|
|
719
|
+
? fs.readFileSync(`${rootClientPath}/sitemap`, 'utf8')
|
|
720
|
+
: defaultSitemapXsl;
|
|
721
|
+
const webUrl = `https://${host}${path === '/' ? '/' : `${path}/`}`;
|
|
722
|
+
fs.writeFileSync(`${rootClientPath}/sitemap.xsl`, xslTemplate.replaceAll('{{web-url}}', webUrl), 'utf8');
|
|
596
723
|
|
|
597
724
|
fs.writeFileSync(
|
|
598
725
|
`${rootClientPath}/robots.txt`,
|
|
599
726
|
`User-agent: *
|
|
600
|
-
Sitemap:
|
|
727
|
+
Sitemap: ${sitemapBaseUrl}/sitemap.xml`,
|
|
601
728
|
'utf8',
|
|
602
729
|
);
|
|
603
730
|
}
|
|
604
731
|
|
|
605
|
-
if (fullBuildEnabled &&
|
|
732
|
+
if (fullBuildEnabled && docs) {
|
|
606
733
|
await buildDocs({
|
|
607
734
|
host,
|
|
608
735
|
path,
|
|
@@ -612,13 +739,14 @@ Sitemap: https://${host}${path === '/' ? '' : path}/sitemap.xml`,
|
|
|
612
739
|
publicClientId,
|
|
613
740
|
rootClientPath,
|
|
614
741
|
packageData,
|
|
742
|
+
docs,
|
|
615
743
|
});
|
|
616
744
|
}
|
|
617
745
|
|
|
618
746
|
if (client) {
|
|
619
747
|
let PRE_CACHED_RESOURCES = [];
|
|
620
748
|
|
|
621
|
-
if (views &&
|
|
749
|
+
if (views && fs.existsSync(`${rootClientPath}/sw.js`)) {
|
|
622
750
|
PRE_CACHED_RESOURCES = await fs.readdir(rootClientPath, { recursive: true });
|
|
623
751
|
PRE_CACHED_RESOURCES = views
|
|
624
752
|
.map((view) => `${path === '/' ? '' : path}${view.path}`)
|
|
@@ -637,7 +765,7 @@ Sitemap: https://${host}${path === '/' ? '' : path}/sitemap.xml`,
|
|
|
637
765
|
const htmlSrc = Render({
|
|
638
766
|
title: page.title,
|
|
639
767
|
ssrPath,
|
|
640
|
-
ssrHeadComponents: '',
|
|
768
|
+
ssrHeadComponents: '<base target="_top">',
|
|
641
769
|
ssrBodyComponents: SsrComponent(),
|
|
642
770
|
renderPayload: {
|
|
643
771
|
apiBaseProxyPath,
|
|
@@ -665,7 +793,7 @@ Sitemap: https://${host}${path === '/' ? '' : path}/sitemap.xml`,
|
|
|
665
793
|
|
|
666
794
|
fs.writeFileSync(
|
|
667
795
|
buildHtmlPath,
|
|
668
|
-
minifyBuild
|
|
796
|
+
minifyBuild
|
|
669
797
|
? await minify(htmlSrc, {
|
|
670
798
|
minifyCSS: true,
|
|
671
799
|
minifyJS: true,
|
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import fs from 'fs-extra';
|
|
7
7
|
import nodemon from 'nodemon';
|
|
8
|
+
import dotenv from 'dotenv';
|
|
8
9
|
import { shellExec } from './process.js';
|
|
9
10
|
import { loggerFactory } from './logger.js';
|
|
11
|
+
import Underpost from '../index.js';
|
|
10
12
|
|
|
11
13
|
const logger = loggerFactory(import.meta);
|
|
12
14
|
|
|
@@ -21,22 +23,20 @@ const logger = loggerFactory(import.meta);
|
|
|
21
23
|
* @returns {void}
|
|
22
24
|
* @memberof clientDevServer
|
|
23
25
|
*/
|
|
24
|
-
const createClientDevServer = (
|
|
26
|
+
const createClientDevServer = async (
|
|
25
27
|
deployId = process.argv[2] || 'dd-default',
|
|
26
28
|
subConf = process.argv[3] || '',
|
|
27
29
|
host = process.argv[4] || 'default.net',
|
|
28
30
|
path = process.argv[5] || '/',
|
|
29
31
|
) => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
);
|
|
32
|
+
const devClientEnvPath = `./engine-private/conf/${deployId}/.env.${process.env.NODE_ENV}.${subConf}-dev-client`;
|
|
33
|
+
if (fs.existsSync(devClientEnvPath)) dotenv.config({ path: devClientEnvPath, override: true });
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
);
|
|
35
|
+
await Underpost.repo.client(deployId, `${subConf}-dev-client`.trim(), host, path);
|
|
36
|
+
|
|
37
|
+
shellExec(`node src/server ${deployId} ${subConf}-dev-client`.trim(), {
|
|
38
|
+
async: true,
|
|
39
|
+
});
|
|
40
40
|
|
|
41
41
|
// https://github.com/remy/nodemon/blob/main/doc/events.md
|
|
42
42
|
|
|
@@ -47,7 +47,7 @@ const createClientDevServer = (
|
|
|
47
47
|
// restart([ array of files triggering the restart ]) - child process has restarted
|
|
48
48
|
// config:update - nodemon's config has changed
|
|
49
49
|
|
|
50
|
-
if (fs.existsSync(
|
|
50
|
+
if (fs.existsSync(`/tmp/client.build.json`)) fs.removeSync(`/tmp/client.build.json`);
|
|
51
51
|
|
|
52
52
|
let buildPathScope = [];
|
|
53
53
|
|
|
@@ -77,10 +77,11 @@ const createClientDevServer = (
|
|
|
77
77
|
}, 2500);
|
|
78
78
|
const buildPathScopeBuild = buildPathScope.map((o) => o.path);
|
|
79
79
|
logger.info('buildPathScopeBuild', buildPathScopeBuild);
|
|
80
|
-
fs.writeFileSync(
|
|
80
|
+
fs.writeFileSync(`/tmp/client.build.json`, JSON.stringify(buildPathScopeBuild, null, 4));
|
|
81
81
|
})
|
|
82
82
|
.on('crash', function (error) {
|
|
83
|
-
logger.error(error, error.message);
|
|
83
|
+
if (error) logger.error(error, error.message || 'nodemon crash');
|
|
84
|
+
else logger.error('nodemon process crashed');
|
|
84
85
|
});
|
|
85
86
|
};
|
|
86
87
|
|