Repository navigation
T-020: Barrel file not using custom directories - #5183
Conversation
|
Triage: nothing to do. Each failed check stops at |
|
Triage: rework. The review asks for two changes in |
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.
|
Triage: nothing to do. Commit |
|
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 |
|
Triage: nothing to do. Each failed check on |
Fixes #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.