I've setup the folder structure for a new project following the pattern identified in sfdx-isv/sfdx-falcon-template. Also see this question Two SFDX project folder structure questions for some background.
When I add e.g. a new SObject in the scratch org and use:
sfdx force:source:pull
the new components are put in a fixed folder "main/default" – there is no option to nominate the correct folder. So the folder structure is compromised.
The change I am making in the scratch org is adding a new SObject and multiple fields: no sfdx commands at present to make that easy from the command line.
(When components are already present locally in folders other than "main/default" the pull does place the changes correctly.)
Is there a work-around here apart from just sticking to using "main/default" for everything or creating everything locally so the component can be setup in the right folder?
PS
Tried the manual workaround of pulling then moving the files locally but so far no joy: the move is seen as a delete that is bad news when you next push.
Best Answer
This is by no means great, but you can force your way around this by editing the local file used to track changes.
sfdx force:source:pull
-> field gets pulled intoforce-app/main/default
.sfdx/orgs/<your_scratch_org_username>/sourcePathInfos.json
Big picture, SFDX had grand dreams of letting you organize stuff into multiple folders. But there are major bugs with the implementation, and it's been multiple years at this point and none of them are fixed. If you can just stick to one folder. If you do multiple folders, prepare to pay for it in pain.
Issues I'm aware of