cli.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #! /usr/bin/env node
  2. import { Command } from 'commander';
  3. import pc from 'picocolors';
  4. const program = new Command();
  5. // eslint-disable-next-line @typescript-eslint/no-var-requires
  6. const version = require('../package.json').version;
  7. program
  8. .version(version)
  9. .usage(`vendure <command>`)
  10. .description(
  11. pc.blue(`
  12. 888
  13. 888
  14. 888
  15. 888 888 .d88b. 88888b. .d88888 888 888 888d888 .d88b.
  16. 888 888 d8P Y8b 888 "88b d88" 888 888 888 888P" d8P Y8b
  17. Y88 88P 88888888 888 888 888 888 888 888 888 88888888
  18. Y8bd8P Y8b. 888 888 Y88b 888 Y88b 888 888 Y8b.
  19. Y88P "Y8888 888 888 "Y88888 "Y88888 888 "Y8888
  20. `),
  21. );
  22. program
  23. .command('add')
  24. .description('Add a feature to your Vendure project')
  25. .action(async () => {
  26. const { addCommand } = await import('./commands/add/add');
  27. await addCommand();
  28. process.exit(0);
  29. });
  30. program
  31. .command('migrate')
  32. .description('Generate, run or revert a database migration')
  33. .action(async () => {
  34. const { migrateCommand } = await import('./commands/migrate/migrate');
  35. await migrateCommand();
  36. process.exit(0);
  37. });
  38. void program.parseAsync(process.argv);