I'm working on an npm package initializer, that is, a program that runs when the user runs the npm init <my-package-initializer> command.
npm is not the only package manager for Node.js any more, yarn is also quite popular and pnpm is a personal favorite of mine and I want to support all three. The easy way is to ask the user which package manager they prefer or provide a command-line switch like CRA does.
But the user has already shown their preference by running, say, yarn create instead of npm init. It feels annoying to ask again. We could just check if yarn or pnpm is our parent process.
Is there a cross-platform way to get this information?