@strapi/strapi
Version:
An open source headless CMS solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier. Databases supported: MySQL, MariaDB, PostgreSQL, SQLite
24 lines (21 loc) • 689 B
JavaScript
import os from 'os';
import ts from 'typescript';
/**
* @description Load a tsconfig.json file and return the parsed config.
*
* @internal
*/ const loadTsConfig = ({ cwd, path, logger })=>{
const configPath = ts.findConfigFile(cwd, ts.sys.fileExists, path);
if (!configPath) {
return undefined;
}
const configFile = ts.readConfigFile(configPath, ts.sys.readFile);
const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, cwd);
logger.debug(`Loaded user TS config:`, os.EOL, parsedConfig);
return {
config: parsedConfig,
path: configPath
};
};
export { loadTsConfig };
//# sourceMappingURL=tsconfig.mjs.map