The grunt task is intended to be a thin wrapper, the code not specific to grunt should live in loopback-angular, so that it can be shared by both grunt-loopback-angular and loopback-angular-cli. The logic dealing with asynchronous application bootstrap should be implemented in loopback-angular, not here.