@nuxt-js/package
Version:
nuxt js package
39 lines (32 loc) • 1.18 kB
JavaScript
const { execSync } = require('child_process');
const { join, resolve } = require('path');
const fs = require('fs');
// Get the path to the package directory
const packageDir = resolve(__dirname, '..');
const scriptPath = join(packageDir, 'scripts/configure.sh');
// Debug information
console.log('Package directory:', packageDir);
console.log('Script path:', scriptPath);
// Check if script exists
if (!fs.existsSync(scriptPath)) {
console.error(`Error: Configuration script not found at ${scriptPath}`);
process.exit(1);
}
try {
// Make script executable
fs.chmodSync(scriptPath, '755');
// Execute the script using bash explicitly
const command = `bash ${scriptPath} ${process.argv.slice(2).join(' ')}`;
console.log('Executing command:', command);
execSync(command, {
stdio: 'inherit',
cwd: process.cwd(), // Run in the current working directory
shell: '/bin/bash'
});
} catch (error) {
console.error('Failed to configure Nuxt project:', error.message);
if (error.stdout) console.error('stdout:', error.stdout.toString());
if (error.stderr) console.error('stderr:', error.stderr.toString());
process.exit(1);
}