Build of this native module should be made inside of the client-sdk for all supported platforms except win32.
For win32 we can just copy this vn-player folder to some Windows box and build it there. In such a case all needed
precompiled binaries will be downloaded automatically.
The result of the build are native modules for the node and for the electron,
which must be packetized and placed on the public available HTTPS-capable host.
All stages will be considered in detail below.


--- REQUIREMENTS ---
- Prebuilt client-sdk and 3rdparty libraries for the desired platform and architecture.
- NodeJS installed
- build environment

Also please note that build is slightly different depending on the platform.


********** For *nix-like including MacOS and Linux **********

--- BUILD ---
cd client-sdk/src/nodejs/vn-player
npm install --build-from-source
./node_modules/.bin/node-pre-gyp rebuild --runtime=electron --target=9.0.0-beta.16 --dist-url=https://atom.io/download/atom-shell

--- PACKAGE ---
npm pack
./node_modules/.bin/node-pre-gyp package
./node_modules/.bin/node-pre-gyp package --runtime=electron --target=9.0.0-beta.16


********** For Windows **********
First of all let's prepare build environment.
Simply open Powershell or Git Bash with administrator privileges and execute (it is assumed that the NodeJS is already installed):

npm install --global --production windows-build-tools

Once installed you still need to set PYTHON environment variable. Validate Python is indeed found in the correct folder:
"%USERPROFILE%\.windows-build-tools\python27\python.exe"

If so, create your (user) environment variable:
setx PYTHON "%USERPROFILE%\.windows-build-tools\python27\python.exe"

Restart cmd, and verify that variable exists via set PYTHON which should return the variable.

After such preparatory steps, let's proceed to build native module itself.


cd vn-player
npm install optional-dev-dependency
node_modules\.bin\optional-dev-dependency   # to download prebuilt client-sdk
npm install --build-from-source
node_modules\.bin\node-pre-gyp rebuild --runtime=electron --target=9.0.0-beta.16 --dist-url=https://atom.io/download/atom-shell

--- PACKAGE ---
npm pack
node_modules\.bin\node-pre-gyp package
node_modules\.bin\node-pre-gyp package --runtime=electron --target=9.0.0-beta.16



As a result we have one tarball in ./ and two in build/stage .
We need to copy them manually to the public available HTTPS-capable host.
I chose our ftp for this purpose: ftp.videonext.net

Examples for x86_64-darwin arch:

scp vn-player-1.0.3.tgz <user>@ftp.videonext.net:/ftp/data/private/native-addons/
scp build/stage/node-darwin-x64.tar.gz <user>@ftp.videonext.net:/ftp/data/private/native-addons/vn_player/v1.0.3/
scp build/stage/electron-darwin-x64.tar.gz <user>@ftp.videonext.net:/ftp/data/private/native-addons/vn_player/v1.0.3/

After this is done, we can use our native module by adding it via url to some package.json:

...
"dependencies": {
    "vn-player": "https://ftp.videonext.net/private/native-addons/vn-player-1.0.3.tgz",
...


--- TEST ---
You can run the test script using any of the following commands:

npm test
node test.js


--- PREPARE SDK PREBUILT ---
This step relates more for win32 platform.
First of all build the sdk briefly like this (build environment must be configured, including installed mingw32 compiler, cmake, etc...):

cd client-sdk/3rdparty/src/
./build.sh x86_64-mingw32
cd ../../build
make -f x86_64-mingw32.mak

After that we need to pack our prebuilt package, put it to ftp and add to or update vn-player package.json optional dev dependencies like this:

cd ../src/nodejs/vn-player/sdk
BUILD_TARGET=x86_64-mingw32 npm pack
scp vn-sdk-prebuilt-x86_64-mingw32-<12 SYMBOLS FROM LAST GIT COMMIT>-1.0.0.tgz <user>@ftp.videonext.net:/ftp/data/private/native-addons/

...
"optionalDevDependencies": {
    "vn-sdk-prebuilt": "https://ftp.videonext.net/private/native-addons/vn-sdk-prebuilt-x86_64-mingw32-1db9df11b63a-1.0.0.tgz"
}
...


Good luck!;)
