moved to ts-node
This commit is contained in:
parent
a68307dbf7
commit
1919c18dce
@ -40,12 +40,9 @@ before_install:
|
||||
before_script:
|
||||
- if [ -n "$DOCKER_USERNAME" ]; then mkdir /opt/oracle; npm i oracledb --no-save; docker cp typeorm-mg-oracle-client:/usr/lib/oracle/12.2/client64/lib /opt/oracle/instantclient_12_2; fi
|
||||
- export LD_LIBRARY_PATH=/opt/oracle/instantclient_12_2:$LD_LIBRARY_PATH
|
||||
- npm link typescript
|
||||
- tsc
|
||||
- sleep 60
|
||||
script:
|
||||
- travis_retry npm t
|
||||
- travis_retry "sleep 60 && npm t"
|
||||
after_success:
|
||||
- codecov --file=./coverage/coverage.json
|
||||
- codecov
|
||||
dd:
|
||||
secure: lONUbDz2a1LWId+Z2tTaxajK7MilX/XbQ875FYD6EE09DQ0xcoPdq2/KW5/pxuN1tz4QzTG7izMwra3XWtkBySxqFwJDUOibsgYVgn+EMMuPWNMNnQgXqTTmHbtbm1L1aSMHu4bCu4cJkJBX6503R0Kv4Hbdr2LFnSUI/9KqrevA1cVyksN71BlNBdRtvnHInwB5wNNvGULSLT+DR6qGytLGjq4ZF+pW7dH3A1LNGfDY4ivGPHt9eAWGHcVuESmudO1ADmf6XTZAJVdKqDy5eJguK48XyAqRmTc1vBxDJmCNDaU/mV6fkUoEkCjn9XfG5nJLOKviycc1j/OCuuWuqojmTlRInPGV8GDT8lNivwqLBMzvKoKgSQQROEVus4xzo64M808dFbUS30et3++O589X/7P9Wjmt+6HawcEsSq5TQfEutyB+tM9OwedTkB5Fwwmymuqx23zCAJ2orP7WoIG/ApmnKu6LmpoM340UxxSGkurztQP1OqFrf4u8kDVp9/xzqnd7qSfEd8iKvvb1bOykWGxx6dhyThCdSNyT5GQL3aub3LV6g0UB37lbhB+BVSrOAhN0r1cIWT2wr2mRxwoepObmrcNQ+AOUUXE/RcONsiEQr+STsEIjJb7bTANljRYMKpiPdsAdhvDaUZRyu8KBArTCDPotanzwQFERcw8=
|
||||
|
834
package-lock.json
generated
834
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
27
package.json
27
package.json
@ -5,13 +5,10 @@
|
||||
"bin": "bin/typeorm-model-generator",
|
||||
"scripts": {
|
||||
"setup": "npm install",
|
||||
"start": " node ./dist/src/index.js",
|
||||
"compile": "npm run clean && tsc",
|
||||
"test": "istanbul cover ./node_modules/mocha/bin/_mocha dist/test/**/*.test.js -- -R spec --bail",
|
||||
"posttest": "remap-istanbul -i ./coverage/coverage.json -o ./coverage/lcov.info -t lcovonly && remap-istanbul -i ./coverage/coverage.json -o ./coverage/coverage.json",
|
||||
"clean": "rimraf dist coverage output",
|
||||
"prettier": "prettier --write ./src/*.ts ./src/**/*.ts",
|
||||
"prepack": "npm run compile"
|
||||
"start": "ts-node ./src/index.ts",
|
||||
"test": "nyc --reporter=lcov ts-node ./node_modules/mocha/bin/_mocha test/**/*.test.ts -- -R spec --bail",
|
||||
"clean": "rimraf coverage output",
|
||||
"prettier": "prettier --write ./src/*.ts ./src/**/*.ts"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -33,6 +30,7 @@
|
||||
"pg": "^7.11.0",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"sqlite3": "^4.0.8",
|
||||
"ts-node": "^8.2.0",
|
||||
"typeorm": "^0.2.18",
|
||||
"typescript": "^3.5.1",
|
||||
"yargs": "^13.2.4",
|
||||
@ -59,11 +57,10 @@
|
||||
"codecov": "^3.5.0",
|
||||
"dotenv": "^8.0.0",
|
||||
"husky": "^2.3.0",
|
||||
"istanbul": "^0.4.5",
|
||||
"lint-staged": "^8.1.7",
|
||||
"mocha": "^6.1.4",
|
||||
"nyc": "^14.1.1",
|
||||
"prettier": "^1.17.1",
|
||||
"remap-istanbul": "^0.13.0",
|
||||
"rimraf": "^2.6.3",
|
||||
"sinon": "^7.3.2",
|
||||
"sinon-chai": "^3.3.0",
|
||||
@ -74,5 +71,17 @@
|
||||
"hooks": {
|
||||
"pre-commit": "npm run prettier && git update-index --again"
|
||||
}
|
||||
},
|
||||
"nyc": {
|
||||
"check-coverage": true,
|
||||
"all": true,
|
||||
"extension": [
|
||||
".ts",
|
||||
".tsx"
|
||||
],
|
||||
"lines": "50",
|
||||
"include": [
|
||||
"src/**/!(*.test.*).[tj]s?(x)"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ export function modelGenerationPhase(
|
||||
databaseModel: EntityInfo[]
|
||||
) {
|
||||
createHandlebarsHelpers(generationOptions);
|
||||
const templatePath = path.resolve(__dirname, "../../src/entity.mst");
|
||||
const templatePath = path.resolve(__dirname, "entity.mst");
|
||||
const template = fs.readFileSync(templatePath, "UTF-8");
|
||||
const resultPath = generationOptions.resultsPath;
|
||||
if (!fs.existsSync(resultPath)) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import * as packagejson from "./../../package.json";
|
||||
import * as packagejson from "../package.json";
|
||||
export function LogError(
|
||||
errText: string,
|
||||
isABug: boolean = true,
|
||||
|
@ -7,7 +7,9 @@ import { DataTypeDefaults } from "typeorm/driver/types/DataTypeDefaults";
|
||||
import { IConnectionOptions } from "../IConnectionOptions";
|
||||
import { ColumnInfo } from "../models/ColumnInfo";
|
||||
import { EntityInfo } from "../models/EntityInfo";
|
||||
import { IndexInfo } from "../models/IndexInfo";
|
||||
import { RelationInfo } from "../models/RelationInfo";
|
||||
import { IRelationTempInfo } from "../models/RelationTempInfo";
|
||||
import * as TomgUtils from "../Utils";
|
||||
|
||||
export abstract class AbstractDriver {
|
||||
|
@ -5,6 +5,9 @@ import { DataTypeDefaults } from "typeorm/driver/types/DataTypeDefaults";
|
||||
import { IConnectionOptions } from "../IConnectionOptions";
|
||||
import { ColumnInfo } from "../models/ColumnInfo";
|
||||
import { EntityInfo } from "../models/EntityInfo";
|
||||
import { IndexColumnInfo } from "../models/IndexColumnInfo";
|
||||
import { IndexInfo } from "../models/IndexInfo";
|
||||
import { IRelationTempInfo } from "../models/RelationTempInfo";
|
||||
import * as TomgUtils from "../Utils";
|
||||
import { AbstractDriver } from "./AbstractDriver";
|
||||
|
||||
|
@ -5,6 +5,9 @@ import { DataTypeDefaults } from "typeorm/driver/types/DataTypeDefaults";
|
||||
import { IConnectionOptions } from "../IConnectionOptions";
|
||||
import { ColumnInfo } from "../models/ColumnInfo";
|
||||
import { EntityInfo } from "../models/EntityInfo";
|
||||
import { IndexColumnInfo } from "../models/IndexColumnInfo";
|
||||
import { IndexInfo } from "../models/IndexInfo";
|
||||
import { IRelationTempInfo } from "../models/RelationTempInfo";
|
||||
import * as TomgUtils from "../Utils";
|
||||
import { AbstractDriver } from "./AbstractDriver";
|
||||
|
||||
|
@ -3,6 +3,9 @@ import { DataTypeDefaults } from "typeorm/driver/types/DataTypeDefaults";
|
||||
import { IConnectionOptions } from "../IConnectionOptions";
|
||||
import { ColumnInfo } from "../models/ColumnInfo";
|
||||
import { EntityInfo } from "../models/EntityInfo";
|
||||
import { IndexColumnInfo } from "../models/IndexColumnInfo";
|
||||
import { IndexInfo } from "../models/IndexInfo";
|
||||
import { IRelationTempInfo } from "../models/RelationTempInfo";
|
||||
import * as TomgUtils from "../Utils";
|
||||
import { AbstractDriver } from "./AbstractDriver";
|
||||
|
||||
|
@ -5,6 +5,9 @@ import { DataTypeDefaults } from "typeorm/driver/types/DataTypeDefaults";
|
||||
import { IConnectionOptions } from "../IConnectionOptions";
|
||||
import { ColumnInfo } from "../models/ColumnInfo";
|
||||
import { EntityInfo } from "../models/EntityInfo";
|
||||
import { IndexColumnInfo } from "../models/IndexColumnInfo";
|
||||
import { IndexInfo } from "../models/IndexInfo";
|
||||
import { IRelationTempInfo } from "../models/RelationTempInfo";
|
||||
import * as TomgUtils from "../Utils";
|
||||
import { AbstractDriver } from "./AbstractDriver";
|
||||
|
||||
|
@ -4,6 +4,9 @@ import { DataTypeDefaults } from "typeorm/driver/types/DataTypeDefaults";
|
||||
import { IConnectionOptions } from "../IConnectionOptions";
|
||||
import { ColumnInfo } from "../models/ColumnInfo";
|
||||
import { EntityInfo } from "../models/EntityInfo";
|
||||
import { IndexColumnInfo } from "../models/IndexColumnInfo";
|
||||
import { IndexInfo } from "../models/IndexInfo";
|
||||
import { IRelationTempInfo } from "../models/RelationTempInfo";
|
||||
import * as TomgUtils from "../Utils";
|
||||
import { AbstractDriver } from "./AbstractDriver";
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { ColumnInfo } from "./ColumnInfo";
|
||||
import { IndexInfo } from "./IndexInfo";
|
||||
|
||||
export class EntityInfo {
|
||||
public tsEntityName: string;
|
||||
|
@ -1,3 +1,3 @@
|
||||
interface IndexColumnInfo {
|
||||
export interface IndexColumnInfo {
|
||||
name: string;
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
interface IndexInfo {
|
||||
import { IndexColumnInfo } from "./IndexColumnInfo";
|
||||
|
||||
export interface IndexInfo {
|
||||
name: string;
|
||||
columns: IndexColumnInfo[];
|
||||
isUnique: boolean;
|
||||
|
@ -1,4 +1,4 @@
|
||||
interface IRelationTempInfo {
|
||||
export interface IRelationTempInfo {
|
||||
ownerTable: string;
|
||||
ownerColumnsNames: string[];
|
||||
referencedTable: string;
|
||||
|
@ -7,6 +7,7 @@ import { ColumnInfo } from '../../src/models/ColumnInfo'
|
||||
import { EntityInfo } from '../../src/models/EntityInfo'
|
||||
import { RelationInfo } from '../../src/models/RelationInfo'
|
||||
import { NamingStrategy } from "../../src/NamingStrategy";
|
||||
import { IndexInfo } from "../../src/models/IndexInfo";
|
||||
|
||||
class fakeResponse implements MSSQL.IResult<any> {
|
||||
public recordsets: Array<MSSQL.IRecordSet<any>>;
|
||||
|
@ -148,7 +148,7 @@ function compileGeneratedModel(filesGenPath: string, drivers: string[]) {
|
||||
}
|
||||
|
||||
async function prepareTestRuns(testPartialPath: string, testName: string, dbDriver: string) {
|
||||
const filesOrgPathJS = path.resolve(process.cwd(), 'dist', testPartialPath, testName, 'entity');
|
||||
const filesOrgPathJS = path.resolve(process.cwd(), testPartialPath, testName, 'entity');
|
||||
const filesOrgPathTS = path.resolve(process.cwd(), testPartialPath, testName, 'entity');
|
||||
const resultsPath = path.resolve(process.cwd(), `output`, dbDriver);
|
||||
fs.removeSync(resultsPath);
|
||||
|
@ -60,7 +60,7 @@ export async function createMSSQLModels(filesOrgPath: string): Promise<IConnecti
|
||||
port: Number(process.env.MSSQL_Port),
|
||||
dropSchema: true,
|
||||
synchronize: false,
|
||||
entities: [path.resolve(filesOrgPath, '*.js')],
|
||||
entities: [path.resolve(filesOrgPath, '*.ts')],
|
||||
name: 'mssql'
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ export async function createPostgresModels(filesOrgPath: string): Promise<IConne
|
||||
port: Number(process.env.POSTGRES_Port),
|
||||
dropSchema: true,
|
||||
synchronize: false,
|
||||
entities: [path.resolve(filesOrgPath, '*.js')],
|
||||
entities: [path.resolve(filesOrgPath, '*.ts')],
|
||||
name: 'postgres'
|
||||
}
|
||||
|
||||
@ -155,7 +155,7 @@ export async function createSQLiteModels(filesOrgPath: string): Promise<IConnect
|
||||
type: 'sqlite',
|
||||
dropSchema: true,
|
||||
synchronize: false,
|
||||
entities: [path.resolve(filesOrgPath, '*.js')],
|
||||
entities: [path.resolve(filesOrgPath, '*.ts')],
|
||||
name: 'sqlite'
|
||||
}
|
||||
|
||||
@ -199,7 +199,7 @@ export async function createMysqlModels(filesOrgPath: string): Promise<IConnecti
|
||||
port: Number(process.env.MYSQL_Port),
|
||||
dropSchema: true,
|
||||
synchronize: true,
|
||||
entities: [path.resolve(filesOrgPath, '*.js')],
|
||||
entities: [path.resolve(filesOrgPath, '*.ts')],
|
||||
name: 'mysql'
|
||||
}
|
||||
const conn = await createConnection(connOpt)
|
||||
@ -240,7 +240,7 @@ export async function createMariaDBModels(filesOrgPath: string): Promise<IConnec
|
||||
port: Number(process.env.MARIADB_Port),
|
||||
dropSchema: true,
|
||||
synchronize: true,
|
||||
entities: [path.resolve(filesOrgPath, '*.js')],
|
||||
entities: [path.resolve(filesOrgPath, '*.ts')],
|
||||
name: 'mariadb'
|
||||
}
|
||||
const conn = await createConnection(connOpt)
|
||||
@ -285,7 +285,7 @@ export async function createOracleDBModels(filesOrgPath: string): Promise<IConne
|
||||
username: String(process.env.ORACLE_Username),
|
||||
port: Number(process.env.ORACLE_Port),
|
||||
synchronize: true,
|
||||
entities: [path.resolve(filesOrgPath, '*.js')],
|
||||
entities: [path.resolve(filesOrgPath, '*.ts')],
|
||||
name: 'oracle',
|
||||
}
|
||||
const conn = await createConnection(connOpt)
|
||||
|
@ -12,11 +12,11 @@
|
||||
"stripInternal": true,
|
||||
"strictNullChecks": true,
|
||||
"moduleResolution": "node",
|
||||
"outDir": "dist",
|
||||
"newLine": "LF",
|
||||
"lib": [
|
||||
"es2017"
|
||||
]
|
||||
],
|
||||
"resolveJsonModule": true,
|
||||
},
|
||||
"include": [
|
||||
"src",
|
||||
|
Loading…
Reference in New Issue
Block a user