adonisjs / adonisjs/core

Barrel file not using custom `directories`

Open
#5,133 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Type: Enhancement
Dominant language
TypeScript
Stars
19.1k
Forks
672
Avg merge
10d 23h
Merged PRs (30d)
1

Description

Package version

7.3.2

Describe the bug

Customizing httpControllers path in the adonisrc.ts file like this:


export default defineConfig({
  directories: {
    httpControllers: 'src/infrastructure/api/http/controllers',
  },
  ...
})

prevent barrel for being correctly generated unless I also edit the directory path in the indexEntities init hook:

export default defineConfig({
  ...
  hooks: {
      init: [
        indexEntities({
          controllers: { source: 'src/infrastructure/api/http/controllers' },
        }),
      ],
  },
  ...
})

Would be really cool if indexEntities was using custom directories directly.

Reproduction repo

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the indexEntities init hook and how it reads the directories setting from adonisrc.ts. Verify the behavior with a custom httpControllers path; done means the barrel is generated from that configured path without repeating it in the hook.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.