UNPKG

615 BJavaScriptView Raw
1#! /usr/bin/env node
2var cp = require('child_process');
3var fs = require('fs');
4
5var nodeMajorVersion = +process.version.match(/^v(\d+)\.\d+/)[1];
6
7if (fs.existsSync('src') && nodeMajorVersion >= 10) {
8 cp.spawnSync('npm', ['run', 'build'], { stdio: 'inherit', shell: true });
9} else {
10 if (!fs.existsSync('lib')) {
11 console.warn('BSON: No compiled javascript present, the library is not installed correctly.');
12 if (nodeMajorVersion < 10) {
13 console.warn(
14 'This library can only be compiled in nodejs version 10 or later, currently running: ' +
15 nodeMajorVersion
16 );
17 }
18 }
19}