@jorgebodega/typeorm-seeding 7.0.0-next.3 → 7.1.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/.git-blame-ignore-revs +2 -0
  2. package/CHANGELOG.md +36 -0
  3. package/README.md +4 -4
  4. package/dist/cli.js +4 -2
  5. package/dist/cli.js.map +1 -1
  6. package/dist/commands/seed.command.js +42 -32
  7. package/dist/commands/seed.command.js.map +1 -1
  8. package/dist/datasource/DataSourceManager.d.ts +1 -1
  9. package/dist/datasource/DataSourceManager.js +7 -5
  10. package/dist/datasource/DataSourceManager.js.map +1 -1
  11. package/dist/datasource/configureDataSource.d.ts +1 -1
  12. package/dist/datasource/configureDataSource.js +6 -3
  13. package/dist/datasource/configureDataSource.js.map +1 -1
  14. package/dist/datasource/fetchDataSource.js +6 -3
  15. package/dist/datasource/fetchDataSource.js.map +1 -1
  16. package/dist/datasource/index.d.ts +2 -2
  17. package/dist/datasource/index.js +5 -2
  18. package/dist/datasource/index.js.map +1 -1
  19. package/dist/errors/DataSourceImportationError.js +5 -1
  20. package/dist/errors/DataSourceImportationError.js.map +1 -1
  21. package/dist/errors/DataSourceNotProvidedError.js +6 -2
  22. package/dist/errors/DataSourceNotProvidedError.js.map +1 -1
  23. package/dist/errors/SeederExecutionError.js +5 -1
  24. package/dist/errors/SeederExecutionError.js.map +1 -1
  25. package/dist/errors/SeederImportationError.js +5 -1
  26. package/dist/errors/SeederImportationError.js.map +1 -1
  27. package/dist/errors/index.d.ts +4 -4
  28. package/dist/errors/index.js +7 -4
  29. package/dist/errors/index.js.map +1 -1
  30. package/dist/helpers/index.d.ts +2 -2
  31. package/dist/helpers/index.js +5 -2
  32. package/dist/helpers/index.js.map +1 -1
  33. package/dist/helpers/useDataSource.d.ts +1 -1
  34. package/dist/helpers/useDataSource.js +8 -5
  35. package/dist/helpers/useDataSource.js.map +1 -1
  36. package/dist/helpers/useSeeders.d.ts +2 -2
  37. package/dist/helpers/useSeeders.js +6 -3
  38. package/dist/helpers/useSeeders.js.map +1 -1
  39. package/dist/index.d.ts +4 -4
  40. package/dist/index.js +7 -4
  41. package/dist/index.js.map +1 -1
  42. package/dist/seeder.d.ts +1 -1
  43. package/dist/seeder.js +5 -1
  44. package/dist/seeder.js.map +1 -1
  45. package/dist/types.js +2 -1
  46. package/dist/utils/commandUtils.d.ts +5 -7
  47. package/dist/utils/commandUtils.js +22 -20
  48. package/dist/utils/commandUtils.js.map +1 -1
  49. package/dist/utils/fileHandling.js +7 -3
  50. package/dist/utils/fileHandling.js.map +1 -1
  51. package/dist/utils/index.d.ts +2 -2
  52. package/dist/utils/index.js +5 -2
  53. package/dist/utils/index.js.map +1 -1
  54. package/package.json +68 -74
  55. package/.eslintrc.json +0 -34
@@ -0,0 +1,2 @@
1
+ # Replace prettier and eslint with Biome
2
+ a195c271ed2dd2c44eb84a11e061732c0b5cc83e
package/CHANGELOG.md CHANGED
@@ -1,3 +1,39 @@
1
+ # [7.1.0-next.1](https://github.com/jorgebodega/typeorm-seeding/compare/v7.0.0...v7.1.0-next.1) (2024-06-22)
2
+
3
+
4
+ ### Features
5
+
6
+ * install biome as formatter and linter ([#335](https://github.com/jorgebodega/typeorm-seeding/issues/335)) ([a195c27](https://github.com/jorgebodega/typeorm-seeding/commit/a195c271ed2dd2c44eb84a11e061732c0b5cc83e))
7
+
8
+ # [7.0.0](https://github.com/jorgebodega/typeorm-seeding/compare/v6.0.1...v7.0.0) (2024-03-18)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * deprecation messages ([e523142](https://github.com/jorgebodega/typeorm-seeding/commit/e5231421610e92145779d798996dbddb62ee3d38))
14
+ * eslint ([769263d](https://github.com/jorgebodega/typeorm-seeding/commit/769263d29ee1c8240b24ce2523229d02e621044d))
15
+ * update dependency commander to v10 ([b43eca4](https://github.com/jorgebodega/typeorm-seeding/commit/b43eca4c4106557d95e70a95a8d08141ca65b389))
16
+ * update dependency commander to v11 ([4eec67d](https://github.com/jorgebodega/typeorm-seeding/commit/4eec67d5390dfafbc42ad0ea68f68bb7b3b1936e))
17
+ * update dependency commander to v12 ([12a46b1](https://github.com/jorgebodega/typeorm-seeding/commit/12a46b1f791755b8d57d3a1ecd3bd984984566d9))
18
+ * update dependency glob to v10 ([859da14](https://github.com/jorgebodega/typeorm-seeding/commit/859da145303cc0ccc24dced4f1940c9ec8fb7a44))
19
+
20
+
21
+ ### chore
22
+
23
+ * bump minimum node version ([c08c2b2](https://github.com/jorgebodega/typeorm-seeding/commit/c08c2b273d9eddc8fe1ce3d9b294c2e5f7e4c7df))
24
+
25
+
26
+ ### Features
27
+
28
+ * upgrade node version ([b895adb](https://github.com/jorgebodega/typeorm-seeding/commit/b895adbac1ce2a541c02b78bd229f6081362950b))
29
+ * upgrade typescript ([af5c2f7](https://github.com/jorgebodega/typeorm-seeding/commit/af5c2f76addd352e00538ea198e1ae794def5160))
30
+
31
+
32
+ ### BREAKING CHANGES
33
+
34
+ * remove support for node 16
35
+ * now Node 14 (lts) and 17 are out-of-life
36
+
1
37
  # [7.0.0-next.3](https://github.com/jorgebodega/typeorm-seeding/compare/v7.0.0-next.2...v7.0.0-next.3) (2024-03-18)
2
38
 
3
39
  # [7.0.0-next.2](https://github.com/jorgebodega/typeorm-seeding/compare/v7.0.0-next.1...v7.0.0-next.2) (2024-02-28)
package/README.md CHANGED
@@ -8,13 +8,14 @@
8
8
  <a href="https://github.com/semantic-release/semantic-release">
9
9
  <img src="https://img.shields.io/badge/semantic--release-angular-e10079?logo=semantic-release&style=for-the-badge" alt="Semantic release" />
10
10
  </a>
11
+ <a href="https://biomejs.dev/">
12
+ <img src="https://img.shields.io/badge/Checked_with-Biome-60a5fa?style=for-the-badge&logo=biome" alt="Biome" />
13
+ </a>
11
14
  <a href='https://coveralls.io/github/jorgebodega/typeorm-seeding'>
12
15
  <img alt="Coveralls master branch" src="https://img.shields.io/coveralls/github/jorgebodega/typeorm-seeding/master?style=for-the-badge">
13
16
  </a>
14
17
  </p>
15
18
 
16
-
17
-
18
19
  <p align="center">
19
20
  <b>A delightful way to seed test data into your database.</b></br>
20
21
  <span>Inspired by the awesome framework <a href="https://laravel.com/">laravel</a> in PHP, <a href="https://mikro-orm.io/docs/next/seeding/">MikroORM seeding</a> and the repositories from <a href="https://github.com/pleerock">pleerock</a></span></br>
@@ -46,7 +47,6 @@ yarn add [-D] @jorgebodega/typeorm-seeding
46
47
  pnpm add [-D] @jorgebodega/typeorm-seeding
47
48
  ```
48
49
 
49
-
50
50
  # Introduction
51
51
 
52
52
  Isn't it exhausting to create some sample data for your database, well this time is over!
@@ -194,4 +194,4 @@ useDataSource(
194
194
 
195
195
  # Factory
196
196
 
197
- Factory related code has been removed from this package, now on [@jorgebodega/typeorm-factory](https://github.com/jorgebodega/typeorm-factory).
197
+ Factory related code has been removed from this package, now on [@jorgebodega/typeorm-factory](https://github.com/jorgebodega/typeorm-factory).
package/dist/cli.js CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { bootstrap } from './commands/seed.command';
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const seed_command_1 = require("./commands/seed.command");
3
5
  /* istanbul ignore file */
4
- bootstrap(process.argv);
6
+ (0, seed_command_1.bootstrap)(process.argv);
5
7
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACnD,0BAA0B;AAC1B,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA"}
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;AACA,0DAAoD;AACpD,0BAA0B;AAC1B,IAAA,wBAAS,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -1,59 +1,69 @@
1
- import { resolve } from 'node:path';
2
- import { Command } from 'commander';
3
- import ora from 'ora';
4
- import { SeederImportationError } from '../errors';
5
- import { DataSourceImportationError } from '../errors/DataSourceImportationError';
6
- import { SeederExecutionError } from '../errors/SeederExecutionError';
7
- import { useDataSource, useSeeders } from '../helpers';
8
- import { calculateFilePath, CommandUtils } from '../utils';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.bootstrap = bootstrap;
4
+ const tslib_1 = require("tslib");
5
+ const node_path_1 = require("node:path");
6
+ const commander_1 = require("commander");
7
+ const ora_1 = tslib_1.__importDefault(require("ora"));
8
+ const errors_1 = require("../errors");
9
+ const DataSourceImportationError_1 = require("../errors/DataSourceImportationError");
10
+ const SeederExecutionError_1 = require("../errors/SeederExecutionError");
11
+ const helpers_1 = require("../helpers");
12
+ const utils_1 = require("../utils");
9
13
  async function run(paths) {
10
14
  const opts = seedCommand.opts();
11
- const spinner = ora({ isSilent: process.env['NODE_ENV'] === 'test' }).start();
12
- spinner.start('Loading datasource');
15
+ const spinner = (0, ora_1.default)({ isSilent: process.env["NODE_ENV"] === "test" }).start();
16
+ spinner.start("Loading datasource");
13
17
  let dataSource;
14
18
  try {
15
- const dataSourcePath = resolve(process.cwd(), opts.dataSource);
16
- dataSource = await CommandUtils.loadDataSource(dataSourcePath);
17
- spinner.succeed('Datasource loaded');
19
+ const dataSourcePath = (0, node_path_1.resolve)(process.cwd(), opts.dataSource);
20
+ dataSource = await (0, utils_1.loadDataSource)(dataSourcePath);
21
+ spinner.succeed("Datasource loaded");
18
22
  }
19
23
  catch (error) {
20
- spinner.fail('Could not load the data source!');
21
- throw new DataSourceImportationError('Could not load the data source!', { cause: error });
24
+ spinner.fail("Could not load the data source!");
25
+ throw new DataSourceImportationError_1.DataSourceImportationError("Could not load the data source!", {
26
+ cause: error,
27
+ });
22
28
  }
23
- spinner.start('Importing seeders');
29
+ spinner.start("Importing seeders");
24
30
  let seeders;
25
31
  try {
26
- const seederFiles = paths.flatMap(calculateFilePath);
27
- seeders = await CommandUtils.loadSeeders(seederFiles);
28
- spinner.succeed('Seeder imported');
32
+ const seederFiles = paths.flatMap(utils_1.calculateFilePath);
33
+ seeders = await (0, utils_1.loadSeeders)(seederFiles);
34
+ spinner.succeed("Seeder imported");
29
35
  }
30
36
  catch (error) {
31
- spinner.fail('Could not load seeders!');
32
- throw new SeederImportationError('Could not load default seeders!', { cause: error });
37
+ spinner.fail("Could not load seeders!");
38
+ throw new errors_1.SeederImportationError("Could not load default seeders!", {
39
+ cause: error,
40
+ });
33
41
  }
34
- spinner.info(`Executing seeders...`);
42
+ spinner.info("Executing seeders...");
35
43
  try {
36
- await useDataSource(dataSource, true);
44
+ await (0, helpers_1.useDataSource)(dataSource, true);
37
45
  for (const seeder of seeders) {
38
46
  spinner.start(`Executing ${seeder.name}`);
39
- await useSeeders(seeder);
47
+ await (0, helpers_1.useSeeders)(seeder);
40
48
  spinner.succeed(`Seeder ${seeder.name} executed`);
41
49
  }
42
50
  }
43
51
  catch (error) {
44
- spinner.fail('Could not execute seeder!');
52
+ spinner.fail("Could not execute seeder!");
45
53
  await dataSource.destroy();
46
- throw new SeederExecutionError('Could not execute seeder!', { cause: error });
54
+ throw new SeederExecutionError_1.SeederExecutionError("Could not execute seeder!", {
55
+ cause: error,
56
+ });
47
57
  }
48
- spinner.succeed('Finished seeding');
58
+ spinner.succeed("Finished seeding");
49
59
  await dataSource.destroy();
50
60
  }
51
- const seedCommand = new Command('seed')
52
- .description('Run the seeders specified by the path. Glob pattern is allowed.')
53
- .requiredOption('-d, --dataSource <dataSourcePath>', 'Path to the file where your DataSource instance is defined.', './datasource.ts')
54
- .argument('<path...>', 'Paths to the seeders. Glob pattern is allowed.')
61
+ const seedCommand = new commander_1.Command("seed")
62
+ .description("Run the seeders specified by the path. Glob pattern is allowed.")
63
+ .requiredOption("-d, --dataSource <dataSourcePath>", "Path to the file where your DataSource instance is defined.", "./datasource.ts")
64
+ .argument("<path...>", "Paths to the seeders. Glob pattern is allowed.")
55
65
  .action(run);
56
- export async function bootstrap(argv) {
66
+ async function bootstrap(argv) {
57
67
  await seedCommand.parseAsync(argv);
58
68
  }
59
69
  //# sourceMappingURL=seed.command.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"seed.command.js","sourceRoot":"","sources":["../../src/commands/seed.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,GAAG,MAAM,KAAK,CAAA;AAErB,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAA;AAClD,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAA;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAA;AACrE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAGtD,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAE1D,KAAK,UAAU,GAAG,CAAC,KAAe;IAChC,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,EAAwB,CAAA;IACrD,MAAM,OAAO,GAAG,GAAG,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC,KAAK,EAAE,CAAA;IAE7E,OAAO,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAA;IACnC,IAAI,UAAuB,CAAA;IAC3B,IAAI,CAAC;QACH,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,CAAA;QAE9D,UAAU,GAAG,MAAM,YAAY,CAAC,cAAc,CAAC,cAAc,CAAC,CAAA;QAE9D,OAAO,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAA;IACtC,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,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C;IACJ,CAAC;IAED,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACpC,MAAM,UAAU,CAAC,OAAO,EAAE,CAAC;AAC5B,CAAC;AAED,MAAM,WAAW,GAAG,IAAI,mBAAO,CAAC,MAAM,CAAC;KACrC,WAAW,CAAC,iEAAiE,CAAC;KAC9E,cAAc,CACd,mCAAmC,EACnC,6DAA6D,EAC7D,iBAAiB,CACjB;KACA,QAAQ,CAAC,WAAW,EAAE,gDAAgD,CAAC;KACvE,MAAM,CAAC,GAAG,CAAC,CAAC;AAEP,KAAK,UAAU,SAAS,CAAC,IAAc;IAC7C,MAAM,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AACpC,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { DataSource } from 'typeorm';
1
+ import type { DataSource } from "typeorm";
2
2
  export declare class DataSourceManager {
3
3
  private static _instance;
4
4
  private _dataSource;
@@ -1,7 +1,8 @@
1
- import { DataSourceNotProvidedError } from '../errors';
2
- export class DataSourceManager {
3
- static _instance;
4
- _dataSource;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DataSourceManager = void 0;
4
+ const errors_1 = require("../errors");
5
+ class DataSourceManager {
5
6
  static getInstance() {
6
7
  if (!DataSourceManager._instance) {
7
8
  DataSourceManager._instance = new DataSourceManager();
@@ -10,7 +11,7 @@ export class DataSourceManager {
10
11
  }
11
12
  get dataSource() {
12
13
  if (!this._dataSource) {
13
- throw new DataSourceNotProvidedError();
14
+ throw new errors_1.DataSourceNotProvidedError();
14
15
  }
15
16
  return this._dataSource;
16
17
  }
@@ -18,4 +19,5 @@ export class DataSourceManager {
18
19
  this._dataSource = dataSource;
19
20
  }
20
21
  }
22
+ exports.DataSourceManager = DataSourceManager;
21
23
  //# sourceMappingURL=DataSourceManager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DataSourceManager.js","sourceRoot":"","sources":["../../src/datasource/DataSourceManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAA;AAEtD,MAAM,OAAO,iBAAiB;IACpB,MAAM,CAAC,SAAS,CAAmB;IACnC,WAAW,CAAwB;IAE3C,MAAM,CAAC,WAAW;QAChB,IAAI,CAAC,iBAAiB,CAAC,SAAS,EAAE,CAAC;YACjC,iBAAiB,CAAC,SAAS,GAAG,IAAI,iBAAiB,EAAE,CAAA;QACvD,CAAC;QAED,OAAO,iBAAiB,CAAC,SAAS,CAAA;IACpC,CAAC;IAED,IAAI,UAAU;QACZ,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,MAAM,IAAI,0BAA0B,EAAE,CAAA;QACxC,CAAC;QAED,OAAO,IAAI,CAAC,WAAW,CAAA;IACzB,CAAC;IAED,IAAI,UAAU,CAAC,UAAkC;QAC/C,IAAI,CAAC,WAAW,GAAG,UAAU,CAAA;IAC/B,CAAC;CACF"}
1
+ {"version":3,"file":"DataSourceManager.js","sourceRoot":"","sources":["../../src/datasource/DataSourceManager.ts"],"names":[],"mappings":";;;AACA,sCAAuD;AAEvD,MAAa,iBAAiB;IAI7B,MAAM,CAAC,WAAW;QACjB,IAAI,CAAC,iBAAiB,CAAC,SAAS,EAAE,CAAC;YAClC,iBAAiB,CAAC,SAAS,GAAG,IAAI,iBAAiB,EAAE,CAAC;QACvD,CAAC;QAED,OAAO,iBAAiB,CAAC,SAAS,CAAC;IACpC,CAAC;IAED,IAAI,UAAU;QACb,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACvB,MAAM,IAAI,mCAA0B,EAAE,CAAC;QACxC,CAAC;QAED,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;IAED,IAAI,UAAU,CAAC,UAAkC;QAChD,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAC/B,CAAC;CACD;AAvBD,8CAuBC"}
@@ -1,2 +1,2 @@
1
- import type { DataSource } from 'typeorm';
1
+ import type { DataSource } from "typeorm";
2
2
  export declare function configureDataSource(dataSource: DataSource): void;
@@ -1,5 +1,8 @@
1
- import { DataSourceManager } from './DataSourceManager';
2
- export function configureDataSource(dataSource) {
3
- DataSourceManager.getInstance().dataSource = dataSource;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.configureDataSource = configureDataSource;
4
+ const DataSourceManager_1 = require("./DataSourceManager");
5
+ function configureDataSource(dataSource) {
6
+ DataSourceManager_1.DataSourceManager.getInstance().dataSource = dataSource;
4
7
  }
5
8
  //# sourceMappingURL=configureDataSource.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"configureDataSource.js","sourceRoot":"","sources":["../../src/datasource/configureDataSource.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEvD,MAAM,UAAU,mBAAmB,CAAC,UAAsB;IACxD,iBAAiB,CAAC,WAAW,EAAE,CAAC,UAAU,GAAG,UAAU,CAAA;AACzD,CAAC"}
1
+ {"version":3,"file":"configureDataSource.js","sourceRoot":"","sources":["../../src/datasource/configureDataSource.ts"],"names":[],"mappings":";;AAGA,kDAEC;AAJD,2DAAwD;AAExD,SAAgB,mBAAmB,CAAC,UAAsB;IACzD,qCAAiB,CAAC,WAAW,EAAE,CAAC,UAAU,GAAG,UAAU,CAAC;AACzD,CAAC"}
@@ -1,5 +1,8 @@
1
- import { DataSourceManager } from './DataSourceManager';
2
- export function fetchDataSource() {
3
- return DataSourceManager.getInstance().dataSource;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchDataSource = fetchDataSource;
4
+ const DataSourceManager_1 = require("./DataSourceManager");
5
+ function fetchDataSource() {
6
+ return DataSourceManager_1.DataSourceManager.getInstance().dataSource;
4
7
  }
5
8
  //# sourceMappingURL=fetchDataSource.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetchDataSource.js","sourceRoot":"","sources":["../../src/datasource/fetchDataSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEvD,MAAM,UAAU,eAAe;IAC7B,OAAO,iBAAiB,CAAC,WAAW,EAAE,CAAC,UAAU,CAAA;AACnD,CAAC"}
1
+ {"version":3,"file":"fetchDataSource.js","sourceRoot":"","sources":["../../src/datasource/fetchDataSource.ts"],"names":[],"mappings":";;AAEA,0CAEC;AAJD,2DAAwD;AAExD,SAAgB,eAAe;IAC9B,OAAO,qCAAiB,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC;AACnD,CAAC"}
@@ -1,2 +1,2 @@
1
- export * from './configureDataSource';
2
- export * from './fetchDataSource';
1
+ export * from "./configureDataSource";
2
+ export * from "./fetchDataSource";
@@ -1,3 +1,6 @@
1
- export * from './configureDataSource';
2
- export * from './fetchDataSource';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./configureDataSource"), exports);
5
+ tslib_1.__exportStar(require("./fetchDataSource"), exports);
3
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/datasource/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/datasource/index.ts"],"names":[],"mappings":";;;AAAA,gEAAsC;AACtC,4DAAkC"}
@@ -1,3 +1,7 @@
1
- export class DataSourceImportationError extends Error {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DataSourceImportationError = void 0;
4
+ class DataSourceImportationError extends Error {
2
5
  }
6
+ exports.DataSourceImportationError = DataSourceImportationError;
3
7
  //# sourceMappingURL=DataSourceImportationError.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DataSourceImportationError.js","sourceRoot":"","sources":["../../src/errors/DataSourceImportationError.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,0BAA2B,SAAQ,KAAK;CAAG"}
1
+ {"version":3,"file":"DataSourceImportationError.js","sourceRoot":"","sources":["../../src/errors/DataSourceImportationError.ts"],"names":[],"mappings":";;;AAAA,MAAa,0BAA2B,SAAQ,KAAK;CAAG;AAAxD,gEAAwD"}
@@ -1,6 +1,10 @@
1
- export class DataSourceNotProvidedError extends Error {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DataSourceNotProvidedError = void 0;
4
+ class DataSourceNotProvidedError extends Error {
2
5
  constructor() {
3
- super(`Data source is not provided.`);
6
+ super("Data source is not provided.");
4
7
  }
5
8
  }
9
+ exports.DataSourceNotProvidedError = DataSourceNotProvidedError;
6
10
  //# sourceMappingURL=DataSourceNotProvidedError.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DataSourceNotProvidedError.js","sourceRoot":"","sources":["../../src/errors/DataSourceNotProvidedError.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IACnD;QACE,KAAK,CAAC,8BAA8B,CAAC,CAAA;IACvC,CAAC;CACF"}
1
+ {"version":3,"file":"DataSourceNotProvidedError.js","sourceRoot":"","sources":["../../src/errors/DataSourceNotProvidedError.ts"],"names":[],"mappings":";;;AAAA,MAAa,0BAA2B,SAAQ,KAAK;IACpD;QACC,KAAK,CAAC,8BAA8B,CAAC,CAAC;IACvC,CAAC;CACD;AAJD,gEAIC"}
@@ -1,3 +1,7 @@
1
- export class SeederExecutionError extends Error {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SeederExecutionError = void 0;
4
+ class SeederExecutionError extends Error {
2
5
  }
6
+ exports.SeederExecutionError = SeederExecutionError;
3
7
  //# sourceMappingURL=SeederExecutionError.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SeederExecutionError.js","sourceRoot":"","sources":["../../src/errors/SeederExecutionError.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,oBAAqB,SAAQ,KAAK;CAAG"}
1
+ {"version":3,"file":"SeederExecutionError.js","sourceRoot":"","sources":["../../src/errors/SeederExecutionError.ts"],"names":[],"mappings":";;;AAAA,MAAa,oBAAqB,SAAQ,KAAK;CAAG;AAAlD,oDAAkD"}
@@ -1,3 +1,7 @@
1
- export class SeederImportationError extends Error {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SeederImportationError = void 0;
4
+ class SeederImportationError extends Error {
2
5
  }
6
+ exports.SeederImportationError = SeederImportationError;
3
7
  //# sourceMappingURL=SeederImportationError.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SeederImportationError.js","sourceRoot":"","sources":["../../src/errors/SeederImportationError.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,sBAAuB,SAAQ,KAAK;CAAG"}
1
+ {"version":3,"file":"SeederImportationError.js","sourceRoot":"","sources":["../../src/errors/SeederImportationError.ts"],"names":[],"mappings":";;;AAAA,MAAa,sBAAuB,SAAQ,KAAK;CAAG;AAApD,wDAAoD"}
@@ -1,4 +1,4 @@
1
- export * from './DataSourceImportationError';
2
- export * from './DataSourceNotProvidedError';
3
- export * from './SeederImportationError';
4
- export * from './SeederExecutionError';
1
+ export * from "./DataSourceImportationError";
2
+ export * from "./DataSourceNotProvidedError";
3
+ export * from "./SeederImportationError";
4
+ export * from "./SeederExecutionError";
@@ -1,5 +1,8 @@
1
- export * from './DataSourceImportationError';
2
- export * from './DataSourceNotProvidedError';
3
- export * from './SeederImportationError';
4
- export * from './SeederExecutionError';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./DataSourceImportationError"), exports);
5
+ tslib_1.__exportStar(require("./DataSourceNotProvidedError"), exports);
6
+ tslib_1.__exportStar(require("./SeederImportationError"), exports);
7
+ tslib_1.__exportStar(require("./SeederExecutionError"), exports);
5
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAA;AAC5C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,0BAA0B,CAAA;AACxC,cAAc,wBAAwB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":";;;AAAA,uEAA6C;AAC7C,uEAA6C;AAC7C,mEAAyC;AACzC,iEAAuC"}
@@ -1,2 +1,2 @@
1
- export * from './useDataSource';
2
- export * from './useSeeders';
1
+ export * from "./useDataSource";
2
+ export * from "./useSeeders";
@@ -1,3 +1,6 @@
1
- export * from './useDataSource';
2
- export * from './useSeeders';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./useDataSource"), exports);
5
+ tslib_1.__exportStar(require("./useSeeders"), exports);
3
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":";;;AAAA,0DAAgC;AAChC,uDAA6B"}
@@ -1,4 +1,4 @@
1
- import type { DataSource, DataSourceOptions } from 'typeorm';
1
+ import type { DataSource, DataSourceOptions } from "typeorm";
2
2
  export declare function useDataSource(dataSource: DataSource): Promise<void>;
3
3
  export declare function useDataSource(dataSource: DataSource, overrideOptions: Partial<DataSourceOptions>): Promise<void>;
4
4
  export declare function useDataSource(dataSource: DataSource, forceInitialization: boolean): Promise<void>;
@@ -1,7 +1,10 @@
1
- import { configureDataSource } from '../datasource';
2
- export async function useDataSource(dataSource, overrideOptionsOrForceInitialization, forceInitialization) {
3
- const overrideOptions = typeof overrideOptionsOrForceInitialization === 'object' ? overrideOptionsOrForceInitialization : undefined;
4
- const shouldInitilialize = typeof overrideOptionsOrForceInitialization === 'boolean'
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useDataSource = useDataSource;
4
+ const datasource_1 = require("../datasource");
5
+ async function useDataSource(dataSource, overrideOptionsOrForceInitialization, forceInitialization) {
6
+ const overrideOptions = typeof overrideOptionsOrForceInitialization === "object" ? overrideOptionsOrForceInitialization : undefined;
7
+ const shouldInitilialize = typeof overrideOptionsOrForceInitialization === "boolean"
5
8
  ? overrideOptionsOrForceInitialization
6
9
  : forceInitialization;
7
10
  if (overrideOptions) {
@@ -10,6 +13,6 @@ export async function useDataSource(dataSource, overrideOptionsOrForceInitializa
10
13
  if (shouldInitilialize && !dataSource.isInitialized) {
11
14
  await dataSource.initialize();
12
15
  }
13
- configureDataSource(dataSource);
16
+ (0, datasource_1.configureDataSource)(dataSource);
14
17
  }
15
18
  //# sourceMappingURL=useDataSource.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDataSource.js","sourceRoot":"","sources":["../../src/helpers/useDataSource.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAWnD,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,UAAsB,EACtB,oCAA2E,EAC3E,mBAA6B;IAE7B,MAAM,eAAe,GACnB,OAAO,oCAAoC,KAAK,QAAQ,CAAC,CAAC,CAAC,oCAAoC,CAAC,CAAC,CAAC,SAAS,CAAA;IAC7G,MAAM,kBAAkB,GACtB,OAAO,oCAAoC,KAAK,SAAS;QACvD,CAAC,CAAC,oCAAoC;QACtC,CAAC,CAAC,mBAAmB,CAAA;IAEzB,IAAI,eAAe,EAAE,CAAC;QACpB,UAAU,CAAC,UAAU,CAAC,eAAe,CAAC,CAAA;IACxC,CAAC;IAED,IAAI,kBAAkB,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC;QACpD,MAAM,UAAU,CAAC,UAAU,EAAE,CAAA;IAC/B,CAAC;IAED,mBAAmB,CAAC,UAAU,CAAC,CAAA;AACjC,CAAC"}
1
+ {"version":3,"file":"useDataSource.js","sourceRoot":"","sources":["../../src/helpers/useDataSource.ts"],"names":[],"mappings":";;AAYA,sCAqBC;AAhCD,8CAAoD;AAW7C,KAAK,UAAU,aAAa,CAClC,UAAsB,EACtB,oCAA2E,EAC3E,mBAA6B;IAE7B,MAAM,eAAe,GACpB,OAAO,oCAAoC,KAAK,QAAQ,CAAC,CAAC,CAAC,oCAAoC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC7G,MAAM,kBAAkB,GACvB,OAAO,oCAAoC,KAAK,SAAS;QACxD,CAAC,CAAC,oCAAoC;QACtC,CAAC,CAAC,mBAAmB,CAAC;IAExB,IAAI,eAAe,EAAE,CAAC;QACrB,UAAU,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;IACxC,CAAC;IAED,IAAI,kBAAkB,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC;QACrD,MAAM,UAAU,CAAC,UAAU,EAAE,CAAC;IAC/B,CAAC;IAED,IAAA,gCAAmB,EAAC,UAAU,CAAC,CAAC;AACjC,CAAC"}
@@ -1,3 +1,3 @@
1
- import type { Seeder } from '../seeder';
2
- import type { Constructable } from '../types';
1
+ import type { Seeder } from "../seeder";
2
+ import type { Constructable } from "../types";
3
3
  export declare function useSeeders(entrySeeders: Constructable<Seeder> | Constructable<Seeder>[]): Promise<void>;
@@ -1,6 +1,9 @@
1
- import { fetchDataSource } from '../datasource';
2
- export async function useSeeders(entrySeeders) {
3
- const dataSource = fetchDataSource();
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useSeeders = useSeeders;
4
+ const datasource_1 = require("../datasource");
5
+ async function useSeeders(entrySeeders) {
6
+ const dataSource = (0, datasource_1.fetchDataSource)();
4
7
  const seeders = Array.isArray(entrySeeders) ? entrySeeders : [entrySeeders];
5
8
  for (const seeder of seeders) {
6
9
  await new seeder().run(dataSource);
@@ -1 +1 @@
1
- {"version":3,"file":"useSeeders.js","sourceRoot":"","sources":["../../src/helpers/useSeeders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAI/C,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,YAA6D;IAC5F,MAAM,UAAU,GAAG,eAAe,EAAE,CAAA;IAEpC,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAA;IAC3E,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,IAAI,MAAM,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;IACpC,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"useSeeders.js","sourceRoot":"","sources":["../../src/helpers/useSeeders.ts"],"names":[],"mappings":";;AAIA,gCAOC;AAXD,8CAAgD;AAIzC,KAAK,UAAU,UAAU,CAAC,YAA6D;IAC7F,MAAM,UAAU,GAAG,IAAA,4BAAe,GAAE,CAAC;IAErC,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;IAC5E,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC9B,MAAM,IAAI,MAAM,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACpC,CAAC;AACF,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from './errors';
2
- export * from './helpers';
3
- export * from './seeder';
4
- export * from './types';
1
+ export * from "./errors";
2
+ export * from "./helpers";
3
+ export * from "./seeder";
4
+ export * from "./types";
package/dist/index.js CHANGED
@@ -1,5 +1,8 @@
1
- export * from './errors';
2
- export * from './helpers';
3
- export * from './seeder';
4
- export * from './types';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./errors"), exports);
5
+ tslib_1.__exportStar(require("./helpers"), exports);
6
+ tslib_1.__exportStar(require("./seeder"), exports);
7
+ tslib_1.__exportStar(require("./types"), exports);
5
8
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mDAAyB;AACzB,oDAA0B;AAC1B,mDAAyB;AACzB,kDAAwB"}
package/dist/seeder.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { DataSource } from 'typeorm';
1
+ import type { DataSource } from "typeorm";
2
2
  export declare abstract class Seeder {
3
3
  abstract run(dataSource: DataSource): Promise<void>;
4
4
  }
package/dist/seeder.js CHANGED
@@ -1,3 +1,7 @@
1
- export class Seeder {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Seeder = void 0;
4
+ class Seeder {
2
5
  }
6
+ exports.Seeder = Seeder;
3
7
  //# sourceMappingURL=seeder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"seeder.js","sourceRoot":"","sources":["../src/seeder.ts"],"names":[],"mappings":"AAEA,MAAM,OAAgB,MAAM;CAE3B"}
1
+ {"version":3,"file":"seeder.js","sourceRoot":"","sources":["../src/seeder.ts"],"names":[],"mappings":";;;AAEA,MAAsB,MAAM;CAE3B;AAFD,wBAEC"}
package/dist/types.js CHANGED
@@ -1,2 +1,3 @@
1
- export {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
2
3
  //# sourceMappingURL=types.js.map
@@ -1,7 +1,5 @@
1
- import type { DataSource } from 'typeorm';
2
- import { Seeder } from '../seeder';
3
- import type { Constructable } from '../types';
4
- export declare class CommandUtils {
5
- static loadDataSource(dataSourceFilePath: string): Promise<DataSource>;
6
- static loadSeeders(seederPaths: string[]): Promise<Constructable<Seeder>[]>;
7
- }
1
+ import type { DataSource } from "typeorm";
2
+ import { Seeder } from "../seeder";
3
+ import type { Constructable } from "../types";
4
+ export declare function loadDataSource(dataSourceFilePath: string): Promise<DataSource>;
5
+ export declare function loadSeeders(seederPaths: string[]): Promise<Constructable<Seeder>[]>;
@@ -1,25 +1,27 @@
1
- import { CommandUtils as TypeormCommandUtils } from 'typeorm/commands/CommandUtils';
2
- import { Seeder } from '../seeder';
3
- export class CommandUtils {
4
- static async loadDataSource(dataSourceFilePath) {
5
- return TypeormCommandUtils.loadDataSource(dataSourceFilePath);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadDataSource = loadDataSource;
4
+ exports.loadSeeders = loadSeeders;
5
+ const CommandUtils_1 = require("typeorm/commands/CommandUtils");
6
+ const seeder_1 = require("../seeder");
7
+ async function loadDataSource(dataSourceFilePath) {
8
+ return CommandUtils_1.CommandUtils.loadDataSource(dataSourceFilePath);
9
+ }
10
+ async function loadSeeders(seederPaths) {
11
+ const seederFileExports = (await Promise.all(seederPaths.map((seederFile) => import(seederFile))))
12
+ .map((seederExport) => seederExport.default?.default ?? seederExport.default)
13
+ .filter((seederExport) => Boolean(seederExport));
14
+ if (seederFileExports.length === 0) {
15
+ throw new Error("No default seeders found");
6
16
  }
7
- static async loadSeeders(seederPaths) {
8
- const seederFileExports = await Promise.all(seederPaths.map((seederFile) => import(seederFile))).then((seederExports) => {
9
- return seederExports.map((seederExport) => seederExport.default).filter((seederExport) => Boolean(seederExport));
10
- });
11
- if (seederFileExports.length === 0) {
12
- throw new Error(`No default seeders found`);
13
- }
14
- const seeders = [];
15
- for (const fileExport in seederFileExports) {
16
- const seederExport = seederFileExports[fileExport];
17
- const instance = new seederExport();
18
- if (instance instanceof Seeder) {
19
- seeders.push(seederExport);
20
- }
17
+ const seeders = [];
18
+ for (const fileExport in seederFileExports) {
19
+ const seederExport = seederFileExports[fileExport];
20
+ const instance = new seederExport();
21
+ if (instance instanceof seeder_1.Seeder) {
22
+ seeders.push(seederExport);
21
23
  }
22
- return seeders;
23
24
  }
25
+ return seeders;
24
26
  }
25
27
  //# sourceMappingURL=commandUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"commandUtils.js","sourceRoot":"","sources":["../../src/utils/commandUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,IAAI,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AACnF,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAGlC,MAAM,OAAO,YAAY;IACvB,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,kBAA0B;QACpD,OAAO,mBAAmB,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAA;IAC/D,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,WAAqB;QAC5C,MAAM,iBAAiB,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CACnG,CAAC,aAAa,EAAE,EAAE;YAChB,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAA;QAClH,CAAC,CACF,CAAA;QAED,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QAC7C,CAAC;QAED,MAAM,OA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CAAC,CAAC;QACnD,MAAM,QAAQ,GAAG,IAAI,YAAY,EAAE,CAAC;QACpC,IAAI,QAAQ,YAAY,eAAM,EAAE,CAAC;YAChC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC5B,CAAC;IACF,CAAC;IAED,OAAO,OAAO,CAAC;AAChB,CAAC"}
@@ -1,5 +1,9 @@
1
- import { sync } from 'glob';
2
- export const calculateFilePath = (filePattern) => {
3
- return sync(filePattern, { ignore: '**/node_modules/**', absolute: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.calculateFilePath = void 0;
4
+ const glob_1 = require("glob");
5
+ const calculateFilePath = (filePattern) => {
6
+ return (0, glob_1.sync)(filePattern, { ignore: "**/node_modules/**", absolute: true });
4
7
  };
8
+ exports.calculateFilePath = calculateFilePath;
5
9
  //# sourceMappingURL=fileHandling.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fileHandling.js","sourceRoot":"","sources":["../../src/utils/fileHandling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAE3B,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,WAAmB,EAAY,EAAE;IACjE,OAAO,IAAI,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,oBAAoB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAA;AAC5E,CAAC,CAAA"}
1
+ {"version":3,"file":"fileHandling.js","sourceRoot":"","sources":["../../src/utils/fileHandling.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAErB,MAAM,iBAAiB,GAAG,CAAC,WAAmB,EAAY,EAAE;IAClE,OAAO,IAAA,WAAI,EAAC,WAAW,EAAE,EAAE,MAAM,EAAE,oBAAoB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AAC5E,CAAC,CAAC;AAFW,QAAA,iBAAiB,qBAE5B"}
@@ -1,2 +1,2 @@
1
- export * from './commandUtils';
2
- export * from './fileHandling';
1
+ export * from "./commandUtils";
2
+ export * from "./fileHandling";
@@ -1,3 +1,6 @@
1
- export * from './commandUtils';
2
- export * from './fileHandling';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./commandUtils"), exports);
5
+ tslib_1.__exportStar(require("./fileHandling"), exports);
3
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,yDAA+B;AAC/B,yDAA+B"}
package/package.json CHANGED
@@ -1,76 +1,70 @@
1
1
  {
2
- "author": "Gery Hirschfeld <gery.hirschfeld@w3tec.ch> (https://github.com/hirsch88)",
3
- "bin": {
4
- "typeorm-seeding": "dist/cli.js"
5
- },
6
- "contributors": [
7
- "Jorge Bodega <jorge.bodega.f@gmail.com> (https://github.com/jorgebodega)"
8
- ],
9
- "dependencies": {
10
- "chalk": "4.1.2",
11
- "commander": "12.0.0",
12
- "glob": "10.3.10",
13
- "ora": "5.4.1",
14
- "tslib": "2.6.2"
15
- },
16
- "description": "🌱 A delightful way to seed test data into your database.",
17
- "devDependencies": {
18
- "@faker-js/faker": "8.4.1",
19
- "@jorgebodega/typeorm-factory": "1.4.0",
20
- "@types/glob": "8.1.0",
21
- "@types/jest": "29.5.12",
22
- "@types/node": "20.11.29",
23
- "@typescript-eslint/eslint-plugin": "7.3.0",
24
- "@typescript-eslint/parser": "7.3.0",
25
- "eslint": "8.57.0",
26
- "eslint-config-prettier": "9.1.0",
27
- "eslint-import-resolver-typescript": "3.6.1",
28
- "eslint-plugin-import": "2.29.1",
29
- "jest": "29.7.0",
30
- "prettier": "3.2.5",
31
- "rimraf": "5.0.5",
32
- "sqlite3": "5.1.7",
33
- "ts-jest": "29.1.2",
34
- "ts-node": "10.9.2",
35
- "typeorm": "0.3.20",
36
- "typescript": "5.4.2"
37
- },
38
- "engines": {
39
- "node": ">=18 <19 || >=20"
40
- },
41
- "keywords": [
42
- "typeorm",
43
- "seed",
44
- "seeding",
45
- "orm"
46
- ],
47
- "license": "MIT",
48
- "main": "dist/index.js",
49
- "name": "@jorgebodega/typeorm-seeding",
50
- "packageManager": "pnpm@8.15.5",
51
- "peerDependencies": {
52
- "typeorm": "^0.3.0"
53
- },
54
- "repository": {
55
- "type": "git",
56
- "url": "https://github.com/jorgebodega/typeorm-seeding.git"
57
- },
58
- "scripts": {
59
- "build": "tsc --project ./tsconfig.build.json",
60
- "checks": "pnpm format:ci && pnpm lint:ci && pnpm typecheck",
61
- "format": "prettier --write \"{src,test}/**/*.ts\"",
62
- "format:ci": "prettier --check \"{src,test}/**/*.ts\"",
63
- "lint": "eslint \"{src,test}/**/*.ts\"",
64
- "lint:fix": "pnpm lint --fix",
65
- "lint:ci": "pnpm lint",
66
- "prebuild": "rimraf dist",
67
- "seed:run": "ts-node ./src/cli.ts seed",
68
- "test": "jest",
69
- "test:ci": "jest --silent",
70
- "test:cov": "jest --coverage --silent",
71
- "test:watch": "jest --watch",
72
- "typecheck": "tsc --noEmit"
73
- },
74
- "types": "dist/index.d.ts",
75
- "version": "7.0.0-next.3"
2
+ "author": "Gery Hirschfeld <gery.hirschfeld@w3tec.ch> (https://github.com/hirsch88)",
3
+ "bin": {
4
+ "typeorm-seeding": "dist/cli.js"
5
+ },
6
+ "contributors": [
7
+ "Jorge Bodega <jorge.bodega.f@gmail.com> (https://github.com/jorgebodega)"
8
+ ],
9
+ "dependencies": {
10
+ "chalk": "4.1.2",
11
+ "commander": "12.1.0",
12
+ "glob": "10.4.2",
13
+ "ora": "5.4.1",
14
+ "tslib": "2.6.3"
15
+ },
16
+ "description": "🌱 A delightful way to seed test data into your database.",
17
+ "devDependencies": {
18
+ "@biomejs/biome": "1.8.2",
19
+ "@faker-js/faker": "8.4.1",
20
+ "@jorgebodega/typeorm-factory": "1.4.0",
21
+ "@types/glob": "8.1.0",
22
+ "@types/jest": "29.5.12",
23
+ "@types/node": "20.14.7",
24
+ "jest": "29.7.0",
25
+ "rimraf": "5.0.7",
26
+ "sqlite3": "5.1.7",
27
+ "ts-jest": "29.1.5",
28
+ "ts-node": "10.9.2",
29
+ "typeorm": "0.3.20",
30
+ "typescript": "5.5.2"
31
+ },
32
+ "engines": {
33
+ "node": ">=18 <19 || >=20"
34
+ },
35
+ "keywords": [
36
+ "typeorm",
37
+ "seed",
38
+ "seeding",
39
+ "orm"
40
+ ],
41
+ "license": "MIT",
42
+ "main": "dist/index.js",
43
+ "name": "@jorgebodega/typeorm-seeding",
44
+ "packageManager": "pnpm@9.4.0",
45
+ "peerDependencies": {
46
+ "typeorm": "^0.3.0"
47
+ },
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "https://github.com/jorgebodega/typeorm-seeding.git"
51
+ },
52
+ "scripts": {
53
+ "build": "tsc --project ./tsconfig.build.json",
54
+ "checks": "pnpm format:ci && pnpm lint:ci && pnpm typecheck",
55
+ "format": "biome format --write",
56
+ "format:ci": "biome format",
57
+ "lint": "biome lint",
58
+ "lint:fix": "biome lint --fix",
59
+ "lint:ci": "biome lint",
60
+ "prebuild": "rimraf dist",
61
+ "seed:run": "ts-node ./src/cli.ts seed",
62
+ "test": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest",
63
+ "test:ci": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest --silent",
64
+ "test:cov": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest --coverage --silent",
65
+ "test:watch": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest --watch",
66
+ "typecheck": "tsc --noEmit"
67
+ },
68
+ "types": "dist/index.d.ts",
69
+ "version": "7.1.0-next.1"
76
70
  }
package/.eslintrc.json DELETED
@@ -1,34 +0,0 @@
1
- {
2
- "env": {
3
- "jest": true,
4
- "node": true
5
- },
6
- "extends": [
7
- "eslint:recommended",
8
- "plugin:@typescript-eslint/recommended",
9
- "plugin:import/recommended",
10
- "plugin:import/typescript",
11
- "prettier"
12
- ],
13
- "parser": "@typescript-eslint/parser",
14
- "parserOptions": {
15
- "project": "tsconfig.json",
16
- "sourceType": "module"
17
- },
18
- "plugins": [
19
- "@typescript-eslint"
20
- ],
21
- "rules": {
22
- "@typescript-eslint/interface-name-prefix": "off",
23
- "@typescript-eslint/explicit-function-return-type": "off",
24
- "@typescript-eslint/no-explicit-any": "off",
25
- "import/order": [
26
- "warn",
27
- {
28
- "alphabetize": {
29
- "order": "asc"
30
- }
31
- }
32
- ]
33
- }
34
- }