UNPKG

boajs

Version:

Use Python modules seamlessly in Node.js

28 lines (22 loc) 687 B
#!/usr/bin/env node 'use strict'; const { run, PLATFORM } = require('./utils'); const [ majorVersion, minorVersion ] = process.version.split('.'); if (parseInt(majorVersion.substr(1)) <= 10 && parseInt(minorVersion) < 20) { throw new TypeError(`require Node.js >= v10.20.0, but ${process.version} found`); } const cmds = [ 'rm', 'make', 'tar' ]; if (PLATFORM === 'linux') { cmds.push('wget'); } else if (PLATFORM === 'darwin') { cmds.push('curl'); } else { throw new TypeError(`no support for your platform ${PLATFORM}`); } cmds.forEach(cmd => { try { run(`command -v ${cmd}`); } catch (err) { throw new TypeError(`command ${cmd} check failed: ${err}`); } });