From e8a8339dfcd8a37479da4c19564c06884bde84f6 Mon Sep 17 00:00:00 2001 From: Bedi Gupta Date: Mon, 7 Oct 2024 19:54:56 +0530 Subject: [PATCH] remove cli file that was changed because of code formatters These are not necessary changes that I make in this PR It was just a part of confusion that I make because this was the first time when I am contributing to any open source project --- apps/generator/cli.js | 56 +++++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 34 deletions(-) diff --git a/apps/generator/cli.js b/apps/generator/cli.js index 66aef7109..feb12446a 100755 --- a/apps/generator/cli.js +++ b/apps/generator/cli.js @@ -141,41 +141,29 @@ xfs.mkdirp(program.output, async err => { * @param {*} targetDir The path to the target directory. */ function generate(targetDir) { - return new Promise((resolve, reject) => { - (async () => { - try { - const generator = new Generator( - template, - targetDir || path.resolve(os.tmpdir(), "asyncapi-generator"), - { - templateParams: params, - noOverwriteGlobs, - disabledHooks, - forceWrite: program.forceWrite, - install: program.install, - debug: program.debug, - mapBaseUrlToFolder, - } - ); - - if (isAsyncapiDocLocal) { - await generator.generateFromFile(path.resolve(asyncapiDocPath)); - } else { - await generator.generateFromURL(asyncapiDocPath); - } - console.log(green("\n\nDone! ✨")); - console.log( - `${ - yellow("Check out your shiny new generated files at ") + - magenta(program.output) + - yellow(".") - }\n` - ); - resolve(); - } catch (e) { - reject(e); + return new Promise(async (resolve, reject) => { + try { + const generator = new Generator(template, targetDir || path.resolve(os.tmpdir(), 'asyncapi-generator'), { + templateParams: params, + noOverwriteGlobs, + disabledHooks, + forceWrite: program.forceWrite, + install: program.install, + debug: program.debug, + mapBaseUrlToFolder + }); + + if (isAsyncapiDocLocal) { + await generator.generateFromFile(path.resolve(asyncapiDocPath)); + } else { + await generator.generateFromURL(asyncapiDocPath); } - })(); //Immediately invoke the async function + console.log(green('\n\nDone! ✨')); + console.log(`${yellow('Check out your shiny new generated files at ') + magenta(program.output) + yellow('.')}\n`); + resolve(); + } catch (e) { + reject(e); + } }); }