easy-cms 0.4.0 → 0.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-AAFZW525.js";
4
+ } from "./chunk-DDTXJJBS.js";
5
5
 
6
6
  // src/bin.ts
7
7
  process.exitCode = await run(process.argv.slice(2));
@@ -194,6 +194,7 @@ Commands:
194
194
  generate:types Write TypeScript types for your collections and globals
195
195
  create-admin Create an admin user
196
196
  serve Run the CMS as its own server (admin + REST API)
197
+ run-scheduled Publish/unpublish documents whose scheduled time has come
197
198
 
198
199
  Options:
199
200
  --config <file> Config file (default: easy-cms.config.ts)
@@ -225,6 +226,11 @@ The file has no imports, so a frontend in another repository can copy it.
225
226
 
226
227
  Creates a user (role "admin" unless --role is given). The password is asked for in the
227
228
  terminal, or read from EASY_CMS_ADMIN_PASSWORD when there is no terminal.
229
+ `,
230
+ "run-scheduled": `Usage: easy-cms run-scheduled [options]
231
+
232
+ Runs due scheduled publishes and unpublishes once, for a cron job where no server process
233
+ keeps running. Servers run them every minute on their own.
228
234
  `,
229
235
  serve: `Usage: easy-cms serve [--port <n>] [--host <host>] [--watch] [--trust-proxy] [options]
230
236
 
@@ -280,9 +286,20 @@ async function run(argv, io = defaultIO) {
280
286
  return 0;
281
287
  }
282
288
  const schema = command === "create-admin" && process.env.NODE_ENV !== "production" ? "push" : "skip";
283
- const cms = await createEasyCMS2(config, { cwd, schema, logger, interactive: io.interactive });
289
+ const cms = await createEasyCMS2(config, {
290
+ cwd,
291
+ schema,
292
+ logger,
293
+ interactive: io.interactive,
294
+ scheduler: false
295
+ });
284
296
  try {
285
297
  switch (command) {
298
+ case "run-scheduled": {
299
+ const { ran, failed } = await cms.runScheduled();
300
+ io.out(`Ran ${ran} scheduled job(s)${failed ? `, ${failed} failed` : ""}.`);
301
+ return failed ? 1 : 0;
302
+ }
286
303
  case "migrate": {
287
304
  const applied = await cms.db.migrate();
288
305
  io.out(
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  createStandaloneHandler,
3
3
  run,
4
4
  startServer
5
- } from "./chunk-AAFZW525.js";
5
+ } from "./chunk-DDTXJJBS.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": "0.4.0",
3
+ "version": "0.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": "^0.4.0",
25
- "@easy-cms/admin": "^0.4.0"
24
+ "@easy-cms/core": "^0.6.0",
25
+ "@easy-cms/admin": "^0.6.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@easy-cms/db-sqlite": "^0.4.0"
28
+ "@easy-cms/db-sqlite": "^0.6.0"
29
29
  },
30
30
  "publishConfig": {
31
31
  "access": "public"