@jorgebodega/typeorm-seeding 4.0.0-next.3 → 4.0.0
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.
- package/CHANGELOG.md +22 -0
- package/README.md +2 -0
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/seed.command.js +2 -2
- package/dist/commands/seed.command.js.map +1 -1
- package/dist/connection/index.js +3 -3
- package/dist/connection/index.js.map +1 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
# [4.0.0](https://github.com/jorgebodega/typeorm-seeding/compare/v3.2.0...v4.0.0) (2022-03-23)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add type check on subfactories creation ([2b2883b](https://github.com/jorgebodega/typeorm-seeding/commit/2b2883b48ea08173a032b219266b1fece937e753))
|
|
7
|
+
* attrs failing with lazy instances ([c8ddda8](https://github.com/jorgebodega/typeorm-seeding/commit/c8ddda841f9e65d7081e419d2d2e662c6d6a78df))
|
|
8
|
+
* update dependency yargs to v17.4.0 ([b64c224](https://github.com/jorgebodega/typeorm-seeding/commit/b64c2245ebb086d891c503972f74cdcca0e2ddab))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* add factorized attrs ([4a2ce08](https://github.com/jorgebodega/typeorm-seeding/commit/4a2ce08e1be1d79df8f1c0450ba4b315ebca8c46))
|
|
14
|
+
* add lazyattribute and subfactory as options in attribs ([48a3630](https://github.com/jorgebodega/typeorm-seeding/commit/48a3630b8c606ff5189c05dc51908dc09f142184))
|
|
15
|
+
* add subfactory as valid factorized attr ([0f4b37e](https://github.com/jorgebodega/typeorm-seeding/commit/0f4b37e0f8c3e93aedbd109ddb8f33ac0127a2dc))
|
|
16
|
+
* separate different types of lazy attributes ([3efe94e](https://github.com/jorgebodega/typeorm-seeding/commit/3efe94ea140643ccb12dbf8858968a5866fd7577))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### BREAKING CHANGES
|
|
20
|
+
|
|
21
|
+
* definition function has been substituted with attrs
|
|
22
|
+
|
|
1
23
|
# [4.0.0-next.3](https://github.com/jorgebodega/typeorm-seeding/compare/v4.0.0-next.2...v4.0.0-next.3) (2022-03-03)
|
|
2
24
|
|
|
3
25
|
# [4.0.0-next.2](https://github.com/jorgebodega/typeorm-seeding/compare/v4.0.0-next.1...v4.0.0-next.2) (2022-02-12)
|
package/README.md
CHANGED
|
@@ -448,6 +448,8 @@ This command execute a seeder, that could be specified as a parameter.
|
|
|
448
448
|
typeorm-seeding seed
|
|
449
449
|
```
|
|
450
450
|
|
|
451
|
+
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)).
|
|
452
|
+
|
|
451
453
|
##### Options
|
|
452
454
|
|
|
453
455
|
| Option | Default | Description |
|
package/dist/cli.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
/* istanbul ignore file */
|
|
6
6
|
require("reflect-metadata");
|
|
7
|
-
const yargs =
|
|
7
|
+
const yargs = tslib_1.__importStar(require("yargs"));
|
|
8
8
|
const seed_command_1 = require("./commands/seed.command");
|
|
9
9
|
const config_command_1 = require("./commands/config.command");
|
|
10
10
|
yargs
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;AACA,0BAA0B;AAC1B,4BAAyB;AACzB,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;AACA,0BAA0B;AAC1B,4BAAyB;AACzB,qDAA8B;AAC9B,0DAAqD;AACrD,8DAAyD;AAEzD,KAAK;KACF,KAAK,CAAC,+BAA+B,CAAC;KACtC,OAAO,CAAC,IAAI,8BAAa,EAAE,CAAC;KAC5B,OAAO,CAAC,IAAI,0BAAW,EAAE,CAAC;KAC1B,iBAAiB,EAAE;KACnB,aAAa,CAAC,CAAC,CAAC;KAChB,MAAM,EAAE;KACR,IAAI,CAAC,GAAG,CAAC;KACT,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,IAAI,CAAA"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SeedCommand = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const yargs_1 = require("yargs");
|
|
6
|
-
const ora_1 =
|
|
6
|
+
const ora_1 = tslib_1.__importDefault(require("ora"));
|
|
7
7
|
const chalk_1 = require("chalk");
|
|
8
8
|
const connection_1 = require("../connection");
|
|
9
9
|
const useSeeders_1 = require("../useSeeders");
|
|
@@ -66,7 +66,7 @@ class SeedCommand {
|
|
|
66
66
|
let seeder;
|
|
67
67
|
try {
|
|
68
68
|
const seederFiles = (0, fileHandling_1.calculateFilePaths)(options.seeders);
|
|
69
|
-
const seedersImported = await Promise.all(seederFiles.map((seederFile) => Promise.resolve().then(() =>
|
|
69
|
+
const seedersImported = await Promise.all(seederFiles.map((seederFile) => Promise.resolve().then(() => tslib_1.__importStar(require(seederFile)))));
|
|
70
70
|
const allSeeders = seedersImported.reduce((prev, curr) => Object.assign(prev, curr), {});
|
|
71
71
|
const seederWanted = args.seed || options.defaultSeeder;
|
|
72
72
|
seeder = allSeeders[seederWanted];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seed.command.js","sourceRoot":"","sources":["../../src/commands/seed.command.ts"],"names":[],"mappings":";;;;AAAA,iCAA4D;AAC5D,
|
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,EAAC,MAAM,CAAC,CAAA;YACxB,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM,CAAC,IAAI,WAAW,CAAC,CAAA;SAClD;QAAC,OAAO,KAAK,EAAE;YACd,KAAK,CAAC,OAAO,EAAE,KAAc,EAAE,0BAA0B,MAAM,CAAC,IAAI,GAAG,CAAC,CAAA;YACxE,OAAM;SACP;QAED,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,YAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC,CAAA;IACxD,CAAC;CACF;AArFD,kCAqFC;AAED,SAAS,KAAK,CAAC,OAAY,EAAE,KAAY,EAAE,OAAe;IACxD,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACrB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IAC5B,IAAA,YAAI,EAAC,CAAC,EAAE,KAAK,CAAC,CAAA;AAChB,CAAC"}
|
package/dist/connection/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
tslib_1.__exportStar(require("./configureConnection"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./fetchConnection"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./getConnectionOptions"), exports);
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/connection/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/connection/index.ts"],"names":[],"mappings":";;;AAAA,gEAAqC;AACrC,4DAAiC;AACjC,iEAAsC"}
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
tslib_1.__exportStar(require("./connection"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./factory"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./instanceAttribute"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./lazyInstanceAttribute"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./seeder"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./subfactory"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./types"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./useSeeders"), exports);
|
|
12
12
|
//# 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,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uDAA4B;AAC5B,oDAAyB;AACzB,8DAAmC;AACnC,kEAAuC;AACvC,mDAAwB;AACxB,uDAA4B;AAC5B,kDAAuB;AACvB,uDAA4B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jorgebodega/typeorm-seeding",
|
|
3
|
-
"version": "4.0.0
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "🌱 A delightful way to seed test data into your database.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Gery Hirschfeld <gery.hirschfeld@w3tec.ch> (https://github.com/hirsch88)",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"typecheck": "tsc --noEmit"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@faker-js/faker": "6.0.0
|
|
39
|
+
"@faker-js/faker": "6.0.0",
|
|
40
40
|
"@semantic-release/changelog": "6.0.1",
|
|
41
41
|
"@semantic-release/git": "10.0.1",
|
|
42
42
|
"@tsconfig/node16": "1.0.2",
|
|
@@ -45,29 +45,29 @@
|
|
|
45
45
|
"@types/glob": "7.2.0",
|
|
46
46
|
"@types/jest": "27.4.1",
|
|
47
47
|
"@types/node": "17.0.17",
|
|
48
|
-
"@types/yargs": "17.0.
|
|
49
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
50
|
-
"@typescript-eslint/parser": "5.
|
|
48
|
+
"@types/yargs": "17.0.10",
|
|
49
|
+
"@typescript-eslint/eslint-plugin": "5.15.0",
|
|
50
|
+
"@typescript-eslint/parser": "5.15.0",
|
|
51
51
|
"bcryptjs": "2.4.3",
|
|
52
|
-
"eslint": "8.
|
|
53
|
-
"eslint-config-prettier": "8.
|
|
52
|
+
"eslint": "8.11.0",
|
|
53
|
+
"eslint-config-prettier": "8.5.0",
|
|
54
54
|
"eslint-plugin-import": "2.25.4",
|
|
55
55
|
"jest": "27.5.1",
|
|
56
|
-
"prettier": "2.
|
|
56
|
+
"prettier": "2.6.0",
|
|
57
57
|
"rimraf": "3.0.2",
|
|
58
58
|
"semantic-release": "19.0.2",
|
|
59
59
|
"sqlite3": "5.0.2",
|
|
60
60
|
"ts-jest": "27.1.3",
|
|
61
|
-
"ts-node": "10.
|
|
61
|
+
"ts-node": "10.7.0",
|
|
62
62
|
"typeorm": "0.2.41",
|
|
63
|
-
"typescript": "4.
|
|
63
|
+
"typescript": "4.6.2"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"chalk": "4.1.2",
|
|
67
67
|
"glob": "7.2.0",
|
|
68
68
|
"ora": "5.4.1",
|
|
69
69
|
"reflect-metadata": "0.1.13",
|
|
70
|
-
"yargs": "17.
|
|
70
|
+
"yargs": "17.4.0"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
73
|
"typeorm": "^0.2.41"
|