Skip to content

Commit 46db84d

Browse files
committed
chore: update @adonisjs/lucid to version 21.7.0 and refactor make commands to handle missing module cases
1 parent 0ebd4cb commit 46db84d

File tree

3 files changed

+9
-44
lines changed

3 files changed

+9
-44
lines changed

commands/make/factory.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ export default class MMakeFactory extends MakeFactory {
1212
declare module: string
1313

1414
override async run() {
15+
if (!this.model) {
16+
return super.run()
17+
}
18+
1519
if (!checkModule(this.app, this.module)) {
1620
this.kernel.exec(`${COMMAND_PREFIX}:module`, [this.module])
1721
}

commands/make/model.ts

Lines changed: 4 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -8,49 +8,14 @@ export default class MMakeModel extends MakeModel {
88
@flags.string(MODULE_FLAG)
99
declare module: string
1010

11-
/**
12-
* Run migrations
13-
*/
14-
private async runMakeMigration() {
15-
if (!this.migration || this.exitCode) {
16-
return
17-
}
18-
19-
const makeMigration = await this.kernel.exec('make:migration', [this.name])
20-
this.exitCode = makeMigration.exitCode
21-
this.error = makeMigration.error
22-
}
23-
24-
/**
25-
* Make controller
26-
*/
27-
private async runMakeController() {
28-
if (!this.controller || this.exitCode) {
29-
return
30-
}
31-
32-
const makeController = await this.kernel.exec('make:controller', [this.name])
33-
this.exitCode = makeController.exitCode
34-
this.error = makeController.error
35-
}
36-
37-
/**
38-
* Make factory
39-
*/
40-
private async runMakeFactory() {
41-
if (!this.factory || this.exitCode) {
42-
return
43-
}
44-
45-
const makeFactory = await this.kernel.exec('make:factory', [this.name])
46-
this.exitCode = makeFactory.exitCode
47-
this.error = makeFactory.error
48-
}
49-
5011
/**
5112
* Execute command
5213
*/
5314
override async run(): Promise<void> {
15+
if (!this.module) {
16+
return super.run()
17+
}
18+
5419
if (!checkModule(this.app, this.module)) {
5520
this.kernel.exec(`${COMMAND_PREFIX}:module`, [this.module])
5621
}
@@ -60,9 +25,5 @@ export default class MMakeModel extends MakeModel {
6025
flags: this.parsed.flags,
6126
entity: this.app.generators.createEntity(this.name),
6227
})
63-
64-
await this.runMakeMigration()
65-
await this.runMakeController()
66-
await this.runMakeFactory()
6728
}
6829
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"@adonisjs/assembler": "^7.8.2",
3939
"@adonisjs/core": "^6.12.0",
4040
"@adonisjs/eslint-config": "2.0.0-beta.7",
41-
"@adonisjs/lucid": "^21.6.1",
41+
"@adonisjs/lucid": "^21.7.0",
4242
"@adonisjs/prettier-config": "^1.4.0",
4343
"@adonisjs/tsconfig": "^1.3.0",
4444
"@japa/assert": "^3.0.0",

0 commit comments

Comments
 (0)