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 CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  run
4
- } from "./chunk-WCISVCEZ.js";
4
+ } from "./chunk-3UI5QVNY.js";
5
5
 
6
6
  // src/bin.ts
7
7
  process.exitCode = await run(process.argv.slice(2));
@@ -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 config = await load();
583
- io.out(`Easy CMS running at ${server.url}`);
584
- io.out(` admin ${server.url}/${config.admin.path.replace(/^\/+|\/+$/g, "")}`);
585
- io.out(` API ${server.url}${config.routes.api}`);
586
- if (values.watch) io.out(" watching for changes");
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
- io.out(`
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
@@ -2,7 +2,7 @@ import {
2
2
  createStandaloneHandler,
3
3
  run,
4
4
  startServer
5
- } from "./chunk-WCISVCEZ.js";
5
+ } from "./chunk-3UI5QVNY.js";
6
6
  export {
7
7
  createStandaloneHandler,
8
8
  run,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy-cms",
3
- "version": "1.5.0",
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.5.0",
25
- "@easy-cms/admin": "^1.5.0"
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.5.0"
28
+ "@easy-cms/db-sqlite": "^1.6.0"
29
29
  },
30
30
  "publishConfig": {
31
31
  "access": "public"