Skip to content

Commit

Permalink
fix(rollup): remove allowSyntheticDefaultImports
Browse files Browse the repository at this point in the history
Closes #14

Signed-off-by: Will Soto <willsoto@users.noreply.github.com>
  • Loading branch information
willsoto committed Feb 24, 2019
1 parent b4ff635 commit e860356
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 16 deletions.
11 changes: 8 additions & 3 deletions lib/core.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DynamicModule, Provider } from "@nestjs/common";
import knex from "knex";
import * as Knex_ from "knex";
import { Model } from "objection";
import {
KNEX_CONNECTION,
Expand All @@ -13,10 +13,14 @@ import {
ObjectionModuleOptionsFactory
} from "./interfaces";

// Workaround due to https://github.com/rollup/rollup/issues/670
const Knex = Knex_;

export class ObjectionCoreModule {
public static forRoot(options: ObjectionModuleOptions): DynamicModule {
const BaseModel = options.Model || Model;
const connection = knex(options.config);
// eslint-disable-next-line new-cap
const connection = Knex(options.config);

BaseModel.knex(connection);

Expand Down Expand Up @@ -53,7 +57,8 @@ export class ObjectionCoreModule {
provide: KNEX_CONNECTION,
inject: [OBJECTION_MODULE_OPTIONS],
useFactory(objectionModuleOptions: ObjectionModuleOptions) {
return knex(objectionModuleOptions.config);
// eslint-disable-next-line new-cap
return Knex(objectionModuleOptions.config);
}
};

Expand Down
6 changes: 3 additions & 3 deletions lib/interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Type } from "@nestjs/common";
import { ModuleMetadata } from "@nestjs/common/interfaces";
import knex from "knex";
import * as Knex from "knex";
import { Model } from "objection";

export interface ObjectionModuleOptions {
Model?: typeof Model;
config: knex.Config;
config: Knex.Config;
}

export interface ObjectionModuleOptionsFactory {
Expand All @@ -26,4 +26,4 @@ export interface ObjectionModuleAsyncOptions
): Promise<ObjectionModuleOptions> | ObjectionModuleOptions;
}

export type Connection = knex;
export type Connection = Knex;
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@nestjs/core": "~5.7.3",
"@nestjs/testing": "~5.7.3",
"@types/jest": "~24.0.6",
"@typescript-eslint/eslint-plugin": "~1.4.0",
"@typescript-eslint/eslint-plugin": "~1.4.1",
"@willsoto/eslint-config-base": "~1.4.2",
"babel-jest": "~24.1.0",
"conventional-github-releaser": "~3.1.2",
Expand All @@ -30,7 +30,7 @@
"prettier": "~1.16.4",
"reflect-metadata": "~0.1.13",
"rimraf": "~2.6.3",
"rollup": "~1.2.2",
"rollup": "~1.2.3",
"rollup-plugin-eslint": "~5.0.0",
"rollup-plugin-filesize": "~6.0.1",
"rollup-plugin-typescript": "~1.0.0",
Expand Down Expand Up @@ -82,7 +82,7 @@
"lint": "eslint lib --ext ts --fix",
"postbuild": "yarn typings",
"postrelease": "conventional-github-releaser -p angular",
"prebuild": "yarn lint && yarn clean",
"prebuild": "yarn clean",
"prerelease": "yarn build",
"pretypings": "rimraf typings",
"release": "standard-version --sign --message 'chore(release): %s [skip ci]'",
Expand Down
9 changes: 5 additions & 4 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@ export default {
banner: `
/**
*
* NestJS Objection
* ${pkg.name}@${pkg.version}
* ${pkg.license}
*
*/
`
*/`
})),
external: Object.keys(globals),
plugins: [
eslint(),
eslint({
throwOnWarning: true,
throwOnError: true
}),
typescript({
tsconfig: "./tsconfig.build.json"
}),
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"baseUrl": ".",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@
resolved "https://registry.npmjs.org/@types/node/-/node-10.12.21.tgz#7e8a0c34cf29f4e17a36e9bd0ea72d45ba03908e"
integrity sha512-CBgLNk4o3XMnqMc0rhb6lc77IwShMEglz05deDcn2lQxyXEZivfwgYJu7SMha9V5XcrP6qZuevTHV/QrN2vjKQ==

"@typescript-eslint/eslint-plugin@~1.4.0":
"@typescript-eslint/eslint-plugin@~1.4.1":
version "1.4.1"
resolved "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-1.4.1.tgz#f752a6888a957fd411c7bcada11884c4257d374a"
integrity sha512-+7wRNSKK+flJR0pOcGuTP2QwoJYJ91jdZV8Hm0IwVAWTqww8Jt5sN7r/Mlf2oFmDcO8jpM3ajsZCHJ4MmBMRjA==
Expand Down Expand Up @@ -6818,7 +6818,7 @@ rollup-pluginutils@^2.3.0, rollup-pluginutils@^2.3.1:
estree-walker "^0.5.2"
micromatch "^2.3.11"

rollup@~1.2.2:
rollup@~1.2.3:
version "1.2.3"
resolved "https://registry.npmjs.org/rollup/-/rollup-1.2.3.tgz#450bbbd9d3c2c9a17d23c9165cab7a659f91095a"
integrity sha512-hTWFogj/Z077imG9XRM1i43ffarWNToDgsqkU62eJRX4rJE213/c8+gUIf4xacfzytl0sjJZfCzzPQfZN7oIQg==
Expand Down

0 comments on commit e860356

Please sign in to comment.