[SalesForce] SFDX force:source:push to Scratch Org with selected path

I have two source folders in my project – force-app and sudipta-app. I have mentioned the same into sfdx-project.json as well like –

{
  "packageDirectories": [
    {
      "path": "force-app",
      "default": true
    },
    {
      "path": "sudipta-app",
      "default": false
    }
  ],
  "namespace": "",
  "sfdcLoginUrl": "https://login.salesforce.com",
  "sourceApiVersion": "48.0"
}

Now when I am trying to push source to my default scratch org, it always pushes code from force-app folder, not from sudipta-app folder. Is there any way I can mention which path to consider while pushing code into scratch org?

Command I am running:

sfdx force:source:push

Best Answer

The command sfdx force:source:push should work fine today.

Adding CLI support for metadata types that have a decomposed (or source) format for the force:source:deploy, force:source:retrieve, force:source:delete commands is Work in progress.

You can get early access to it by checking here

Note that since it is in DEV preview there won't be any support via support cases, however, you can raise any issues in the git repo and will be addressed.

There are some caveats you will need to remember with this feature

  • force:source:push follow deployment order indicated in the sfdx-project.json in package directories. If the dependencies are not maintained in that order force source push fails.

    • An example for this lets say if you move a field to the a new directory and the old directory still has a reference to the previous field in profile or permissionset or layout metadata the force:source:push will fail.
  • Weird state encountered if the metadata is reorganized into multiple folders and not started with fresh scratch orgs. Reorganize and then always test force:source:push with a new scratch org before source is versioned.

    • If you have existing scratch org and in the local project directory if one reorganizes metadata, one can get into weird state.