From 5de21bd6770fff460b914aeba1f7a619eac16bdb Mon Sep 17 00:00:00 2001 From: Clete AI Date: Thu, 15 May 2025 21:03:08 +0000 Subject: [PATCH] Clete AI[bot] PR: Fix version mismatch and improve error handling This is a PR opened by AI tool [Clete AI](https://www.clete.ai) to implement changes: Fix version mismatch and improve error handling --- index.js | 29 +++++++++++++++++------------ package.json | 2 +- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/index.js b/index.js index 532cddc..f526482 100644 --- a/index.js +++ b/index.js @@ -10,11 +10,12 @@ const fs = require("fs"), let newPaystack = (old = String, recent = String, type, min)=>{ if(type == "paystack-js"){ fs.writeFile(`${recent}.js`, old, 'utf8', err => { - if (err) return console.log(err); + if (err) { + console.error("Error writing file:", err); + return; + } + console.info('Successfully created "paystack.js"'); }); - - console.info("Done!!!") - console.info('Please check directory for "paystack.js"') if(min == "min"){ minify(`${recent}.js`) @@ -38,18 +39,22 @@ let newPaystack = (old = String, recent = String, type, min)=>{ fs.writeFile(`${recent}.js`, result, 'utf8', err => { - if (err) return console.log(err); + if (err) { + console.error("Error writing file:", err); + return; + } + console.info(`Successfully created "${recent}.js"`); }); - - console.info("Done!!!") - console.info(`Done. Please check directory for "${recent}.js"`) if(min == "min"){ minify(`${recent}.js`) .then((data)=>{ fs.writeFile(`${recent}.min.js`, data, 'utf8', err => { - if (err) return console.log(err); - else console.info(`"${recent}.min.js" also added as minified version`) + if (err) { + console.error("Error writing minified file:", err); + return; + } + console.info(`Successfully created "${recent}.min.js"`); }); }) .catch(console.error); @@ -67,8 +72,8 @@ let newPaystack = (old = String, recent = String, type, min)=>{ } program - .version('1.2.0') - .description('A simple CLI tool that makes paystack easier for developers to intergrate'); + .version('1.2.3') + .description('A simple CLI tool that makes paystack easier for developers to integrate'); program .command('create [min]') diff --git a/package.json b/package.json index a9fe866..035ca33 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "preferGlobal": true, "bin": "./index.js", "version": "1.2.3", - "description": "A simple CLI tool that makes paystack easier for developers to intergrate", + "description": "A simple CLI tool that makes paystack easier for developers to integrate", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1"