Skip to content

Commit

Permalink
tiny readability change
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Walker-GM committed Oct 10, 2023
1 parent b0964a9 commit 53d6ec8
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions packages/cli/src/commands/generate/scaffold/scaffold.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -194,7 +194,7 @@ export const files = async ({
}
}

const assetFiles = (name, tailwind) => {
const assetFiles = (name, tailwind, force) => {
let fileList = {}
const assets = fs.readdirSync(
customOrDefaultTemplatePath({
Expand All @@ -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/, '')
Expand All @@ -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({
Expand Down

0 comments on commit 53d6ec8

Please sign in to comment.