command-declarations.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import { CliCommandDefinition } from '../shared/cli-command-definition';
  2. export const cliCommands: CliCommandDefinition[] = [
  3. {
  4. name: 'add',
  5. description: 'Add a feature to your Vendure project',
  6. action: async () => {
  7. const { addCommand } = await import('./add/add');
  8. await addCommand();
  9. process.exit(0);
  10. },
  11. },
  12. {
  13. name: 'migrate',
  14. description: 'Generate, run or revert a database migration',
  15. options: [
  16. {
  17. short: '-g',
  18. long: '--generate <name>',
  19. description: 'Generate a new migration with the specified name',
  20. required: false,
  21. },
  22. {
  23. short: '-r',
  24. long: '--run',
  25. description: 'Run pending migrations',
  26. required: false,
  27. },
  28. {
  29. long: '--revert',
  30. description: 'Revert the last migration',
  31. required: false,
  32. },
  33. {
  34. short: '-o',
  35. long: '--output-dir <path>',
  36. description: 'Output directory for generated migrations',
  37. required: false,
  38. },
  39. ],
  40. action: async options => {
  41. const { migrateCommand } = await import('./migrate/migrate');
  42. await migrateCommand(options);
  43. process.exit(0);
  44. },
  45. },
  46. ];