From af5df90557022f03cd9b5464e75a6c722cc124b7 Mon Sep 17 00:00:00 2001 From: WQ Date: Thu, 14 Nov 2024 09:25:33 +0800 Subject: [PATCH] fix:Skip the configuration file if it exists --- src/generate/generate_tailwindcss.ts | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/src/generate/generate_tailwindcss.ts b/src/generate/generate_tailwindcss.ts index 88503ea..c9347b1 100644 --- a/src/generate/generate_tailwindcss.ts +++ b/src/generate/generate_tailwindcss.ts @@ -1,4 +1,3 @@ -import { confirm } from '@clack/prompts'; import fs from 'fs-extra'; import path from 'pathe'; import type { Context } from '../types'; @@ -32,16 +31,8 @@ export default { const tailwindCSSPath = path.join(cwd, 'src/tailwind.css'); const results = await Promise.all([ - writeFileWithConfirmation( - tailwindConfigPath, - tailwindConfig, - 'Tailwind config file already exists, do you want to overwrite?', - ), - writeFileWithConfirmation( - tailwindCSSPath, - tailwindCSS, - 'Tailwind CSS file already exists, do you want to overwrite?', - ), + writeFileWithConfirmation(tailwindConfigPath, tailwindConfig), + writeFileWithConfirmation(tailwindCSSPath, tailwindCSS), ]); results @@ -52,19 +43,12 @@ export default { async function writeFileWithConfirmation( filePath: string, content: string, - confirmMessage: string, ): Promise { if (fs.existsSync(filePath)) { - const shouldOverwrite = await confirm({ - message: confirmMessage, - }); - - if (!shouldOverwrite) { - return { - success: false, - message: `Skipped writing to ${filePath}`, - }; - } + return { + success: false, + message: `Skipped writing to ${filePath}`, + }; } try {