macoselectronelectron-buildermac-app-store

How to find if Electron app is a MAC or MAS Build?


Is there a way to have an is-MAS for Mac Store builds in Electron? I tried looking through the package.json or even a build flag but no luck as of yet. I want to be able to have conditional content that's based on where the user downloads an electron app (Mac Store, Website, etc.).

Thanks in Advance


Solution

  • You can use the process.mas property at run time to test whether an app has been specifically built for the Mac App Store:

    process.mas Readonly

    A Boolean. For Mac App Store build, this property is true, for other builds it is undefined.

    So, a simple isMAS function could be defined as:

    function isMAS()
    {
        return process.mas || false;
    }