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({