I want to write some code that will be executed on npm postinstall only if the package is installed globally. Is there a built-in solution to detect if the active package is installed globally?
If not then what is the best workaround that will work on any OS? My only idea currently is to check the current working directory of the package and check if its under the global npm path.