mirror of
https://github.com/typeorm/typeorm.git
synced 2025-12-08 21:26:23 +00:00
- added gulp task to convert dummy classes to typescript on build time
- disabled additional mongoDb classes for browser builds
This commit is contained in:
parent
c0af669f7b
commit
36b7392a72
12
gulpfile.ts
12
gulpfile.ts
@ -81,6 +81,16 @@ export class Gulpfile {
|
||||
.pipe(gulp.dest("./build/browser/src/platform"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds dummy classes for disabled drivers (replacement is done via browser entry point in package.json)
|
||||
*/
|
||||
@Task()
|
||||
browserCopyDisabledDriversDummy() {
|
||||
return gulp.src("./src/platform/BrowserDisabledDriversDummy.template")
|
||||
.pipe(rename("BrowserDisabledDriversDummy.ts"))
|
||||
.pipe(gulp.dest("./build/browser/src/platform"));
|
||||
}
|
||||
|
||||
@MergedTask()
|
||||
browserCompile() {
|
||||
const tsProject = ts.createProject("tsconfig.json", {
|
||||
@ -217,7 +227,7 @@ export class Gulpfile {
|
||||
package() {
|
||||
return [
|
||||
"clean",
|
||||
["browserCopySources", "browserCopyPlatformTools"],
|
||||
["browserCopySources", "browserCopyPlatformTools", "browserCopyDisabledDriversDummy"],
|
||||
["packageCompile", "browserCompile"],
|
||||
"packageMoveCompiledFiles",
|
||||
[
|
||||
|
||||
15
package.json
15
package.json
@ -11,12 +11,15 @@
|
||||
},
|
||||
"main": "./index.js",
|
||||
"browser": {
|
||||
"./browser/driver/postgres/PostgresDriver.js": "./browser/driver/DummyDriver.js",
|
||||
"./browser/driver/oracle/OracleDriver.ts": "./browser/driver/DummyDriver.js",
|
||||
"./browser/driver/mysql/MysqlDriver.js": "./browser/driver/DummyDriver.js",
|
||||
"./browser/driver/sqlserver/SqlServerDriver.ts": "./browser/driver/DummyDriver.js",
|
||||
"./browser/driver/mongodb/MongoDriver.js": "./browser/driver/DummyDriver.js",
|
||||
"./index.js": "./browser/index.js"
|
||||
"./browser/driver/postgres/PostgresDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js",
|
||||
"./browser/driver/oracle/OracleDriver.ts": "./browser/platform/BrowserDisabledDriversDummy.js",
|
||||
"./browser/driver/mysql/MysqlDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js",
|
||||
"./browser/driver/sqlserver/SqlServerDriver.ts": "./browser/platform/BrowserDisabledDriversDummy.js",
|
||||
"./browser/driver/mongodb/MongoDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js",
|
||||
"./browser/driver/mongodb/MongoQueryRunner.js": "./browser/platform/BrowserDisabledDriversDummy.js",
|
||||
"./browser/entity-manager/MongoEntityManager.js": "./browser/platform/BrowserDisabledDriversDummy.js",
|
||||
"./browser/repository/MongoRepository.js": "./browser/platform/BrowserDisabledDriversDummy.js",
|
||||
"./index.js": "./browser/index.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@ -1,28 +0,0 @@
|
||||
/**
|
||||
* Dummy driver classes for replacement via `package.json` in browser builds.
|
||||
* Using those classes reduces the build size by one third.
|
||||
*
|
||||
* If we don't include those dummy classes (and just disable the driver import
|
||||
* with `false` in `package.json`) typeorm will throw an error on runtime,
|
||||
* even if those driver are not used.
|
||||
*/
|
||||
|
||||
export class MongoDriver {
|
||||
|
||||
}
|
||||
|
||||
export class PostgresDriver {
|
||||
|
||||
}
|
||||
|
||||
export class SqlServerDriver {
|
||||
|
||||
}
|
||||
|
||||
export class MysqlDriver {
|
||||
|
||||
}
|
||||
|
||||
export class OracleDriver {
|
||||
|
||||
}
|
||||
56
src/platform/BrowserDisabledDriversDummy.template
Normal file
56
src/platform/BrowserDisabledDriversDummy.template
Normal file
@ -0,0 +1,56 @@
|
||||
/**
|
||||
* Dummy driver classes for replacement via `package.json` in browser builds.
|
||||
* Using those classes reduces the build size by one third.
|
||||
*
|
||||
* If we don't include those dummy classes (and just disable the driver import
|
||||
* with `false` in `package.json`) typeorm will throw an error on runtime,
|
||||
* even if those driver are not used.
|
||||
*/
|
||||
|
||||
/**
|
||||
* DO NOT IMPORT THIS CLASS -
|
||||
* This is a dummy class for replacement via `package.json` in browser builds
|
||||
*/
|
||||
export class MongoDriver {}
|
||||
|
||||
/**
|
||||
* DO NOT IMPORT THIS CLASS -
|
||||
* This is a dummy class for replacement via `package.json` in browser builds
|
||||
*/
|
||||
export class MongoQueryRunner {}
|
||||
|
||||
/**
|
||||
* DO NOT IMPORT THIS CLASS -
|
||||
* This is a dummy class for replacement via `package.json` in browser builds
|
||||
*/
|
||||
export class MongoEntityManager {}
|
||||
|
||||
/**
|
||||
* DO NOT IMPORT THIS CLASS -
|
||||
* This is a dummy class for replacement via `package.json` in browser builds
|
||||
*/
|
||||
export class MongoRepository {}
|
||||
|
||||
/**
|
||||
* DO NOT IMPORT THIS CLASS -
|
||||
* This is a dummy class for replacement via `package.json` in browser builds
|
||||
*/
|
||||
export class PostgresDriver {}
|
||||
|
||||
/**
|
||||
* DO NOT IMPORT THIS CLASS -
|
||||
* This is a dummy class for replacement via `package.json` in browser builds
|
||||
*/
|
||||
export class SqlServerDriver {}
|
||||
|
||||
/**
|
||||
* DO NOT IMPORT THIS CLASS -
|
||||
* This is a dummy class for replacement via `package.json` in browser builds
|
||||
*/
|
||||
export class MysqlDriver {}
|
||||
|
||||
/**
|
||||
* DO NOT IMPORT THIS CLASS -
|
||||
* This is a dummy class for replacement via `package.json` in browser builds
|
||||
*/
|
||||
export class OracleDriver {}
|
||||
Loading…
x
Reference in New Issue
Block a user