You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
T-020: Barrel file not using custom directories - #117
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().
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.
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.
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, section "Source directories", the text about the #controllers/* subpath import as normal text, with no tip block, desktop 1280 px:
Barrel files page, the source option example, desktop 1280 px:
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.
Triage: rework. The review of the task asks for changes in adonisjs/core#5183, and this pull request does not change. The pull request is a draft until the build hands it back. Do not merge it before then.
Triage: rework. The review asks to write the text about the #controllers/* subpath import as normal text of the section "Source directories", not in a :::tip block. The pull request is a draft until the build hands it back. Do not merge it before then.
Triage: nothing to do. The only change is commit 0bd51ed, the rework of the build for the review comment on the tip block, and no new review or comment asks for more. The Cloudflare Pages deploy of the commit is still pending.
Triage: nothing to do. This pull request has no new review, comment or commit. The only changes are the failed checks of adonisjs/core#5183, which wait for the release of @adonisjs/assembler 8.7.0.
Triage: nothing to do. The only change is the approval of thetutlage, with no findings. Its deployment requirements say to merge it after the release of @adonisjs/core.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of adonisjs/core#5133
Goal
The barrel files of
indexEntities()use the folders indirectoriesofadonisrc.ts. An app that moves a folder, for examplehttpControllers, no longer gives the same folder again inindexEntities().Deployment requirements
@adonisjs/assembler, minor (8.7.0). Merge T-020: Barrel file not using customdirectoriesassembler#132 first.assemblerrelease, and before the merge of thecorepull request: incoreontask/T-020, runnpm install -D @adonisjs/assembler@^8.7.0, and commitpackage-lock.json. Until then, the checks of thecorepull request fail, becausenpm installcannot resolve^8.7.0.@adonisjs/core, minor, afterassembler. Its release notes name the app that sets a folder indirectoriesbut keeps its files in the oldapp/*folder. The fix for that app: givesourcetoindexEntities(), or correctdirectories.v7-docspull request after thecorerelease.Acceptance criteria
directories.httpControllersset tosrc/http/controllers, nosource:node ace servewrites.adonisjs/server/controllers.tsfromsrc/http/controllers. Test:tests/commands/serve.spec.ts, "generate controllers barrel file from the httpControllers directory". Pass.events,listenersandtransformers. 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 oldapp/*folder that must not show. Pass.node ace build,node ace testandnode ace codegen. Tests: "generate controllers barrel file from the httpControllers directory" intests/commands/build.spec.tsandtests/commands/test.spec.ts, and "generate the controllers index file from the httpControllers directory" intests/commands/codegen.spec.ts. Pass. The codegen test fails when the command does not passdirectories.sourceof the app comes first. Test: "give precedence to an explicit source over the rc file directories". Pass.optionsuses the oldapp/*folders. Test: "use the app directories when the parent has no options". Pass.coreimports noservices/*module.git diff origin/7.x -- src commandsadds no import.guides/concepts/barrel_files.mdofv7-docssays that the barrel files use the folders indirectories, and thatsourceoverrides 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 newassemblerbuild innode_modules),npm run quick:test(354 passed).v7-docs:npm run lint,npm run typecheck.Screenshots
Barrel files page, section "Source directories", the
directoriesexample, desktop 1280 px: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, the
sourceoption example, desktop 1280 px:AdonisRC file reference page, section "directories", desktop 1280 px:
Context changes
context/rules/imports.md.corereads the folders of the rc file fromparent.options.directories. The commandsserve,build,testandcodegengive them to the assembler."services/app.Discovered work
None.