populate-cli.ts 689 B

12345678910111213141516171819202122232425
  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(() => process.exit(0));
  23. }