MCPcopy Create free account
hub / github.com/TanStack/cli / stripExamplesFromOptions

Function stripExamplesFromOptions

packages/create/src/edge-create-app.ts:17–54  ·  view source on GitHub ↗
(options: Options)

Source from the content-addressed store, hash-verified

15import type { Environment, FileBundleHandler, Options } from './types.js'
16
17function stripExamplesFromOptions(options: Options): Options {
18 if (options.includeExamples !== false) {
19 return options
20 }
21
22 const chosenAddOns = options.chosenAddOns
23 .filter((addOn) => addOn.type !== 'example')
24 .map((addOn) => {
25 const filteredRoutes = (addOn.routes || []).filter(
26 (route) =>
27 !isDemoFilePath(route.path) &&
28 !(route.url && route.url.startsWith('/demo')),
29 )
30
31 const filteredIntegrations = (addOn.integrations || []).filter(
32 (integration) => !isDemoFilePath(integration.path),
33 )
34
35 return {
36 ...addOn,
37 routes: filteredRoutes,
38 integrations: filteredIntegrations,
39 getFiles: async () => {
40 const files = await addOn.getFiles()
41 return files.filter((file) => !isDemoFilePath(file))
42 },
43 getDeletedFiles: async () => {
44 const deletedFiles = await addOn.getDeletedFiles()
45 return deletedFiles.filter((file) => !isDemoFilePath(file))
46 },
47 }
48 })
49
50 return {
51 ...options,
52 chosenAddOns,
53 }
54}
55
56async function writeFiles(environment: Environment, options: Options) {
57 const templateFileFromContent = createTemplateFile(environment, options)

Callers 1

createAppFunction · 0.70

Calls 1

isDemoFilePathFunction · 0.70

Tested by

no test coverage detected