Created
January 8, 2019 23:37
-
-
Save dcarroll/d21fe05fb12281ffcafc5e51507e0880 to your computer and use it in GitHub Desktop.
Script to migrate Eclipse/Metadata format project to SFDX Source format project.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -eq 0 ] | |
then | |
echo "No arguments supplied, please supply the project directory, the source directory within the project directory and optionally 'yes' to preserve the original metadata." | |
exit 1 | |
fi | |
if [ -z "$2" ] | |
then | |
echo "Need additional arguments, please supply the project directory, the source directory within the project director and optional 'yes' to preserve the original metadata." | |
exit 1 | |
fi | |
proj_folder="`cd "${1}";pwd`" | |
src_folder="`cd "${2}";pwd`" | |
echo " ===> Changing to project folder "$proj_folder"..." | |
cd $proj_folder | |
echo " ===> Creating SFDX project..." | |
sfdx force:project:create -n migrate >/dev/null | |
cd migrate | |
echo " ===> Converting MDAPI format to source format..." | |
oldSpinnerValue=$FORCE_SHOW_SPINNER | |
export FORCE_SHOW_SPINNER= | |
mditems="`sfdx force:mdapi:convert -d force-app -r $src_folder --json | jq '.result | length'`" | |
export FORCE_SHOW_SPINNER=$oldSpinnerValue | |
echo " ===> Converted "$mditems" metadata items..." | |
cd .. | |
echo " ===> Moving the SFDX project contents to the orginal project folder..." | |
cp -R migrate/. . | |
rm -rf migrate | |
if [ -z "$3" ] | |
then | |
echo " ===> Removing the original source folder..." | |
rm -rf $src_folder | |
fi | |
echo "Done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment