pixelblock-cli
Advanced tools
Comparing version 0.0.46 to 0.0.47
@@ -27,2 +27,15 @@ #!/usr/bin/env node | ||
// Check if the dependencies are already installed | ||
const checkDependenciesInstalled = (projectRoot) => { | ||
try { | ||
const nodeModulesPath = path.join(projectRoot, 'node_modules'); | ||
const clsxInstalled = fs.existsSync(path.join(nodeModulesPath, 'clsx')); | ||
const tailwindMergeInstalled = fs.existsSync(path.join(nodeModulesPath, 'tailwind-merge')); | ||
return clsxInstalled && tailwindMergeInstalled; | ||
} catch (error) { | ||
console.error(`Error checking dependencies: ${error.message}`); | ||
return false; | ||
} | ||
}; | ||
program | ||
@@ -55,9 +68,14 @@ .version(packageJson.version) | ||
// Attempt to install dependencies | ||
try { | ||
console.log('Installing dependencies...'); | ||
execSync(`cd ${destinationDir} && npm install clsx tailwind-merge`, { stdio: 'inherit' }); | ||
console.log('Dependencies installed successfully.'); | ||
} catch (error) { | ||
console.error(`Failed to install dependencies: ${error.message}`); | ||
// Check if dependencies are installed; only install if necessary | ||
const dependenciesInstalled = checkDependenciesInstalled(projectRoot); | ||
if (!dependenciesInstalled) { | ||
try { | ||
console.log('Installing dependencies...'); | ||
execSync(`cd ${projectRoot} && npm install clsx tailwind-merge`, { stdio: 'inherit' }); | ||
console.log('Dependencies installed successfully.'); | ||
} catch (error) { | ||
console.error(`Failed to install dependencies: ${error.message}`); | ||
} | ||
} else { | ||
console.log('Dependencies already installed, skipping installation.'); | ||
} | ||
@@ -64,0 +82,0 @@ } else { |
{ | ||
"name": "pixelblock-cli", | ||
"version": "0.0.46", | ||
"version": "0.0.47", | ||
"main": "bin/install.js", | ||
@@ -5,0 +5,0 @@ "bin": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
54104
17
1556