Skip to content

Commit

Permalink
remove cli file that was changed because of code formatters
Browse files Browse the repository at this point in the history
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
  • Loading branch information
thebedigupta authored Oct 7, 2024
1 parent b662524 commit e8a8339
Showing 1 changed file with 22 additions and 34 deletions.
56 changes: 22 additions & 34 deletions apps/generator/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
}

Expand Down

0 comments on commit e8a8339

Please sign in to comment.