@jorgebodega/typeorm-seeding 5.0.1-next.1 → 5.0.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 (3) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +17 -34
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [5.0.1](https://github.com/jorgebodega/typeorm-seeding/compare/v5.0.0...v5.0.1) (2022-08-18)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * no application seeds ([30f82f6](https://github.com/jorgebodega/typeorm-seeding/commit/30f82f6c3f3c5c249ed32c78452f066cc7c1ab06))
7
+
1
8
  ## [5.0.1-next.1](https://github.com/jorgebodega/typeorm-seeding/compare/v5.0.0...v5.0.1-next.1) (2022-08-17)
2
9
 
3
10
 
package/README.md CHANGED
@@ -54,12 +54,9 @@
54
54
  - [Subfactory](#subfactory)
55
55
  - [make & makeMany](#make--makemany)
56
56
  - [create & createMany](#create--createmany)
57
- - [faker](#faker)
58
57
  - [Seeder](#seeder-1)
59
58
  - [run](#run)
60
- - [call](#call)
61
59
  - [CLI](#cli-configuration)
62
- - [config](#config)
63
60
  - [seed](#seed)
64
61
  - [Testing features](#testing-features)
65
62
 
@@ -72,6 +69,7 @@ After that install the extension with `npm` or `yarn`. Add development flag if y
72
69
  ```bash
73
70
  npm i [-D] @jorgebodega/typeorm-seeding
74
71
  yarn add [-D] @jorgebodega/typeorm-seeding
72
+ pnpm add [-D] @jorgebodega/typeorm-seeding
75
73
  ```
76
74
 
77
75
  ## Configuration
@@ -341,23 +339,6 @@ new UserFactory().create({ email: 'other@mail.com' }, { listeners: false })
341
339
  new UserFactory().createMany(10, { email: 'other@mail.com' }, { listeners: false })
342
340
  ```
343
341
 
344
- ## faker
345
-
346
- [Faker](https://github.com/faker-js/faker) package has been removed from `dependencies`. If you want to use it, please install it manually and just import when needed.
347
-
348
- ```bash
349
- npm i [-D] @faker-js/faker
350
- yarn add [-D] @faker-js/faker
351
- ```
352
-
353
- ```typescript
354
- import { faker } from '@faker-js/faker'
355
-
356
- class UserFactory extends Factory<User> {
357
- ...
358
- }
359
- ```
360
-
361
342
  # Seeder
362
343
 
363
344
  Seeder class is how we provide a way to insert data into databases, and could be executed by the command line or by helper method. Is an abstract class with one method to be implemented, and a helper function to run some more seeder sequentially.
@@ -386,16 +367,6 @@ async run(connection: Connection) {
386
367
  }
387
368
  ```
388
369
 
389
- ## `call`
390
-
391
- This function allow to run some other seeders in a sequential way.
392
-
393
- In order to use seeders from cli command, a default seeder class must be provided as root seeder, working as a tree structure.
394
-
395
- <p align="center">
396
- <img src="./seeders.png" alt="logo" />
397
- </p>
398
-
399
370
  # CLI Configuration
400
371
 
401
372
  There are two possible commands to execute, one to see the current configuration and one to run a seeder.
@@ -414,7 +385,7 @@ Add the following scripts to your `package.json` file to configure them.
414
385
  This command execute a seeder, that could be specified as a parameter.
415
386
 
416
387
  ```bash
417
- typeorm-seeding seed
388
+ typeorm-seeding seed <path>
418
389
  ```
419
390
 
420
391
  The name of the seeder to execute (either set with the `--seed` option or with default in [configs](#configuration)) must be the seeder's class name, and thus, the seeder must be exported with a named export. Please avoid default export for seeders: it may imply unwanted behavior. (See [\#75](https://github.com/jorgebodega/typeorm-seeding/issues/75)).
@@ -423,10 +394,7 @@ The name of the seeder to execute (either set with the `--seed` option or with d
423
394
 
424
395
  | Option | Default | Description |
425
396
  | ---------------------- | ------------------------------------ | ----------------------------------------------------- |
426
- | `--seed` or `-s` | Default seeder specified config file | Option to specify a seeder class to run individually. |
427
397
  | `--dataSource` or `-d` | | Path of the data source |
428
- | `--configName` or `-n` | TypeORM default value | Name to the TypeORM config file. |
429
- | `--root` or `-r` | TypeORM default value | Path to the TypeORM config file. |
430
398
 
431
399
  # Testing features
432
400
 
@@ -444,3 +412,18 @@ useSeeders(
444
412
  customOptions: Partial<ConnectionConfiguration>,
445
413
  ): Promise<void>
446
414
  ```
415
+
416
+ ## `useDataSource`
417
+
418
+ Use specific data source on the factories. If the data source is not initialized when provided, can be initialized with the `forceInitialization` flag.
419
+
420
+ ```typescript
421
+ useDataSource(dataSource: DataSource): Promise<void>
422
+ useDataSource(dataSource: DataSource, overrideOptions: Partial<DataSourceOptions>): Promise<void>
423
+ useDataSource(dataSource: DataSource, forceInitialization: boolean): Promise<void>
424
+ useDataSource(
425
+ dataSource: DataSource,
426
+ overrideOptions: Partial<DataSourceOptions>,
427
+ forceInitialization: boolean,
428
+ ): Promise<void>
429
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jorgebodega/typeorm-seeding",
3
- "version": "5.0.1-next.1",
3
+ "version": "5.0.1",
4
4
  "keywords": [
5
5
  "typeorm",
6
6
  "seed",