For posterity, another option: Package Builder is a modern fully-supported app for the latest versions of macOS.
The Apple command line tools can be a royal pain to get things right by yourself (speaking from personal experience! ugh), and the old Packages app no longer works and was a too complicated for the vast majority of uses IMO. Package Builder is easier and also ties into building disk images too. GUI and command line.