MCPcopy Index your code
hub / github.com/lingodotdev/lingo.dev / loadLock

Function loadLock

packages/cli/src/cli/utils/delta.ts:93–116  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

91 };
92 },
93 async loadLock() {
94 const lockfileContent = tryReadFile(lockfilePath, null);
95
96 if (!lockfileContent) {
97 return {
98 version: 1,
99 checksums: {},
100 } as const;
101 }
102
103 // Deduplicate using the universal function
104 const { deduplicatedContent, duplicatesRemoved } = deduplicateLockfileYaml(lockfileContent);
105
106 // Write back to disk if duplicates were found
107 if (duplicatesRemoved > 0) {
108 writeFile(lockfilePath, deduplicatedContent);
109 console.log(
110 `Removed ${duplicatesRemoved} duplicate ${duplicatesRemoved === 1 ? "entry" : "entries"} from i18n.lock`,
111 );
112 }
113
114 const parsed = LockSchema.parse(YAML.parse(deduplicatedContent));
115 return parsed;
116 },
117 async saveLock(lockData: LockData) {
118 const lockfileYaml = YAML.stringify(lockData);
119 writeFile(lockfilePath, lockfileYaml);

Callers

nothing calls this directly

Calls 5

tryReadFileFunction · 0.90
deduplicateLockfileYamlFunction · 0.90
writeFileFunction · 0.90
logMethod · 0.80
parseMethod · 0.80

Tested by

no test coverage detected