1 | #! /usr/bin/env node
|
2 | var cp = require('child_process');
|
3 | var fs = require('fs');
|
4 |
|
5 | var nodeMajorVersion = +process.version.match(/^v(\d+)\.\d+/)[1];
|
6 |
|
7 | if (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 | }
|