Salesforce DX and 2nd Generation Packaging are transforming the development process on the platform. Here’s a tip to help with some of the long-running processes (e.g. building a package version). You can set up your Mac OS system to fire a desktop notification when a sfdx command completes. This means you can go do something else without having to worry about checking on it.
Simply add the following to your .bashrc (which normally resides in ~/.bashrc, you can create it if it doesn’t already exist):
sfdx_notify() { sfdx "$@"; osascript -e 'display notification "Operation Complete" with title "SFDX"'; }
This defines a bash function called sfdx_notify which runs sfdx on the arguments you give it. When sfdx completes, it runs Apple’s scripting engine to display a notification. The sfdx_notify command will be available in all new interactive bash shells. If you need to use it in a shell that’s already running, just use:
source ~/.bashrc
Once sfdx_notify is available, you run it by replacing sfdx in a normal command by sfdx_notify e.g.
sfdx_notify force:package:version:create --wait 10 --path force-app --installationkeybypass
I’m sure there are smarter ways of doing this, but this makes my life easier for just one line of script, so I’m happy to leave it there.