Provide main entrypoint and generated typings to use the core as a library

This commit is contained in:
David Castro 2019-12-20 16:51:24 -08:00
parent ff637721ed
commit 53da13e043
3 changed files with 22 additions and 1 deletions

View File

@ -3,6 +3,8 @@
"version": "0.3.5",
"description": "Generates models for TypeORM from existing databases.",
"bin": "bin/typeorm-model-generator",
"main": "./dist/src/library.js",
"types": "./dist/src/library.d.ts",
"scripts": {
"start": "ts-node ./src/index.ts",
"build": "npm run clean && tsc && ncp src/templates/ dist/src/templates/ && ncp package.json dist/package.json",

19
src/library.ts Normal file
View File

@ -0,0 +1,19 @@
import { Column } from "./models/Column";
import { Entity } from "./models/Entity";
import { Index } from "./models/Index";
import { Relation } from "./models/Relation";
import { RelationId } from "./models/RelationId";
// models exports - there may be a more succinct way to export default classes,
// but this was the only one I could find that seemed happy
export type Column = Column;
export type Entity = Entity;
export type Index = Index;
export type Relation = Relation;
export type RelationId = RelationId;
export * from "./Engine";
export * from "./IConnectionOptions";
export * from "./IGenerationOptions";
export * from "./NamingStrategy";
export * from "./Utils";

View File

@ -6,7 +6,7 @@
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"declaration": false,
"declaration": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"stripInternal": true,