Skip to content

Instantly share code, notes, and snippets.

@msrivastav13
Created November 4, 2018 00:33
Show Gist options
  • Save msrivastav13/0a0c66745937301b4497d455f1f31bf9 to your computer and use it in GitHub Desktop.
Save msrivastav13/0a0c66745937301b4497d455f1f31bf9 to your computer and use it in GitHub Desktop.
Retrieves the source in DX format from the unmanaged package
#!/bin/bash
if [ $# -lt 1 ]
then
echo Usage: retrieveDXSource.sh orgalias packageName
exit
fi
## Retrieve the PackageXML from Unmanaged Container
sfdx force:mdapi:retrieve -s -r ./mdapipkg -u $1 -p "$2" # Retrieve Metadata API Source from Package Name
unzip -o -qq ./mdapipkg/unpackaged.zip -d ./mdapipkg # Unzip the file
rm -rf ./manifest/ # If manifest directory exists delete it
mkdir ./manifest/ # Create a New Manifest Directory
cp -a ./mdapipkg/package.xml ./manifest/ # Copy package.XML to manifest directory
sfdx force:mdapi:convert -r ./mdapipkg -d ./force-app/ #Convert Source from mdapi to the DX format and push to default
rm -rf ./mdapipkg # Delete the mdapipkg source
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment