MCPcopy Create free account
hub / github.com/mikro-orm/mikro-orm / getPackageConfig

Function getPackageConfig

packages/core/src/utils/fs-utils.ts:120–139  ·  view source on GitHub ↗
(basePath = process.cwd())

Source from the content-addressed store, hash-verified

118 },
119
120 getPackageConfig<T extends Dictionary>(basePath = process.cwd()): T {
121 if (this.pathExists(`${basePath}/package.json`)) {
122 try {
123 const path = this.normalizePath(import.meta.resolve(`${basePath}/package.json`));
124 return this.readJSONSync(path);
125 } catch (e) {
126 /* v8 ignore next */
127 return {} as T;
128 }
129 }
130
131 const parentFolder = realpathSync(`${basePath}/..`);
132
133 // we reached the root folder
134 if (basePath === parentFolder) {
135 return {} as T;
136 }
137
138 return this.getPackageConfig(parentFolder);
139 },
140
141 getORMPackages(): Set<string> {
142 const pkg = this.getPackageConfig();

Callers

nothing calls this directly

Calls 4

pathExistsMethod · 0.80
normalizePathMethod · 0.80
readJSONSyncMethod · 0.80
getPackageConfigMethod · 0.80

Tested by

no test coverage detected