Skip to content

Commit

Permalink
fix: commands to use correct constructor arguments for ace base command
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Dec 30, 2019
1 parent 07ab293 commit e0e48bf
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 65 deletions.
6 changes: 3 additions & 3 deletions commands/MakeMigration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { join } from 'path'
import camelCase from 'camelcase'
import { snakeCase } from 'snake-case'
import { inject } from '@adonisjs/fold'
import { BaseCommand, args, flags } from '@adonisjs/ace'
import { BaseCommand, Kernel, args, flags } from '@adonisjs/ace'
import { DatabaseContract } from '@ioc:Adonis/Lucid/Database'
import { ApplicationContract } from '@ioc:Adonis/Core/Application'

Expand Down Expand Up @@ -61,8 +61,8 @@ export default class MakeMigration extends BaseCommand {
loadApp: true,
}

constructor (app: ApplicationContract, private _db: DatabaseContract) {
super(app)
constructor (app: ApplicationContract, kernel: Kernel, private _db: DatabaseContract) {
super(app, kernel)
}

/**
Expand Down
6 changes: 3 additions & 3 deletions commands/Migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* file that was distributed with this source code.
*/

import { flags } from '@adonisjs/ace'
import { inject } from '@adonisjs/fold'
import { flags, Kernel } from '@adonisjs/ace'
import { DatabaseContract } from '@ioc:Adonis/Lucid/Database'
import { ApplicationContract } from '@ioc:Adonis/Core/Application'

Expand Down Expand Up @@ -37,8 +37,8 @@ export default class Migrate extends MigrationsBase {
loadApp: true,
}

constructor (app: ApplicationContract, private _db: DatabaseContract) {
super(app)
constructor (app: ApplicationContract, kernel: Kernel, private _db: DatabaseContract) {
super(app, kernel)
}

/**
Expand Down
6 changes: 3 additions & 3 deletions commands/Rollback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* file that was distributed with this source code.
*/

import { flags } from '@adonisjs/ace'
import { inject } from '@adonisjs/fold'
import { flags, Kernel } from '@adonisjs/ace'
import { DatabaseContract } from '@ioc:Adonis/Lucid/Database'
import { ApplicationContract } from '@ioc:Adonis/Core/Application'

Expand Down Expand Up @@ -42,8 +42,8 @@ export default class Migrate extends MigrationsBase {
loadApp: true,
}

constructor (app: ApplicationContract, private _db: DatabaseContract) {
super(app)
constructor (app: ApplicationContract, kernel: Kernel, private _db: DatabaseContract) {
super(app, kernel)
}

/**
Expand Down
6 changes: 3 additions & 3 deletions commands/Status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import columnify from 'columnify'
import { inject } from '@adonisjs/fold'
import { BaseCommand, flags } from '@adonisjs/ace'
import { BaseCommand, flags, Kernel } from '@adonisjs/ace'
import { DatabaseContract } from '@ioc:Adonis/Lucid/Database'
import { ApplicationContract } from '@ioc:Adonis/Core/Application'
import { MigrationListNode } from '@ioc:Adonis/Lucid/Migrator'
Expand All @@ -34,8 +34,8 @@ export default class Status extends BaseCommand {
loadApp: true,
}

constructor (app: ApplicationContract, private _db: DatabaseContract) {
super(app)
constructor (app: ApplicationContract, kernel: Kernel, private _db: DatabaseContract) {
super(app, kernel)
}

/**
Expand Down
82 changes: 44 additions & 38 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@
},
"homepage": "https://github.com/adonisjs/adonis-lucid#readme",
"dependencies": {
"@adonisjs/application": "^1.3.2",
"@adonisjs/logger": "^1.1.7",
"@adonisjs/profiler": "^1.2.4",
"@poppinss/traits": "^1.0.1",
"@poppinss/utils": "^2.1.1",
"camelcase": "^5.3.1",
Expand All @@ -58,9 +55,12 @@
"@adonisjs/core": "2.x.x"
},
"devDependencies": {
"@adonisjs/ace": "^6.7.5",
"@adonisjs/fold": "^6.2.3",
"@adonisjs/ace": "^6.8.0",
"@adonisjs/application": "^1.3.2",
"@adonisjs/fold": "^6.3.0",
"@adonisjs/logger": "^1.1.7",
"@adonisjs/mrm-preset": "^2.2.3",
"@adonisjs/profiler": "^1.2.4",
"@adonisjs/sink": "^2.4.2",
"@poppinss/dev-utils": "^1.0.3",
"@types/dotenv": "^8.2.0",
Expand Down
15 changes: 8 additions & 7 deletions test/commands/make-migration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import test from 'japa'
import 'reflect-metadata'
import { join } from 'path'
import { Kernel } from '@adonisjs/ace'
import { Filesystem } from '@poppinss/dev-utils'
import { Application } from '@adonisjs/application/build/standalone'

Expand Down Expand Up @@ -52,7 +53,7 @@ test.group('MakeMigration', (group) => {
const app = new Application(fs.basePath, {} as any, {} as any, {})
app.environment = 'test'

const makeMigration = new MakeMigration(app, db)
const makeMigration = new MakeMigration(app, new Kernel(app), db)
makeMigration.name = 'users'
await makeMigration.handle()

Expand All @@ -76,7 +77,7 @@ test.group('MakeMigration', (group) => {
const app = new Application(fs.basePath, {} as any, {} as any, {})
app.environment = 'test'

const makeMigration = new MakeMigration(app, db)
const makeMigration = new MakeMigration(app, new Kernel(app), db)
makeMigration.name = 'users'
makeMigration.table = 'my_users'

Expand All @@ -102,7 +103,7 @@ test.group('MakeMigration', (group) => {
const app = new Application(fs.basePath, {} as any, {} as any, {})
app.environment = 'test'

const makeMigration = new MakeMigration(app, db)
const makeMigration = new MakeMigration(app, new Kernel(app), db)
makeMigration.name = 'users'
makeMigration.create = 'my_users'

Expand All @@ -128,7 +129,7 @@ test.group('MakeMigration', (group) => {
const app = new Application(fs.basePath, {} as any, {} as any, {})
app.environment = 'test'

const makeMigration = new MakeMigration(app, db)
const makeMigration = new MakeMigration(app, new Kernel(app), db)
makeMigration.name = 'profile/users'

await makeMigration.handle()
Expand All @@ -153,7 +154,7 @@ test.group('MakeMigration', (group) => {
const app = new Application(fs.basePath, {} as any, {} as any, {})
app.environment = 'test'

const makeMigration = new MakeMigration(app, db)
const makeMigration = new MakeMigration(app, new Kernel(app), db)
makeMigration.name = 'profile/users'
makeMigration.connection = 'foo'

Expand All @@ -179,7 +180,7 @@ test.group('MakeMigration', (group) => {

const customDb = new Database(config, getLogger(), getProfiler())

const makeMigration = new MakeMigration(app, customDb)
const makeMigration = new MakeMigration(app, new Kernel(app), customDb)
makeMigration.name = 'users'

makeMigration.prompt.on('prompt', (prompt) => {
Expand Down Expand Up @@ -219,7 +220,7 @@ test.group('MakeMigration', (group) => {

const customDb = new Database(config, getLogger(), getProfiler())

const makeMigration = new MakeMigration(app, customDb)
const makeMigration = new MakeMigration(app, new Kernel(app), customDb)
makeMigration.name = 'users'
makeMigration.folder = 'database/c'

Expand Down
Loading

0 comments on commit e0e48bf

Please sign in to comment.