Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions packages/create/src/create-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,22 @@ import { runSpecialSteps } from './special-steps/index.js'

import type { Environment, FileBundleHandler, Options } from './types.js'

function isDemoRoutePath(path?: string) {
function isDemoFilePath(path?: string) {
if (!path) return false
const normalized = path.replace(/\\/g, '/')
return (
normalized.includes('/routes/demo/') ||
normalized.includes('/routes/demo.') ||
normalized.includes('/routes/example/') ||
normalized.includes('/routes/example.')
normalized.includes('/routes/example.') ||
normalized.includes('/lib/demo-') ||
normalized.includes('/lib/demo.') ||
normalized.includes('/hooks/demo-') ||
normalized.includes('/hooks/demo.') ||
normalized.includes('/data/demo.') ||
normalized.includes('/data/demo-') ||
normalized.includes('/components/demo-') ||
normalized.includes('/components/demo.')
)
}

Expand All @@ -38,7 +46,7 @@ function stripExamplesFromOptions(options: Options): Options {
.map((addOn) => {
const filteredRoutes = (addOn.routes || []).filter(
(route) =>
!isDemoRoutePath(route.path) &&
!isDemoFilePath(route.path) &&
!(route.url && route.url.startsWith('/demo')),
)

Expand All @@ -47,11 +55,11 @@ function stripExamplesFromOptions(options: Options): Options {
routes: filteredRoutes,
getFiles: async () => {
const files = await addOn.getFiles()
return files.filter((file) => !isDemoRoutePath(file))
return files.filter((file) => !isDemoFilePath(file))
},
getDeletedFiles: async () => {
const deletedFiles = await addOn.getDeletedFiles()
return deletedFiles.filter((file) => !isDemoRoutePath(file))
return deletedFiles.filter((file) => !isDemoFilePath(file))
},
}
})
Expand Down
Loading