* Creates a project from specified project root path, synchronously. * * @param projectRoot Path to the project * @returns Project instance * * @see fromPath Asynchronous version
(projectRoot: string)
| 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; |
no test coverage detected