@darraghor/nest-backend-libs 2.10.0 → 2.10.2
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/dist/cli/cli.js +0 -2
- package/dist/cli/cli.js.map +1 -1
- package/dist/database-postgres/PostgresDatabase.module.js +1 -3
- package/dist/database-postgres/PostgresDatabase.module.js.map +1 -1
- package/dist/database-postgres/PostgresTypeOrmConfigurationProvider.d.ts +3 -1
- package/dist/database-postgres/PostgresTypeOrmConfigurationProvider.js +21 -7
- package/dist/database-postgres/PostgresTypeOrmConfigurationProvider.js.map +1 -1
- package/dist/database-postgres/PostrgresMigrationsHelper.d.ts +3 -0
- package/dist/database-postgres/PostrgresMigrationsHelper.js +7 -0
- package/dist/database-postgres/PostrgresMigrationsHelper.js.map +1 -0
- package/dist/database-sqlite/SqliteDatabase.module.js +1 -3
- package/dist/database-sqlite/SqliteDatabase.module.js.map +1 -1
- package/dist/database-sqlite/SqliteMigrationsHelper.d.ts +3 -0
- package/dist/database-sqlite/SqliteMigrationsHelper.js +7 -0
- package/dist/database-sqlite/SqliteMigrationsHelper.js.map +1 -0
- package/dist/database-sqlite/SqliteTypeOrmConfigurationProvider.d.ts +3 -1
- package/dist/database-sqlite/SqliteTypeOrmConfigurationProvider.js +12 -4
- package/dist/database-sqlite/SqliteTypeOrmConfigurationProvider.js.map +1 -1
- package/package.json +1 -1
- package/dist/cli/commands/WriteTypeOrmConfigCommand.d.ts +0 -19
- package/dist/cli/commands/WriteTypeOrmConfigCommand.js +0 -47
- package/dist/cli/commands/WriteTypeOrmConfigCommand.js.map +0 -1
package/dist/cli/cli.js
CHANGED
|
@@ -7,10 +7,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
require("reflect-metadata");
|
|
8
8
|
const yargs_1 = __importDefault(require("yargs"));
|
|
9
9
|
const WriteApiClientCommand_1 = require("./commands/WriteApiClientCommand");
|
|
10
|
-
const WriteTypeOrmConfigCommand_1 = require("./commands/WriteTypeOrmConfigCommand");
|
|
11
10
|
void yargs_1.default
|
|
12
11
|
.usage("Usage: $0 <command> [options]")
|
|
13
|
-
.command(new WriteTypeOrmConfigCommand_1.WriteTypeOrmConfigCommand())
|
|
14
12
|
.command(new WriteApiClientCommand_1.WriteApiClientCommand())
|
|
15
13
|
.recommendCommands()
|
|
16
14
|
.demandCommand(1)
|
package/dist/cli/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli/cli.ts"],"names":[],"mappings":";;;;;;AACA,4BAA0B;AAC1B,kDAA0B;AAC1B,4EAAuE;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli/cli.ts"],"names":[],"mappings":";;;;;;AACA,4BAA0B;AAC1B,kDAA0B;AAC1B,4EAAuE;AAEvE,KAAK,eAAK;KACL,KAAK,CAAC,+BAA+B,CAAC;KACtC,OAAO,CAAC,IAAI,6CAAqB,EAAE,CAAC;KACpC,iBAAiB,EAAE;KACnB,aAAa,CAAC,CAAC,CAAC;KAChB,MAAM,EAAE;KACR,KAAK,CAAC,GAAG,EAAE,SAAS,CAAC;KACrB,IAAI,CAAC,GAAG,CAAC;KACT,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC"}
|
|
@@ -18,9 +18,7 @@ PostgresDatabaseModule = __decorate([
|
|
|
18
18
|
(0, common_1.Module)({
|
|
19
19
|
imports: [
|
|
20
20
|
typeorm_1.TypeOrmModule.forRootAsync({
|
|
21
|
-
useFactory: () =>
|
|
22
|
-
autoLoadEntities: true,
|
|
23
|
-
}),
|
|
21
|
+
useFactory: () => PostgresTypeOrmConfigurationProvider_1.PostgresTypeOrmConfigurationProvider.getNestTypeOrmConfig(),
|
|
24
22
|
}),
|
|
25
23
|
],
|
|
26
24
|
exports: [PostgresDatabaseConfigurationService_1.DatabaseConfigurationService, typeorm_1.TypeOrmModule],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PostgresDatabase.module.js","sourceRoot":"","sources":["../../src/database-postgres/PostgresDatabase.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA8C;AAC9C,6CAA8C;AAC9C,iGAAoF;AACpF,iGAA4F;
|
|
1
|
+
{"version":3,"file":"PostgresDatabase.module.js","sourceRoot":"","sources":["../../src/database-postgres/PostgresDatabase.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA8C;AAC9C,6CAA8C;AAC9C,iGAAoF;AACpF,iGAA4F;AAarF,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;CAAG,CAAA;AAAzB,sBAAsB;IAXlC,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC;QACJ,OAAO,EAAE;YACL,uBAAa,CAAC,YAAY,CAAC;gBACvB,UAAU,EAAE,GAAG,EAAE,CACb,2EAAoC,CAAC,oBAAoB,EAAE;aAClE,CAAC;SACL;QACD,OAAO,EAAE,CAAC,mEAA4B,EAAE,uBAAa,CAAC;QACtD,SAAS,EAAE,CAAC,mEAA4B,CAAC;KAC5C,CAAC;GACW,sBAAsB,CAAG;AAAzB,wDAAsB"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { TypeOrmModuleOptions } from "@nestjs/typeorm";
|
|
2
|
+
import { DataSourceOptions } from "typeorm";
|
|
2
3
|
export declare class PostgresTypeOrmConfigurationProvider {
|
|
3
4
|
/**
|
|
4
5
|
* This method uses process.env directly because it is also used in a node script that doesn't have access
|
|
5
6
|
* to NestJS injection.
|
|
6
7
|
* @returns
|
|
7
8
|
*/
|
|
8
|
-
static getTypeOrmConfig():
|
|
9
|
+
static getTypeOrmConfig(): DataSourceOptions;
|
|
10
|
+
static getNestTypeOrmConfig(): TypeOrmModuleOptions;
|
|
9
11
|
}
|
|
@@ -12,14 +12,22 @@ class PostgresTypeOrmConfigurationProvider {
|
|
|
12
12
|
* @returns
|
|
13
13
|
*/
|
|
14
14
|
static getTypeOrmConfig() {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const appModulePath = path_1.default.join(
|
|
15
|
+
const nodeModuleCorePath = path_1.default.join(
|
|
16
|
+
// __dirname,
|
|
17
|
+
process.env.CORE_MODULE_ENTITY_PATH || "..", "**", "*.entity.{ts,js}");
|
|
18
|
+
const appModulePath = path_1.default.join(
|
|
19
|
+
// __dirname,
|
|
20
|
+
process.env.APP_MODULE_ENTITY_PATH ||
|
|
19
21
|
"../../../../../apps/backend/dist", "**", "*.entity.{ts,js}");
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
const migrationsPath = path_1.default.join(
|
|
23
|
+
// __dirname,
|
|
24
|
+
process.env.MIGRATIONS_PATH || "../../../../../apps/backend/dist", "**", "migrations", "*.{ts,js}");
|
|
25
|
+
console.log("Using database configuration paths", {
|
|
26
|
+
appModulePath,
|
|
27
|
+
moduleLocalDirName: __dirname,
|
|
28
|
+
migrationsPath,
|
|
29
|
+
nodeModuleCorePath,
|
|
30
|
+
});
|
|
23
31
|
// database url is used in dokku
|
|
24
32
|
if (process.env.DATABASE_URL) {
|
|
25
33
|
return {
|
|
@@ -53,6 +61,12 @@ class PostgresTypeOrmConfigurationProvider {
|
|
|
53
61
|
},
|
|
54
62
|
}; // this is dynamic based on the type discriminator
|
|
55
63
|
}
|
|
64
|
+
static getNestTypeOrmConfig() {
|
|
65
|
+
return {
|
|
66
|
+
...PostgresTypeOrmConfigurationProvider.getTypeOrmConfig(),
|
|
67
|
+
autoLoadEntities: true,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
56
70
|
}
|
|
57
71
|
exports.PostgresTypeOrmConfigurationProvider = PostgresTypeOrmConfigurationProvider;
|
|
58
72
|
//# sourceMappingURL=PostgresTypeOrmConfigurationProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PostgresTypeOrmConfigurationProvider.js","sourceRoot":"","sources":["../../src/database-postgres/PostgresTypeOrmConfigurationProvider.ts"],"names":[],"mappings":";;;;;;AAGA,gDAAwB;AAGxB,MAAa,oCAAoC;IAC7C;;;;OAIG;IACI,MAAM,CAAC,gBAAgB;QAC1B,
|
|
1
|
+
{"version":3,"file":"PostgresTypeOrmConfigurationProvider.js","sourceRoot":"","sources":["../../src/database-postgres/PostgresTypeOrmConfigurationProvider.ts"],"names":[],"mappings":";;;;;;AAGA,gDAAwB;AAGxB,MAAa,oCAAoC;IAC7C;;;;OAIG;IACI,MAAM,CAAC,gBAAgB;QAC1B,MAAM,kBAAkB,GAAG,cAAI,CAAC,IAAI;QAChC,aAAa;QACb,OAAO,CAAC,GAAG,CAAC,uBAAuB,IAAI,IAAI,EAC3C,IAAI,EACJ,kBAAkB,CACrB,CAAC;QAEF,MAAM,aAAa,GAAG,cAAI,CAAC,IAAI;QAC3B,aAAa;QACb,OAAO,CAAC,GAAG,CAAC,sBAAsB;YAC9B,kCAAkC,EACtC,IAAI,EACJ,kBAAkB,CACrB,CAAC;QAEF,MAAM,cAAc,GAAG,cAAI,CAAC,IAAI;QAC5B,aAAa;QACb,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,kCAAkC,EACjE,IAAI,EACJ,YAAY,EACZ,WAAW,CACd,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,oCAAoC,EAAE;YAC9C,aAAa;YACb,kBAAkB,EAAE,SAAS;YAC7B,cAAc;YACd,kBAAkB;SACrB,CAAC,CAAC;QACH,gCAAgC;QAChC,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE;YAC1B,OAAO;gBACH,IAAI,EAAE,UAAU;gBAChB,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY;gBAC7B,OAAO,EAAE,KAAK;gBACd,mBAAmB,EAAE,YAAY;gBACjC,aAAa,EAAE,IAAI;gBACnB,WAAW,EAAE,KAAK;gBAClB,QAAQ,EAAE,CAAC,kBAAkB,EAAE,aAAa,CAAC;gBAC7C,UAAU,EAAE,CAAC,cAAc,CAAC;aAC/B,CAAC;SACL;QACD,iDAAiD;QACjD,OAAO;YACH,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB;YACnC,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,MAAM,EAAE,EAAE,CAAC;YAClE,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB;YACvC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,qBAAqB;YAC3C,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,qBAAqB;YAC3C,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB;YACvC,mBAAmB,EAAE,YAAY;YACjC,aAAa,EAAE,IAAI;YACnB,OAAO,EAAE,IAAI;YACb,WAAW,EAAE,KAAK;YAClB,QAAQ,EAAE,CAAC,kBAAkB,EAAE,aAAa,CAAC;YAC7C,UAAU,EAAE,CAAC,cAAc,CAAC;YAC5B,GAAG,EAAE;gBACD,aAAa,EAAE,gBAAgB;aAClC;SACiB,CAAC,CAAC,kDAAkD;IAC9E,CAAC;IAEM,MAAM,CAAC,oBAAoB;QAC9B,OAAO;YACH,GAAG,oCAAoC,CAAC,gBAAgB,EAAE;YAC1D,gBAAgB,EAAE,IAAI;SACzB,CAAC;IACN,CAAC;CACJ;AA3ED,oFA2EC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const typeorm_1 = require("typeorm");
|
|
4
|
+
const PostgresTypeOrmConfigurationProvider_1 = require("./PostgresTypeOrmConfigurationProvider");
|
|
5
|
+
const PostgresMigrationsDataSource = new typeorm_1.DataSource(PostgresTypeOrmConfigurationProvider_1.PostgresTypeOrmConfigurationProvider.getTypeOrmConfig());
|
|
6
|
+
exports.default = PostgresMigrationsDataSource;
|
|
7
|
+
//# sourceMappingURL=PostrgresMigrationsHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PostrgresMigrationsHelper.js","sourceRoot":"","sources":["../../src/database-postgres/PostrgresMigrationsHelper.ts"],"names":[],"mappings":";;AAAA,qCAAmC;AACnC,iGAA4F;AAE5F,MAAM,4BAA4B,GAAG,IAAI,oBAAU,CAC/C,2EAAoC,CAAC,gBAAgB,EAAE,CAC1D,CAAC;AAEF,kBAAe,4BAA4B,CAAC"}
|
|
@@ -18,9 +18,7 @@ SqliteDatabaseModule = __decorate([
|
|
|
18
18
|
(0, common_1.Module)({
|
|
19
19
|
imports: [
|
|
20
20
|
typeorm_1.TypeOrmModule.forRootAsync({
|
|
21
|
-
useFactory: () =>
|
|
22
|
-
autoLoadEntities: true,
|
|
23
|
-
}),
|
|
21
|
+
useFactory: () => SqliteTypeOrmConfigurationProvider_1.SqliteTypeOrmConfigurationProvider.getNestTypeOrmConfig(),
|
|
24
22
|
}),
|
|
25
23
|
],
|
|
26
24
|
exports: [SqliteDatabaseConfigurationService_1.SqliteDatabaseConfigurationService, typeorm_1.TypeOrmModule],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SqliteDatabase.module.js","sourceRoot":"","sources":["../../src/database-sqlite/SqliteDatabase.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA8C;AAC9C,6CAA8C;AAC9C,6FAAwF;AACxF,6FAAwF;
|
|
1
|
+
{"version":3,"file":"SqliteDatabase.module.js","sourceRoot":"","sources":["../../src/database-sqlite/SqliteDatabase.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA8C;AAC9C,6CAA8C;AAC9C,6FAAwF;AACxF,6FAAwF;AAajF,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;CAAG,CAAA;AAAvB,oBAAoB;IAXhC,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC;QACJ,OAAO,EAAE;YACL,uBAAa,CAAC,YAAY,CAAC;gBACvB,UAAU,EAAE,GAAG,EAAE,CACb,uEAAkC,CAAC,oBAAoB,EAAE;aAChE,CAAC;SACL;QACD,OAAO,EAAE,CAAC,uEAAkC,EAAE,uBAAa,CAAC;QAC5D,SAAS,EAAE,CAAC,uEAAkC,CAAC;KAClD,CAAC;GACW,oBAAoB,CAAG;AAAvB,oDAAoB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const typeorm_1 = require("typeorm");
|
|
4
|
+
const SqliteTypeOrmConfigurationProvider_1 = require("./SqliteTypeOrmConfigurationProvider");
|
|
5
|
+
const SqliteMigrationsDataSource = new typeorm_1.DataSource(SqliteTypeOrmConfigurationProvider_1.SqliteTypeOrmConfigurationProvider.getTypeOrmConfig());
|
|
6
|
+
exports.default = SqliteMigrationsDataSource;
|
|
7
|
+
//# sourceMappingURL=SqliteMigrationsHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SqliteMigrationsHelper.js","sourceRoot":"","sources":["../../src/database-sqlite/SqliteMigrationsHelper.ts"],"names":[],"mappings":";;AAAA,qCAAmC;AACnC,6FAAwF;AAExF,MAAM,0BAA0B,GAAG,IAAI,oBAAU,CAC7C,uEAAkC,CAAC,gBAAgB,EAAE,CACxD,CAAC;AAEF,kBAAe,0BAA0B,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { TypeOrmModuleOptions } from "@nestjs/typeorm";
|
|
2
|
+
import { DataSourceOptions } from "typeorm";
|
|
2
3
|
export declare class SqliteTypeOrmConfigurationProvider {
|
|
3
4
|
/**
|
|
4
5
|
* This method uses process.env directly because it is also used in a node script that doesn't have access
|
|
5
6
|
* to NestJS injection.
|
|
6
7
|
* @returns
|
|
7
8
|
*/
|
|
8
|
-
static getTypeOrmConfig():
|
|
9
|
+
static getTypeOrmConfig(): DataSourceOptions;
|
|
10
|
+
static getNestTypeOrmConfig(): TypeOrmModuleOptions;
|
|
9
11
|
}
|
|
@@ -13,14 +13,16 @@ class SqliteTypeOrmConfigurationProvider {
|
|
|
13
13
|
* @returns
|
|
14
14
|
*/
|
|
15
15
|
static getTypeOrmConfig() {
|
|
16
|
-
console.log("DIRNAME", __dirname);
|
|
17
16
|
const nodeModuleCorePath = path_1.default.join(__dirname, process.env.CORE_MODULE_ENTITY_PATH || "..", "**", "*.entity.{ts,js}");
|
|
18
|
-
console.log("Using core entity path:", nodeModuleCorePath);
|
|
19
17
|
const appModulePath = path_1.default.join(__dirname, process.env.APP_MODULE_ENTITY_PATH ||
|
|
20
18
|
"../../../../../apps/backend/dist", "**", "*.entity.{ts,js}");
|
|
21
|
-
console.log("Using application entity path:", appModulePath);
|
|
22
19
|
const migrationsPath = path_1.default.join(__dirname, process.env.MIGRATIONS_PATH || "../../../../../apps/backend/dist", "**", "migrations", "*.{ts,js}");
|
|
23
|
-
console.log("Using
|
|
20
|
+
console.log("Using database configuration paths", {
|
|
21
|
+
appModulePath,
|
|
22
|
+
moduleLocalPath: __dirname,
|
|
23
|
+
migrationsPath,
|
|
24
|
+
nodeModuleCorePath,
|
|
25
|
+
});
|
|
24
26
|
return {
|
|
25
27
|
type: "sqlite",
|
|
26
28
|
database: process.env.APP_SQLITE_DATABASE_PATH,
|
|
@@ -35,6 +37,12 @@ class SqliteTypeOrmConfigurationProvider {
|
|
|
35
37
|
},
|
|
36
38
|
};
|
|
37
39
|
}
|
|
40
|
+
static getNestTypeOrmConfig() {
|
|
41
|
+
return {
|
|
42
|
+
...SqliteTypeOrmConfigurationProvider.getTypeOrmConfig(),
|
|
43
|
+
autoLoadEntities: true,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
38
46
|
}
|
|
39
47
|
exports.SqliteTypeOrmConfigurationProvider = SqliteTypeOrmConfigurationProvider;
|
|
40
48
|
//# sourceMappingURL=SqliteTypeOrmConfigurationProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SqliteTypeOrmConfigurationProvider.js","sourceRoot":"","sources":["../../src/database-sqlite/SqliteTypeOrmConfigurationProvider.ts"],"names":[],"mappings":";AAAA,0CAA0C;;;;;;AAG1C,gDAAwB;AAGxB,MAAa,kCAAkC;IAC3C;;;;OAIG;IACI,MAAM,CAAC,gBAAgB;QAC1B,
|
|
1
|
+
{"version":3,"file":"SqliteTypeOrmConfigurationProvider.js","sourceRoot":"","sources":["../../src/database-sqlite/SqliteTypeOrmConfigurationProvider.ts"],"names":[],"mappings":";AAAA,0CAA0C;;;;;;AAG1C,gDAAwB;AAGxB,MAAa,kCAAkC;IAC3C;;;;OAIG;IACI,MAAM,CAAC,gBAAgB;QAC1B,MAAM,kBAAkB,GAAG,cAAI,CAAC,IAAI,CAChC,SAAS,EACT,OAAO,CAAC,GAAG,CAAC,uBAAuB,IAAI,IAAI,EAC3C,IAAI,EACJ,kBAAkB,CACrB,CAAC;QAEF,MAAM,aAAa,GAAG,cAAI,CAAC,IAAI,CAC3B,SAAS,EACT,OAAO,CAAC,GAAG,CAAC,sBAAsB;YAC9B,kCAAkC,EACtC,IAAI,EACJ,kBAAkB,CACrB,CAAC;QAEF,MAAM,cAAc,GAAG,cAAI,CAAC,IAAI,CAC5B,SAAS,EACT,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,kCAAkC,EACjE,IAAI,EACJ,YAAY,EACZ,WAAW,CACd,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,oCAAoC,EAAE;YAC9C,aAAa;YACb,eAAe,EAAE,SAAS;YAC1B,cAAc;YACd,kBAAkB;SACrB,CAAC,CAAC;QAEH,OAAO;YACH,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,wBAAwB;YAC9C,OAAO,EAAE,KAAK;YACd,mBAAmB,EAAE,YAAY;YACjC,aAAa,EAAE,KAAK;YACpB,WAAW,EAAE,KAAK;YAClB,QAAQ,EAAE,CAAC,kBAAkB,EAAE,aAAa,CAAC;YAC7C,UAAU,EAAE,CAAC,cAAc,CAAC;YAC5B,GAAG,EAAE;gBACD,aAAa,EAAE,gBAAgB;aAClC;SACiB,CAAC;IAC3B,CAAC;IAEM,MAAM,CAAC,oBAAoB;QAC9B,OAAO;YACH,GAAG,kCAAkC,CAAC,gBAAgB,EAAE;YACxD,gBAAgB,EAAE,IAAI;SACzB,CAAC;IACN,CAAC;CACJ;AAzDD,gFAyDC"}
|
package/package.json
CHANGED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as yargs from "yargs";
|
|
2
|
-
/**
|
|
3
|
-
* Generates a new migration file with sql needs to be executed to update schema.
|
|
4
|
-
*/
|
|
5
|
-
type ArgumentsType = {
|
|
6
|
-
o: string;
|
|
7
|
-
db: string;
|
|
8
|
-
};
|
|
9
|
-
export declare class WriteTypeOrmConfigCommand implements yargs.CommandModule<ArgumentsType, ArgumentsType> {
|
|
10
|
-
command: string;
|
|
11
|
-
describe: string;
|
|
12
|
-
builder(args: yargs.Argv): yargs.Argv<{
|
|
13
|
-
o: string;
|
|
14
|
-
} & {
|
|
15
|
-
db: string;
|
|
16
|
-
}>;
|
|
17
|
-
handler(args: yargs.ArgumentsCamelCase<ArgumentsType>): Promise<void>;
|
|
18
|
-
}
|
|
19
|
-
export {};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.WriteTypeOrmConfigCommand = void 0;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const fs_1 = __importDefault(require("fs"));
|
|
9
|
-
const dotenv_1 = __importDefault(require("dotenv"));
|
|
10
|
-
const PostgresTypeOrmConfigurationProvider_1 = require("../../database-postgres/PostgresTypeOrmConfigurationProvider");
|
|
11
|
-
const SqliteTypeOrmConfigurationProvider_1 = require("../../database-sqlite/SqliteTypeOrmConfigurationProvider");
|
|
12
|
-
dotenv_1.default.config();
|
|
13
|
-
class WriteTypeOrmConfigCommand {
|
|
14
|
-
command = "db:write-config";
|
|
15
|
-
describe = "Writes the latest orm config to ormconfig.json.";
|
|
16
|
-
// eslint-disable-next-line unicorn/prevent-abbreviations
|
|
17
|
-
builder(args) {
|
|
18
|
-
return args
|
|
19
|
-
.option("o", {
|
|
20
|
-
alias: "outputFileName",
|
|
21
|
-
type: "string",
|
|
22
|
-
default: "ormconfig.json",
|
|
23
|
-
describe: "The path to the output json file. Must include filename.",
|
|
24
|
-
})
|
|
25
|
-
.option("db", {
|
|
26
|
-
alias: "dbProvider",
|
|
27
|
-
type: "string",
|
|
28
|
-
default: "pg",
|
|
29
|
-
describe: "The database provider to use. Currently only supports 'pg' and 'sqlite'. For other providers, you will need to write your own config file.",
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
async handler(
|
|
33
|
-
// eslint-disable-next-line unicorn/prevent-abbreviations
|
|
34
|
-
args) {
|
|
35
|
-
// const fullPath = (args.path as string).startsWith("/")
|
|
36
|
-
// ? (args.path as string)
|
|
37
|
-
// : path.resolve(process.cwd(), args.path as string);
|
|
38
|
-
let config = PostgresTypeOrmConfigurationProvider_1.PostgresTypeOrmConfigurationProvider.getTypeOrmConfig();
|
|
39
|
-
if (args.db === "sqlite") {
|
|
40
|
-
config = SqliteTypeOrmConfigurationProvider_1.SqliteTypeOrmConfigurationProvider.getTypeOrmConfig();
|
|
41
|
-
}
|
|
42
|
-
console.log(chalk_1.default.green(`Writing config to ${args.o}`));
|
|
43
|
-
fs_1.default.writeFileSync(args.o, JSON.stringify(config, undefined, 2));
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
exports.WriteTypeOrmConfigCommand = WriteTypeOrmConfigCommand;
|
|
47
|
-
//# sourceMappingURL=WriteTypeOrmConfigCommand.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WriteTypeOrmConfigCommand.js","sourceRoot":"","sources":["../../../src/cli/commands/WriteTypeOrmConfigCommand.ts"],"names":[],"mappings":";;;;;;AAEA,kDAA0B;AAC1B,4CAAoB;AACpB,oDAA4B;AAC5B,uHAAkH;AAClH,iHAA4G;AAC5G,gBAAM,CAAC,MAAM,EAAE,CAAC;AAOhB,MAAa,yBAAyB;IAGlC,OAAO,GAAG,iBAAiB,CAAC;IAC5B,QAAQ,GAAG,iDAAiD,CAAC;IAE7D,yDAAyD;IACzD,OAAO,CAAC,IAAgB;QACpB,OAAO,IAAI;aACN,MAAM,CAAC,GAAG,EAAE;YACT,KAAK,EAAE,gBAAgB;YACvB,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,gBAAgB;YACzB,QAAQ,EACJ,0DAA0D;SACjE,CAAC;aACD,MAAM,CAAC,IAAI,EAAE;YACV,KAAK,EAAE,YAAY;YACnB,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,IAAI;YACb,QAAQ,EACJ,4IAA4I;SACnJ,CAAC,CAAC;IACX,CAAC;IAED,KAAK,CAAC,OAAO;IACT,yDAAyD;IACzD,IAA6C;QAE7C,yDAAyD;QACzD,8BAA8B;QAC9B,0DAA0D;QAE1D,IAAI,MAAM,GAAG,2EAAoC,CAAC,gBAAgB,EAAE,CAAC;QAErE,IAAI,IAAI,CAAC,EAAE,KAAK,QAAQ,EAAE;YACtB,MAAM,GAAG,uEAAkC,CAAC,gBAAgB,EAAE,CAAC;SAClE;QACD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,qBAAqB,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAExD,YAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC;IACnE,CAAC;CACJ;AA1CD,8DA0CC"}
|