Skip to content

T-020: Barrel file not using custom directories - #5183

Merged
thetutlage merged 3 commits into
7.xfrom
task/T-020
Nov 30, 2026
Merged

thetutlage merged 3 commits into
7.xfrom
task/T-020

Conversation

@fleet-panda

@fleet-panda fleet-panda Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #5133

Goal

The barrel files of indexEntities() use the folders in directories of adonisrc.ts. An app that moves a folder, for example httpControllers, no longer gives the same folder again in indexEntities().

Deployment requirements

  1. Release @adonisjs/assembler, minor (8.7.0). Merge T-020: Barrel file not using custom directories assembler#132 first.
  2. After the assembler release, and before the merge of the core pull request: in core on task/T-020, run npm install -D @adonisjs/assembler@^8.7.0, and commit package-lock.json. Until then, the checks of the core pull request fail, because npm install cannot resolve ^8.7.0.
  3. Release @adonisjs/core, minor, after assembler. Its release notes name the app that sets a folder in directories but keeps its files in the old app/* folder. The fix for that app: give source to indexEntities(), or correct directories.
  4. Merge the v7-docs pull request after the core release.

Acceptance criteria

  • directories.httpControllers set to src/http/controllers, no source: node ace serve writes .adonisjs/server/controllers.ts from src/http/controllers. Test: tests/commands/serve.spec.ts, "generate controllers barrel file from the httpControllers directory". Pass.
  • The same for events, listeners and transformers. Tests: tests/index_generator.spec.ts, group "Index generator | rc file directories", one test for each folder, with the files in a custom folder and a file in the old app/* folder that must not show. Pass.
  • The same for node ace build, node ace test and node ace codegen. Tests: "generate controllers barrel file from the httpControllers directory" in tests/commands/build.spec.ts and tests/commands/test.spec.ts, and "generate the controllers index file from the httpControllers directory" in tests/commands/codegen.spec.ts. Pass. The codegen test fails when the command does not pass directories.
  • A source of the app comes first. Test: "give precedence to an explicit source over the rc file directories". Pass.
  • A parent with no options uses the old app/* folders. Test: "use the app directories when the parent has no options". Pass.
  • core imports no services/* module. git diff origin/7.x -- src commands adds no import.
  • guides/concepts/barrel_files.md of v7-docs says that the barrel files use the folders in directories, and that source overrides them. The screenshots are below.

Checks

  • assembler: npm run lint, npm run typecheck, npm run quick:test (312 passed).
  • core: npm run lint, npm run typecheck (with the new assembler build in node_modules), npm run quick:test (354 passed).
  • v7-docs: npm run lint, npm run typecheck.

Screenshots

Barrel files page, section "Source directories", the directories example, desktop 1280 px:

Barrel files page, source directories

Barrel files page, section "Source directories", the text about the #controllers/* subpath import as normal text, with no tip block, desktop 1280 px:

Barrel files page, package.json text

Barrel files page, the source option example, desktop 1280 px:

Barrel files page, source option

AdonisRC file reference page, section "directories", desktop 1280 px:

AdonisRC file reference, directories

Context changes

  • File: context/rules/imports.md.
    • Old text: none.
    • New text: "An assembler hook of core reads the folders of the rc file from parent.options.directories. The commands serve, build, test and codegen give them to the assembler."
    • Reason: a future hook that needs a folder of the rc file must use this way, not services/app.

Discovered work

None.

@fleet-panda

fleet-panda Bot commented Nov 30, 2026

Copy link
Copy Markdown
Contributor Author

Triage: nothing to do. Each failed check stops at npm install with ETARGET for @adonisjs/assembler@^8.7.0, which is not on npm yet. They pass after the release of assembler 8.7.0 and the update of package-lock.json, as the task gives in its deployment requirements.

Comment thread src/assembler_hooks/index_entities.ts Resolved
Comment thread src/assembler_hooks/index_entities.ts Resolved
@fleet-panda

fleet-panda Bot commented Nov 30, 2026

Copy link
Copy Markdown
Contributor Author

Triage: rework. The review asks for two changes in run() of src/assembler_hooks/index_entities.ts: type directories with the rc file type of @adonisjs/application, and use an empty object when the parent gives no directories, so that the code has no optional chaining. The failed checks stop at npm install with ETARGET for @adonisjs/assembler@^8.7.0, as the earlier triage said. The pull request is a draft until the build hands it back. Do not merge it before then.

Give the directories the type of the rc file from @adonisjs/application, and default them to an empty object, so the sources need no optional chaining.
@fleet-panda

fleet-panda Bot commented Nov 30, 2026

Copy link
Copy Markdown
Contributor Author

Triage: nothing to do. Commit de414ebe makes the two changes of the review. Each failed check on it stops at npm install with ETARGET for @adonisjs/assembler@^8.7.0, which is not on npm yet, as step 2 of the deployment requirements of the task gives.

@fleet-panda

fleet-panda Bot commented Nov 30, 2026

Copy link
Copy Markdown
Contributor Author

Triage: rework. The review of the task asks for a change in adonisjs/v7-docs#117, and this pull request does not change. The failed checks on de414ebe stop at npm install with ETARGET for @adonisjs/assembler@^8.7.0, as the earlier triage said. The pull request is a draft until the build hands it back. Do not merge it before then.

@fleet-panda

fleet-panda Bot commented Nov 30, 2026

Copy link
Copy Markdown
Contributor Author

Triage: nothing to do. Each failed check on de414ebe stops at npm install with ETARGET for @adonisjs/assembler@^8.7.0. adonisjs/assembler#132 is merged, but npm still has 8.6.1 as the latest version. After the release of assembler 8.7.0, step 2 of the deployment requirements updates package-lock.json, and the checks can pass.

@thetutlage
thetutlage merged commit aeed0d5 into 7.x Nov 30, 2026
18 checks passed
@thetutlage
thetutlage deleted the task/T-020 branch November 30, 2026 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Barrel file not using custom directories

1 participant