command-declarations.ts 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. options: [
  7. {
  8. long: '--config <path>',
  9. description: 'Specify the path to a custom Vendure config file',
  10. required: false,
  11. },
  12. {
  13. short: '-p',
  14. long: '--plugin <name>',
  15. description: 'Create a new plugin with the specified name',
  16. required: false,
  17. },
  18. {
  19. short: '-e',
  20. long: '--entity <name>',
  21. description: 'Add a new entity with the specified class name',
  22. required: false,
  23. subOptions: [
  24. {
  25. long: '--selected-plugin <name>',
  26. description: 'Name of the plugin to add the entity to (required with -e)',
  27. required: false,
  28. },
  29. {
  30. long: '--custom-fields',
  31. description: 'Add custom fields support to the entity',
  32. required: false,
  33. },
  34. {
  35. long: '--translatable',
  36. description: 'Make the entity translatable',
  37. required: false,
  38. },
  39. ],
  40. },
  41. {
  42. short: '-s',
  43. long: '--service <name>',
  44. description: 'Add a new service with the specified class name',
  45. required: false,
  46. subOptions: [
  47. {
  48. long: '--selected-plugin <name>',
  49. description: 'Name of the plugin to add the service to (required with -s)',
  50. required: false,
  51. },
  52. {
  53. long: '--type <type>',
  54. description: 'Type of service: basic or entity (default: basic)',
  55. required: false,
  56. },
  57. {
  58. long: '--selected-entity <n>',
  59. description:
  60. 'Name of the entity for entity service (automatically sets type to entity)',
  61. required: false,
  62. },
  63. ],
  64. },
  65. {
  66. short: '-j',
  67. long: '--job-queue [plugin]',
  68. description: 'Add job-queue support to the specified plugin',
  69. required: false,
  70. subOptions: [
  71. {
  72. long: '--name <name>',
  73. description: 'Name for the job queue (required with -j)',
  74. required: false,
  75. },
  76. {
  77. long: '--selected-service <name>',
  78. description: 'Name of the service to add the job queue to (required with -j)',
  79. required: false,
  80. },
  81. ],
  82. },
  83. {
  84. short: '-c',
  85. long: '--codegen [plugin]',
  86. description: 'Add GraphQL codegen configuration to the specified plugin',
  87. required: false,
  88. },
  89. {
  90. short: '-a',
  91. long: '--api-extension [plugin]',
  92. description: 'Add an API extension scaffold to the specified plugin',
  93. required: false,
  94. subOptions: [
  95. {
  96. long: '--queryName <name>',
  97. description: 'Name for the query (used with -a)',
  98. required: false,
  99. },
  100. {
  101. long: '--mutationName <name>',
  102. description: 'Name for the mutation (used with -a)',
  103. required: false,
  104. },
  105. {
  106. long: '--selected-service <name>',
  107. description: 'Name of the service to add the API extension to (required with -a)',
  108. required: false,
  109. },
  110. ],
  111. },
  112. {
  113. short: '-u',
  114. long: '--ui-extensions [plugin]',
  115. description: 'Add Admin UI extensions setup to the specified plugin',
  116. required: false,
  117. },
  118. ],
  119. action: async options => {
  120. const { addCommand } = await import('./add/add');
  121. await addCommand(options);
  122. process.exit(0);
  123. },
  124. },
  125. {
  126. name: 'migrate',
  127. description: 'Generate, run or revert a database migration',
  128. options: [
  129. {
  130. short: '-g',
  131. long: '--generate <name>',
  132. description: 'Generate a new migration with the specified name',
  133. required: false,
  134. },
  135. {
  136. short: '-r',
  137. long: '--run',
  138. description: 'Run pending migrations',
  139. required: false,
  140. },
  141. {
  142. long: '--revert',
  143. description: 'Revert the last migration',
  144. required: false,
  145. },
  146. {
  147. short: '-o',
  148. long: '--output-dir <path>',
  149. description: 'Output directory for generated migrations',
  150. required: false,
  151. },
  152. ],
  153. action: async options => {
  154. const { migrateCommand } = await import('./migrate/migrate');
  155. await migrateCommand(options);
  156. process.exit(0);
  157. },
  158. },
  159. ];