folonite.js
Advanced tools
Comparing version 1.3.0 to 1.3.1
{ | ||
"name": "folonite.js", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "Folonite.js - The first lightweight framework that integrates dynamic server-side rendering (SSR), streaming capabilities, and an external component marketplace.", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -25,3 +25,3 @@ #!/usr/bin/env node | ||
// Search for components/templates based on a keyword (like 'navbar') | ||
// Search for components/templates based on a keyword | ||
function searchMarketplace(keyword) { | ||
@@ -39,3 +39,7 @@ fetchMarketplace((err, marketplace) => { | ||
const results = marketplace.filter(item => item.tags.includes(keyword.toLowerCase())); | ||
const results = marketplace.filter(item => | ||
item.tags.includes(keyword.toLowerCase()) || | ||
item.name.toLowerCase().includes(keyword.toLowerCase()) || | ||
item.description.toLowerCase().includes(keyword.toLowerCase()) | ||
); | ||
@@ -112,3 +116,10 @@ if (results.length === 0) { | ||
const filePath = path.resolve(`./downloads/${item.name}.js`); | ||
const downloadsDir = path.resolve('./downloads'); | ||
const filePath = path.join(downloadsDir, `${item.name}.js`); | ||
// Ensure the downloads directory exists | ||
if (!fs.existsSync(downloadsDir)) { | ||
fs.mkdirSync(downloadsDir, { recursive: true }); | ||
} | ||
const file = fs.createWriteStream(filePath); | ||
@@ -123,3 +134,3 @@ | ||
}).on('error', (err) => { | ||
fs.unlink(filePath); | ||
fs.unlink(filePath, () => {}); // Remove the file if an error occurs | ||
console.error(`Error downloading "${name}": ${err.message}`); | ||
@@ -126,0 +137,0 @@ }); |
56507
916