populate-cli.ts 815 B

12345678910111213141516171819202122232425262728293031
  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. customFields: {},
  13. };
  14. // tslint:disable
  15. populate(populateConfig, bootstrap, {
  16. logging: true,
  17. customerCount: 10,
  18. productCount: 20,
  19. channels: ['mobile-app'],
  20. })
  21. .then(app => app.close())
  22. .then(
  23. () => process.exit(0),
  24. err => {
  25. console.log(err);
  26. process.exit(1);
  27. },
  28. );
  29. }