Skip to content

Commit

Permalink
Updated dependencies, including TypeORM 0.3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
erlendfh committed Oct 13, 2022
1 parent 4565f66 commit 29e50c2
Show file tree
Hide file tree
Showing 6 changed files with 3,858 additions and 5,609 deletions.
54 changes: 26 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,42 +32,40 @@
"typecheck": "tsc --noEmit"
},
"devDependencies": {
"@semantic-release/git": "^9.0.0",
"@semantic-release/git": "^9.0.1",
"@types/bcryptjs": "^2.4.2",
"@types/chalk": "^2.2.0",
"@types/faker": "^5.5.8",
"@types/glob": "7.1.1",
"@types/jest": "^25.2.1",
"@types/node": "13.11.1",
"@types/yargs": "^15.0.4",
"@typescript-eslint/eslint-plugin": "^2.27.0",
"@typescript-eslint/parser": "^2.27.0",
"@types/faker": "^5.5.3",
"@types/glob": "^8.0.0",
"@types/jest": "^29.0.3",
"@types/node": "16.11.65",
"@types/yargs": "^17.0.3",
"@typescript-eslint/eslint-plugin": "^5.40.0",
"@typescript-eslint/parser": "^5.40.0",
"bcryptjs": "^2.4.3",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.1",
"eslint-plugin-import": "^2.20.2",
"jest": "^25.3.0",
"prettier": "^2.0.4",
"eslint": "^8.25.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"jest": "^29.1.2",
"prettier": "^2.7.1",
"rimraf": "^3.0.2",
"semantic-release": "^17.0.4",
"sqlite": "^4.0.6",
"sqlite3": "^4.1.1",
"ts-jest": "^25.3.1",
"typeorm": "^0.2.24",
"typescript": "^3.8.3"
"semantic-release": "^19.0.5",
"sqlite": "^4.1.2",
"sqlite3": "^5.1.2",
"ts-jest": "^29.0.3",
"typeorm": "^0.3.10",
"typescript": "^4.8.4"
},
"dependencies": {
"chalk": "^4.0.0",
"faker": "5.5.3",
"glob": "7.1.6",
"ora": "4.0.3",
"reflect-metadata": "0.1.13",
"yargs": "15.3.1"
"faker": "^5.5.3",
"glob": "^8.0.3",
"mem": "^9.0.2",
"ora": "^4.0.3",
"reflect-metadata": "^0.1.13",
"yargs": "^17.6.0"
},
"peerDependencies": {
"typeorm": "^0.2.24"
},
"resolutions": {
"mem": ">=4.0.0"
"typeorm": "^0.3.10"
}
}
10 changes: 4 additions & 6 deletions sample/test/sample.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,23 @@ import { Connection } from 'typeorm'

describe('Sample Integration Test', () => {
let connection: Connection
beforeAll(async (done) => {
beforeAll(async () => {
setConnectionOptions({
type: 'sqlite',
database: ':memory:',
entities: ['sample/entities/**/*{.ts,.js}'],
})
connection = await useRefreshDatabase()
await useSeeding()
done()
})

afterAll(async (done) => {
afterAll(async () => {
await tearDownDatabase()
})

test('Should create a user with the entity factory', async (done) => {
test('Should create a user with the entity factory', async () => {
const createdUser = await factory(User)().create()
const user = await connection.getRepository(User).findOne(createdUser.id)
const user = await connection.getRepository(User).findOne({ where: { id: createdUser.id } })
expect(createdUser.firstName).toBe(user.firstName)
done()
})
})
6 changes: 3 additions & 3 deletions src/commands/seed.command.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as yargs from 'yargs'
import * as ora from 'ora'
import * as chalk from 'chalk'
import ora, { Ora } from 'ora'
import chalk from 'chalk'
import { importSeed } from '../importer'
import { loadFiles, importFiles } from '../utils/file.util'
import { runSeeder } from '../typeorm-seeding'
Expand Down Expand Up @@ -103,7 +103,7 @@ export class SeedCommand implements yargs.CommandModule {
}
}

function panic(spinner: ora.Ora, error: Error, message: string) {
function panic(spinner: Ora, error: Error, message: string) {
spinner.fail(message)
console.error(error)
process.exit(1)
Expand Down
8 changes: 4 additions & 4 deletions src/entity-factory.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as Faker from 'faker'
import { ObjectType, SaveOptions } from 'typeorm'
import { ObjectLiteral, ObjectType, SaveOptions } from 'typeorm'
import { FactoryFunction, EntityProperty } from './types'
import { isPromiseLike } from './utils/factory.util'
import { printError, printWarning } from './utils/log.util'
import { getConnectionOptions, createConnection } from './connection'

export class EntityFactory<Entity, Context> {
export class EntityFactory<Entity extends ObjectLiteral, Context> {
private mapFunction: (entity: Entity) => Promise<Entity>

constructor(
Expand Down Expand Up @@ -59,7 +59,7 @@ export class EntityFactory<Entity, Context> {
}

public async makeMany(amount: number, overrideParams: EntityProperty<Entity> = {}): Promise<Entity[]> {
const list = []
const list: Entity[] = []
for (let index = 0; index < amount; index++) {
list[index] = await this.make(overrideParams)
}
Expand All @@ -71,7 +71,7 @@ export class EntityFactory<Entity, Context> {
overrideParams: EntityProperty<Entity> = {},
saveOptions?: SaveOptions,
): Promise<Entity[]> {
const list = []
const list: Entity[] = []
for (let index = 0; index < amount; index++) {
list[index] = await this.create(overrideParams, saveOptions)
}
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"lib": ["es5", "es6"],
"lib": ["dom", "es5", "es6"],
"target": "es5",
"module": "commonjs",
"outDir": "./dist",
Expand Down
Loading

0 comments on commit 29e50c2

Please sign in to comment.