From aa6c94dc89337fc0d6a4558935c383564aded8ae Mon Sep 17 00:00:00 2001 From: OnurGvnc Date: Thu, 16 May 2024 11:31:35 +0300 Subject: [PATCH] refactor: use `outputSvgExists` variable for checking existence of outputSvgPath file --- src/index.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/index.ts b/src/index.ts index 64f323b..33f076a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -143,12 +143,11 @@ export const iconsSpritesheet: (args: PluginProps) => Plugin = ({ withTypes, inp }, async configResolved(config) { const outputSvgPath = normalizePath(path.join(cwd ?? process.cwd(), outputDir, fileName ?? "sprite.svg")); - if ( - !(await fs - .access(outputSvgPath, fs.constants.F_OK) - .then(() => true) - .catch(() => false)) - ) { + const outputSvgExists = await fs + .access(outputSvgPath, fs.constants.F_OK) + .then(() => true) + .catch(() => false); + if (!outputSvgExists) { await generateIcons({ withTypes, inputDir,