Skip to content

Custom commands not registered in the Commands panel #42

@jarrodek

Description

@jarrodek

Package version

@adonisjs/core: 6.12.1
AdonisJS Extension: 1.3.1

Node.js and npm version

npm: 10.8.3
node: v20.15.1

The output of running node ace list --json is the following

[
  ...,
  {
    "commandName": "mongo:fresh",
    "description": "Clears documents from all collections.",
    "help": "",
    "namespace": "mongo",
    "aliases": [],
    "flags": [],
    "args": [],
    "options": {
      "startApp": true
    },
    "filePath": "mongo_fresh.js"
  }
]

According to this line

if (!aceCommand.absoluteFilePath) return false
the custom commands are only registered when the absoluteFilePath is set on the command. However, my custom command does not have that.

This line causes the problem: https://github.com/adonisjs/ace/blob/4d5a2ea74e887ff70dd05ef153c0303b2ddeeee3/src/loaders/fs_loader.ts#L99
The file, which is the absolute path, is used to import the command, but after this function is called, the absolute path does not exist anymore. At least, that's my understanding of it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions