easy-cms 1.5.0 → 1.6.0
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/dist/bin.js +1 -1
- package/dist/{chunk-WCISVCEZ.js → chunk-3UI5QVNY.js} +21 -8
- package/dist/index.js +1 -1
- package/package.json +4 -4
package/dist/bin.js
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
ConfigError,
|
|
10
10
|
createEasyCMS as createEasyCMS2,
|
|
11
11
|
EasyCMSError,
|
|
12
|
+
jsonLogger,
|
|
12
13
|
loadConfig,
|
|
13
14
|
ValidationError,
|
|
14
15
|
warnDeprecated
|
|
@@ -17,6 +18,7 @@ import {
|
|
|
17
18
|
copyDatabase,
|
|
18
19
|
decryptBackup,
|
|
19
20
|
generateTypes,
|
|
21
|
+
logFormat,
|
|
20
22
|
writeBackupFile
|
|
21
23
|
} from "@easy-cms/core/internal";
|
|
22
24
|
|
|
@@ -113,7 +115,7 @@ async function startServer(options) {
|
|
|
113
115
|
await handler(toWebRequest(req, trustProxy), clientIpOf(req, trustProxy))
|
|
114
116
|
);
|
|
115
117
|
} catch (error) {
|
|
116
|
-
logger.error(`Request failed: ${error.message}
|
|
118
|
+
logger.error(`Request failed: ${error.message}`, { error });
|
|
117
119
|
if (!res.headersSent) {
|
|
118
120
|
res.statusCode = 500;
|
|
119
121
|
res.setHeader("content-type", "application/json; charset=utf-8");
|
|
@@ -570,23 +572,34 @@ async function serve(values, cwd, logger, load, io) {
|
|
|
570
572
|
return 1;
|
|
571
573
|
}
|
|
572
574
|
const host = values.host ?? process.env.HOST;
|
|
575
|
+
const config = await load();
|
|
576
|
+
const json = logFormat(config.logs) === "json";
|
|
577
|
+
const serverLogger = json ? jsonLogger() : logger;
|
|
573
578
|
const server = await startServer({
|
|
574
579
|
port,
|
|
575
580
|
...host ? { host } : {},
|
|
576
581
|
cwd,
|
|
577
|
-
logger,
|
|
582
|
+
logger: serverLogger,
|
|
578
583
|
loadConfig: load,
|
|
579
584
|
watch: values.watch ?? false,
|
|
580
585
|
trustProxy: values["trust-proxy"] ?? false
|
|
581
586
|
});
|
|
582
|
-
const
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
+
const admin = `${server.url}/${config.admin.path.replace(/^\/+|\/+$/g, "")}`;
|
|
588
|
+
if (json) {
|
|
589
|
+
serverLogger.info(`Easy CMS running at ${server.url}`, {
|
|
590
|
+
admin,
|
|
591
|
+
api: `${server.url}${config.routes.api}`
|
|
592
|
+
});
|
|
593
|
+
} else {
|
|
594
|
+
io.out(`Easy CMS running at ${server.url}`);
|
|
595
|
+
io.out(` admin ${admin}`);
|
|
596
|
+
io.out(` API ${server.url}${config.routes.api}`);
|
|
597
|
+
if (values.watch) io.out(" watching for changes");
|
|
598
|
+
}
|
|
587
599
|
await new Promise((resolveStop) => {
|
|
588
600
|
const stop = (signal) => {
|
|
589
|
-
|
|
601
|
+
if (json) serverLogger.info(`${signal} received, shutting down`);
|
|
602
|
+
else io.out(`
|
|
590
603
|
${signal} received, shutting down\u2026`);
|
|
591
604
|
resolveStop();
|
|
592
605
|
};
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "easy-cms",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Command line tool for Easy CMS",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"node": ">=22.12"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@easy-cms/core": "^1.
|
|
25
|
-
"@easy-cms/admin": "^1.
|
|
24
|
+
"@easy-cms/core": "^1.6.0",
|
|
25
|
+
"@easy-cms/admin": "^1.6.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@easy-cms/db-sqlite": "^1.
|
|
28
|
+
"@easy-cms/db-sqlite": "^1.6.0"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|