From f4ec77226a35f3119f971d3b2ac48ad8ec0e51b7 Mon Sep 17 00:00:00 2001 From: Clete AI Date: Mon, 12 May 2025 18:03:58 +0000 Subject: [PATCH] Clete AI[bot] PR: Fix typos and improve error handling This is a PR opened by AI tool [Clete AI](https://www.clete.ai) to implement changes: Fix typos and improve error handling --- index.js | 36 +++++++++++++++++++++--------------- model/questions.js | 2 +- package.json | 2 +- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/index.js b/index.js index 532cddc..9c9a524 100644 --- a/index.js +++ b/index.js @@ -10,18 +10,21 @@ 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); - }); - - console.info("Done!!!") - console.info('Please check directory for "paystack.js"') + if (err) { + console.error("Error writing file:", err); + return; + } + console.info('Done! Please check directory for "paystack.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(`"${recent}.min.js" also added as minified version`) }); }) .catch(console.error); @@ -38,18 +41,21 @@ let newPaystack = (old = String, recent = String, type, min)=>{ fs.writeFile(`${recent}.js`, result, 'utf8', err => { - if (err) return console.log(err); - }); - - console.info("Done!!!") - console.info(`Done. Please check directory for "${recent}.js"`) + if (err) { + console.error("Error writing file:", err); + return; + } + 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(`"${recent}.min.js" also added as minified version`) }); }) .catch(console.error); @@ -67,7 +73,7 @@ let newPaystack = (old = String, recent = String, type, min)=>{ } program - .version('1.2.0') + .version('1.2.3') .description('A simple CLI tool that makes paystack easier for developers to intergrate'); program diff --git a/model/questions.js b/model/questions.js index 1d86405..decec17 100644 --- a/model/questions.js +++ b/model/questions.js @@ -3,7 +3,7 @@ module.exports = { { type : 'input', name : 'public_key', - message : 'Enter your Paystack Pubic Key:' + message : 'Enter your Paystack Public Key:' } ], confirm : [ 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"