MCPcopy
hub / github.com/redwoodjs/graphql / parseTypeScriptConfigFiles

Function parseTypeScriptConfigFiles

packages/babel-config/src/common.ts:108–131  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

106 * @returns The config object
107 */
108export const parseTypeScriptConfigFiles = () => {
109 const rwPaths = getPaths()
110
111 const parseConfigFile = (basePath: string) => {
112 let configPath = path.join(basePath, 'tsconfig.json')
113 if (!fs.existsSync(configPath)) {
114 configPath = path.join(basePath, 'jsconfig.json')
115 if (!fs.existsSync(configPath)) {
116 return null
117 }
118 }
119 return parseConfigFileTextToJson(
120 configPath,
121 fs.readFileSync(configPath, 'utf-8'),
122 )
123 }
124 const apiConfig = parseConfigFile(rwPaths.api.base)
125 const webConfig = parseConfigFile(rwPaths.web.base)
126
127 return {
128 api: apiConfig?.config ?? null,
129 web: webConfig?.config ?? null,
130 }
131}
132
133type CompilerOptionsForPaths = {
134 compilerOptions: { baseUrl: string; paths: Record<string, string[]> }

Callers 3

getWebSideBabelPluginsFunction · 0.90
getApiSideBabelPluginsFunction · 0.90

Calls 2

getPathsFunction · 0.90
parseConfigFileFunction · 0.85

Tested by

no test coverage detected