UNPKG

@lucidcms/core

Version:

The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.

1 lines 5.93 kB
{"version":3,"file":"index.mjs","names":["packageJson.version"],"sources":["../../../src/libs/cli/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Command } from \"commander\";\nimport packageJson from \"../../../package.json\" with { type: \"json\" };\nimport buildCommand from \"./commands/build.js\";\nimport cronCommand from \"./commands/cron.js\";\nimport devCommand from \"./commands/dev.js\";\nimport migrateCommand from \"./commands/migrate.js\";\nimport migrateFreshCommand from \"./commands/migrate-fresh.js\";\nimport migrateNewCommand from \"./commands/migrate-new.js\";\nimport migrateResetCommand from \"./commands/migrate-reset.js\";\nimport migrateRollbackCommand from \"./commands/migrate-rollback.js\";\nimport migrateStatusCommand from \"./commands/migrate-status.js\";\nimport serveCommand from \"./commands/serve.js\";\nimport syncCommand from \"./commands/sync.js\";\nimport typegenCommand from \"./commands/typegen.js\";\n\n// TODO: split this into 3 seperate exports and scripts, one for node, one for bun, one for deno. lucidcms:node, lucidcms:bun, lucidcms:deno\nconst program = new Command();\nconst remoteOptionDescription = \"Use remote runtime resources when supported\";\n\nprogram\n\t.name(\"lucidcms\")\n\t.description(\"Lucid CMS CLI\")\n\t.version(packageJson.version);\n\nprogram\n\t.command(\"dev\")\n\t.description(\"Start development server\")\n\t.option(\n\t\t\"-w, --watch [path]\",\n\t\t\"Watch for file changes (optionally specify path to watch)\",\n\t)\n\t.option(\"--remote\", remoteOptionDescription)\n\t.action(devCommand);\n\nprogram\n\t.command(\"serve\")\n\t.description(\"Serve the application\")\n\t.option(\"--remote\", remoteOptionDescription)\n\t.action(serveCommand);\n\nprogram\n\t.command(\"build\")\n\t.description(\"Build for production\")\n\t.option(\n\t\t\"--cache-spa\",\n\t\t\"Skip clearing SPA build output during clean. The SPA will only be rebuilt when changes are detected.\",\n\t)\n\t.option(\"--silent\", \"Suppress all logging output\")\n\t.option(\"--remote\", remoteOptionDescription)\n\t.action(buildCommand);\n\nprogram\n\t.command(\"typegen\")\n\t.description(\"Generate Lucid type files\")\n\t.option(\"--remote\", remoteOptionDescription)\n\t.action(typegenCommand);\n\nprogram\n\t.command(\"migrate\")\n\t.description(\"Run database migrations (also runs sync as a side effect)\")\n\t.option(\"-y, --yes\", \"Accept warning-level migrations without prompting\")\n\t.option(\n\t\t\"--allow-destructive\",\n\t\t\"Run destructive collection migrations without prompting. Existing data may be permanently lost.\",\n\t)\n\t.option(\"--remote\", remoteOptionDescription)\n\t.action(\n\t\t// @ts-expect-error\n\t\tmigrateCommand({ mode: \"process\" }),\n\t);\n\nprogram\n\t.command(\"sync\")\n\t.description(\"Run sync\")\n\t.option(\"--remote\", remoteOptionDescription)\n\t.action(syncCommand);\n\nprogram\n\t.command(\"migrate:status\")\n\t.description(\"Show pending migrations and migration history health\")\n\t.option(\n\t\t\"--check\",\n\t\t\"Exit with a non-zero code when migrations are pending or history is unhealthy\",\n\t)\n\t.option(\"--remote\", remoteOptionDescription)\n\t.action(migrateStatusCommand);\n\nprogram\n\t.command(\"migrate:rollback\")\n\t.description(\"Rollback the last database migration\")\n\t.option(\"-s, --steps <number>\", \"Number of migrations to rollback\", \"1\")\n\t.option(\"-f, --force\", \"Skip confirmation prompt\")\n\t.option(\"--remote\", remoteOptionDescription)\n\t.action(migrateRollbackCommand);\n\nprogram\n\t.command(\"migrate:reset\")\n\t.description(\"Drop all database tables\")\n\t.option(\"-f, --force\", \"Skip confirmation prompt\")\n\t.option(\"--remote\", remoteOptionDescription)\n\t.action(\n\t\t// @ts-expect-error\n\t\tmigrateResetCommand({ mode: \"process\" }),\n\t);\n\nprogram\n\t.command(\"migrate:new <name>\")\n\t.description(\"Create a new timestamped migration file\")\n\t.action(migrateNewCommand);\n\nprogram\n\t.command(\"migrate:fresh\")\n\t.description(\"Drop all tables and re-run all migrations\")\n\t.option(\"-f, --force\", \"Skip confirmation prompt\")\n\t.option(\"--remote\", remoteOptionDescription)\n\t.action(migrateFreshCommand);\n\nprogram\n\t.command(\"cron [job]\")\n\t.description(\"Run a cron job manually\")\n\t.option(\"--remote\", remoteOptionDescription)\n\t.action(cronCommand);\n\nprogram.parse();\n"],"mappings":";wjBAiBA,MAAM,EAAU,IAAI,EACd,EAA0B,8CAEhC,EACE,KAAK,UAAU,CAAC,CAChB,YAAY,eAAe,CAAC,CAC5B,QAAQA,CAAmB,EAE7B,EACE,QAAQ,KAAK,CAAC,CACd,YAAY,0BAA0B,CAAC,CACvC,OACA,qBACA,2DACD,CAAC,CACA,OAAO,WAAY,CAAuB,CAAC,CAC3C,OAAO,CAAU,EAEnB,EACE,QAAQ,OAAO,CAAC,CAChB,YAAY,uBAAuB,CAAC,CACpC,OAAO,WAAY,CAAuB,CAAC,CAC3C,OAAO,CAAY,EAErB,EACE,QAAQ,OAAO,CAAC,CAChB,YAAY,sBAAsB,CAAC,CACnC,OACA,cACA,sGACD,CAAC,CACA,OAAO,WAAY,6BAA6B,CAAC,CACjD,OAAO,WAAY,CAAuB,CAAC,CAC3C,OAAO,CAAY,EAErB,EACE,QAAQ,SAAS,CAAC,CAClB,YAAY,2BAA2B,CAAC,CACxC,OAAO,WAAY,CAAuB,CAAC,CAC3C,OAAO,CAAc,EAEvB,EACE,QAAQ,SAAS,CAAC,CAClB,YAAY,2DAA2D,CAAC,CACxE,OAAO,YAAa,mDAAmD,CAAC,CACxE,OACA,sBACA,iGACD,CAAC,CACA,OAAO,WAAY,CAAuB,CAAC,CAC3C,OAEA,EAAe,CAAE,KAAM,SAAU,CAAC,CACnC,EAED,EACE,QAAQ,MAAM,CAAC,CACf,YAAY,UAAU,CAAC,CACvB,OAAO,WAAY,CAAuB,CAAC,CAC3C,OAAO,CAAW,EAEpB,EACE,QAAQ,gBAAgB,CAAC,CACzB,YAAY,sDAAsD,CAAC,CACnE,OACA,UACA,+EACD,CAAC,CACA,OAAO,WAAY,CAAuB,CAAC,CAC3C,OAAO,CAAoB,EAE7B,EACE,QAAQ,kBAAkB,CAAC,CAC3B,YAAY,sCAAsC,CAAC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