How to pack the desktop app into a .dmg or .exe file?

This is a duplicate question
But I can't open the previous answer

Hi, I'm to node development and I want to add more features to joplin. Currently I've successfully running npm install and npm start.

Now I want to find a simple way to build the desktop version into an executable file, but I couldn't find any instructions in the doc and readme files.

So, how can I build the desktop version into an executable .dmg or .exe file?

The instructions are in BUILD.md, you should be using yarn rather than npm to install.

You just need to run yarn dist in the package you want to build and the binary will be in the dist folder.
It will only create for the platform you are running it on though (i.e. .dmg will only be created if you build on macOS).