MCPcopy Create free account
hub / github.com/angular/dev-infra / getGoogleSyncConfig

Function getGoogleSyncConfig

ng-dev/utils/g3-sync-config.ts:66–86  ·  view source on GitHub ↗
(absolutePath: string)

Source from the content-addressed store, hash-verified

64 * @throws {InvalidGoogleSyncConfigError} If the configuration is invalid.
65 */
66export async function getGoogleSyncConfig(absolutePath: string): Promise<{
67 ngMatchFn: SyncFileMatchFn;
68 separateMatchFn: SyncFileMatchFn;
69 config: GoogleSyncConfig;
70}> {
71 const content = await fs.promises.readFile(absolutePath, 'utf8');
72 const errors: jsonc.ParseError[] = [];
73 const config = jsonc.parse(content, errors) as GoogleSyncConfig;
74 if (errors.length !== 0) {
75 throw new InvalidGoogleSyncConfigError(
76 `Google Sync Configuration is invalid: ` +
77 errors.map((e) => jsonc.printParseErrorCode(e.error)).join('\n'),
78 );
79 }
80 const matchFns = transformConfigIntoMatcher(config);
81 return {
82 config,
83 ngMatchFn: matchFns.ngSyncMatchFn,
84 separateMatchFn: matchFns.separateSyncMatchFn,
85 };
86}

Callers 3

getG3SyncFileMatchFnsMethod · 0.85
getGsyncConfigFunction · 0.85
mainFunction · 0.85

Calls 1

Tested by

no test coverage detected