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

Function scanProjectDirectory

packages/create/src/frameworks.ts:15–47  ·  view source on GitHub ↗
(
  projectDirectory: string,
  baseDirectory: string,
)

Source from the content-addressed store, hash-verified

13const frameworks: Array<Framework> = []
14
15export function scanProjectDirectory(
16 projectDirectory: string,
17 baseDirectory: string,
18) {
19 const absolutePaths: Record<string, string> = {}
20 findFilesRecursively(baseDirectory, absolutePaths)
21
22 const files = Object.keys(absolutePaths).reduce(
23 (acc, path) => {
24 acc[toCleanPath(path, baseDirectory)] = absolutePaths[path]
25 return acc
26 },
27 {} as Record<string, string>,
28 )
29
30 const basePackageJSON = existsSync(resolve(baseDirectory, 'package.json'))
31 ? JSON.parse(readFileSync(resolve(baseDirectory, 'package.json'), 'utf8'))
32 : {}
33
34 const optionalPackages = existsSync(
35 resolve(projectDirectory, 'packages.json'),
36 )
37 ? JSON.parse(
38 readFileSync(resolve(projectDirectory, 'packages.json'), 'utf8'),
39 )
40 : {}
41
42 return {
43 files,
44 basePackageJSON,
45 optionalPackages,
46 }
47}
48
49export function scanAddOnDirectories(addOnsDirectories: Array<string>) {
50 const addOns: Array<AddOn> = []

Callers 4

index.tsFile · 0.90
index.tsFile · 0.90
index.tsFile · 0.90

Calls 2

findFilesRecursivelyFunction · 0.90
toCleanPathFunction · 0.90

Tested by

no test coverage detected