Migrating Existing Projects to Salesforce DX
I spent some time after TrailheaDX excited to try converting the existing Salesforce project I work on to the DX platform. There are a plethora of great online references on Salesforce DX, the next generation of Salesforce developer experience that pushes it closer to parity with a typical development and deployment lifecycle. If you are looking to get started, Christophe Coenraets posted a step by step instructional guide on migrating an existing project to Salesforce DX today on the Salesforce Developers Blog. I also found Ben Edwards package.xml builder quite useful for this, which is part of his Salesforce Toolkit library.
While I don’t want to rehash the steps that Christophe nicely laid out, I did want to provide some assistance to anyone who ran into the same problem I had when trying to execute the steps. At the time I was working on setting up my project, I had been referencing the Salesforce DX Developer Guide Beta to understand the conversion process, outlined here and here. The issue in my case was that the ZIP file that got pulled down for the conversion process was created as unpackaged.zip, which I then unzipped to the project’s root directory. Since the DX configuration example included /unpackaged as a package directory in the sfdx-project.json file, attempting to run the migration command kept returning a vague error.
ERROR running force:mdapi:convert: Unexpected file found in package directory: /Users/welburn/sfdx/unpackaged/package.xml.
In order to remedy this, I needed to either rename my folder of unzipped assets, or remove the reference to /unpackaged as a package directory in the configuration.
Overall, the process seemed much more streamlined that I anticipated (in theory). In practice, converting an existing production-level project to DX is quite an involved process in resolving dependencies, determining which platform features you have enabled in production are and are not supported in the DX configuration (and making manual changes in the interim). However, even testing a subset of the full functionality with scratch orgs left me very excited about a future in Salesforce development that minimizes the haphazard potential of collaboration and staying in sync with others.