setu.js
Version:
A lightweight HTTP client for Node.js and the browser, with smart adapter selection.
34 lines (26 loc) • 684 B
JavaScript
#!/usr/bin/env node
/**
* Optional native module build script
* Silently fails if build tools are not available
*/
const { execSync } = require('child_process');
const fs = require('fs');
const path = require('path');
const nativeDir = __dirname;
// Check if binding.gyp exists
if (!fs.existsSync(path.join(nativeDir, 'binding.gyp'))) {
process.exit(0);
}
// Try to build
try {
// Check if node-gyp is available
execSync('node-gyp --version', { stdio: 'ignore' });
// Build the native module
execSync('node-gyp rebuild', {
cwd: nativeDir,
stdio: 'ignore'
});
} catch (error) {
// Silently fail - JavaScript fallback will be used
process.exit(0);
}