@midwayjs/typeorm 3.9.3 → 3.9.4

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 (2) hide show
  1. package/cli.js +10 -2
  2. package/package.json +2 -2
package/cli.js CHANGED
@@ -9,6 +9,8 @@ const ImportUtils = require('typeorm/util/ImportUtils');
9
9
  // eslint-disable-next-line node/no-unpublished-require
10
10
  const { DataSource } = require('typeorm');
11
11
 
12
+ const originLoadDataSource = CommandUtils.loadDataSource;
13
+
12
14
  CommandUtils.loadDataSource = async function (dataSourceFilePath) {
13
15
  try {
14
16
  let dataSourceFileExports = await ImportUtils.importOrRequireFile(
@@ -28,8 +30,14 @@ CommandUtils.loadDataSource = async function (dataSourceFilePath) {
28
30
  dataSourceFileExports.dataSource[
29
31
  dataSourceFileExports['defaultClientName'] || 'default'
30
32
  ];
33
+
34
+ return new DataSource(dataSourceFileExports);
35
+ } else {
36
+ console.log(
37
+ '[midway:typeorm] Not found dataSource options and run origin loadDataSource method'
38
+ );
39
+ return originLoadDataSource(dataSourceFilePath);
31
40
  }
32
- return new DataSource(dataSourceFileExports);
33
41
  }
34
42
  } catch (err) {
35
43
  throw new Error(
@@ -39,4 +47,4 @@ CommandUtils.loadDataSource = async function (dataSourceFilePath) {
39
47
  };
40
48
 
41
49
  // eslint-disable-next-line node/no-unpublished-require
42
- require('typeorm/cli');
50
+ require('typeorm/cli-ts-node-commonjs');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/typeorm",
3
- "version": "3.9.3",
3
+ "version": "3.9.4",
4
4
  "main": "dist/index",
5
5
  "typings": "index.d.ts",
6
6
  "bin": {
@@ -35,5 +35,5 @@
35
35
  "type": "git",
36
36
  "url": "https://github.com/midwayjs/midway.git"
37
37
  },
38
- "gitHead": "3cd5d856789433bcfab6bcdce87743035176c878"
38
+ "gitHead": "b3daa4674afc965f147fc94b2801b4eefed87660"
39
39
  }