MCPcopy Create free account
hub / github.com/callstackincubator/polygen / fromPathSync

Method fromPathSync

packages/polygen-project/src/project.ts:115–130  ·  view source on GitHub ↗

* Creates a project from specified project root path, synchronously. * * @param projectRoot Path to the project * @returns Project instance * * @see fromPath Asynchronous version

(projectRoot: string)

Source from the content-addressed store, hash-verified

113 * @see fromPath Asynchronous version
114 */
115 static fromPathSync(projectRoot: string): Project {
116 const configPath = findConfigFileSync(projectRoot);
117 if (!configPath) {
118 throw new ProjectConfigurationNotFound();
119 }
120
121 try {
122 const config = configPath ? require(configPath).default : {};
123 return new Project(projectRoot, configPath, config);
124 } catch (e) {
125 throw new InvalidProjectConfigurationError(
126 `Failed to load config from ${configPath}`,
127 e
128 );
129 }
130 }
131
132 public updateOptionsInMemory(options: DeepPartial<ResolvedPolygenConfig>) {
133 this.options = deepmerge(this.options, options) as ResolvedPolygenConfig;

Callers 1

findClosestSyncMethod · 0.80

Calls 1

findConfigFileSyncFunction · 0.90

Tested by

no test coverage detected