populate-cli.ts 884 B

12345678910111213141516171819202122232425262728293031323334
  1. import { devConfig } from '../dev-config';
  2. import { bootstrap } from '../src';
  3. import { VendureConfig } from '../src/config/vendure-config';
  4. import { populate } from './populate';
  5. /**
  6. * A CLI script which populates the dev database with deterministic random data.
  7. */
  8. if (require.main === module) {
  9. // Running from command line
  10. const populateConfig: VendureConfig = {
  11. ...devConfig,
  12. authOptions: {
  13. tokenMethod: 'bearer',
  14. },
  15. customFields: {},
  16. };
  17. // tslint:disable
  18. populate(populateConfig, bootstrap, {
  19. logging: true,
  20. customerCount: 10,
  21. productCount: 20,
  22. channels: ['mobile-app'],
  23. })
  24. .then(app => app.close())
  25. .then(
  26. () => process.exit(0),
  27. err => {
  28. console.log(err);
  29. process.exit(1);
  30. },
  31. );
  32. }