From 53d6ec8d30c2343a51ba8ea9c1290a3d4c4bd35e Mon Sep 17 00:00:00 2001 From: Josh GM Walker <56300765+Josh-Walker-GM@users.noreply.github.com> Date: Tue, 10 Oct 2023 22:01:47 +0100 Subject: [PATCH] tiny readability change --- .../cli/src/commands/generate/scaffold/scaffold.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/cli/src/commands/generate/scaffold/scaffold.js b/packages/cli/src/commands/generate/scaffold/scaffold.js index 8762ab04da05..7a6cdbb2ebb2 100644 --- a/packages/cli/src/commands/generate/scaffold/scaffold.js +++ b/packages/cli/src/commands/generate/scaffold/scaffold.js @@ -181,7 +181,7 @@ export const files = async ({ tests, typescript, })), - ...assetFiles(name, tailwind), + ...assetFiles(name, tailwind, force), ...(await formatters(name, typescript)), ...layoutFiles(name, force, typescript, templateStrings), ...(await pageFiles( @@ -194,7 +194,7 @@ export const files = async ({ } } -const assetFiles = (name, tailwind) => { +const assetFiles = (name, tailwind, force) => { let fileList = {} const assets = fs.readdirSync( customOrDefaultTemplatePath({ @@ -206,10 +206,8 @@ const assetFiles = (name, tailwind) => { assets.forEach((asset) => { // check if the asset name matches the Tailwind preference - if ( - (tailwind && asset.match(/tailwind/)) || - (!tailwind && !asset.match(/tailwind/)) - ) { + const assetIsTailwind = asset.match(/tailwind/)?.length > 0 + if ((tailwind && assetIsTailwind) || (!tailwind && !assetIsTailwind)) { const outputAssetName = asset .replace(/\.template/, '') .replace(/\.tailwind/, '') @@ -218,7 +216,8 @@ const assetFiles = (name, tailwind) => { // skip assets that already exist on disk, never worry about overwriting if ( !SKIPPABLE_ASSETS.includes(path.basename(outputPath)) || - !fs.existsSync(outputPath) + !fs.existsSync(outputPath) || + force ) { const template = generateTemplate( customOrDefaultTemplatePath({