Skip to content

Commit

Permalink
feat: add better log messages during installation
Browse files Browse the repository at this point in the history
  • Loading branch information
rsaz committed Oct 6, 2023
1 parent 7ffd673 commit 8d1766e
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions src/providers/prisma/prisma.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ const prismaProvider = async (
);

console.log("Now configure your database connection in the project.");
console.log(chalk.green("Prisma provider added successfully!"));
console.log(chalk.green("\n👍 Prisma provider added successfully!"));
} else {
console.log(chalk.red("Prisma provider not added!"));
}
Expand All @@ -293,21 +293,40 @@ async function execProcess({
cwd: directory,
});

console.log(chalk.bold.blue(`Executing: ${command} ${args.join(" ")}`));
console.log(chalk.yellow("---------------------------------------"));

installProcess.stdout.on("data", (data) => {
console.log(`${data}`);
console.log(chalk.green(data.toString().trim())); // Display regular messages in green
});

installProcess.stderr.on("data", (data) => {
console.error(`${data}`);
console.error(chalk.red(data.toString().trim())); // Display error messages in red
});

installProcess.on("close", (code) => {
if (code === 0) {
console.log(
chalk.bold.green("---------------------------------------"),
);
console.log(chalk.bold.green("Installation Done!"));
resolve("Installation Done!");
} else {
console.error(
chalk.bold.red("---------------------------------------"),
);
console.error(
chalk.bold.red(
`Command ${command} ${args.join(
" ",
)} exited with code ${code}`,
),
);
reject(
new Error(
`Command ${command} ${args} exited with code ${code}`,
`Command ${command} ${args.join(
" ",
)} exited with code ${code}`,
),
);
exit(1);
Expand Down

0 comments on commit 8d1766e

Please sign in to comment.