I am starting to experiment with the Salesforce DX development workflow and I am curious about the best practice for code development (Apex classes, VF pages, etc.) and compiling on an actual SF server. Does it make sense to connect a MavensMate / Force IDE project to each new scratch org so that the new code can be compiled and verified for dependencies? Local editing of these components does work but it makes it very hard when there are other new metadata dependencies. For example, the force:source:push command appears to generically fail in the Force IDE 2 when there is a code related error.
1 Answer
From my understanding reading the documentation and doing the trailhead the scratch org is meant to be in your development process. So each of your projects should have a matching scratch org. They are meant to be transient, expire in 7 days and are deleted so make sure you "pull" your changes to your IDE. You can also delete scratch orgs yourself from the CLI and DevHub.
As far as the "push" failing when there is a code error, that is true even with the current(pre-DX) IDE so that is nothing new.
Unlike the current process (pre-DX) which has the org as your version of truth, in DX the code is the artifact you create but you need the scratch org to help create it.
The scratch org provides you a place to do the click-configure part of development and then you "pull" those changes to your code in the IDE. So when you're done your "code" in the IDE has everything, your clicks and your code and that is the artifact you commit to source control and promoted to other environments.
As far as I know there is no way to compile the code without a Salesforce org.