There are couple of ways to approach that.
Sitecore allows you to create a package definition as an XML file and then build a package from that definition. You can access package definition from the "Start menu" in the Desktop view and then go to Development Tools and Package Designer.
If you want to create the package:
- Create the package definition using the designer or load it if it already exists
- If you are creating package definition add all the trees your module consists of (eg.
/sitecore/layout/renderings/feature/navigation
and /sitecore/templates/feature/navigation
) so all the child items are automatically included
- Build & download the package
If you want to automate the whole process you can use PowerShell script to create packages:
$package = New-Package "Packing in Powerful Ways";
# Set package metadata
$package.Sources.Clear();
$package.Metadata.Author = "Your Name";
$package.Metadata.Publisher = "Your Company";
$package.Metadata.Version = "1.0";
$package.Metadata.Readme = 'Some description'
# Add contnet/home to the package
$source = Get-Item 'master:\layout\renderings\feature\ModuleName' | New-
ItemSource -Name 'Module Name Renderings' -InstallMode Overwrite
$package.Sources.Add($source);
# Save package
Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -Zip
# Offer the user to download the package
Download-File "$SitecorePackageFolder\$($package.Name)-$($package.Metadata.Version).zip"
Script will be much more powerful as you can adjust it to run for every module and can be triggered using PowerShell remoting.
See the Sitecore PowerShell docs for more information.
Downsides of using the packages
Using package might seem easier but remember that packages are binary files and are hard to version. Serialization (tools suggested by @Rauman Gupth) allows you to convert items into text format which are easier to version.