MCPcopy
hub / github.com/QwikDev/qwik / mergeIgnoresFile

Function mergeIgnoresFile

packages/qwik/src/cli/add/update-files.ts:181–208  ·  view source on GitHub ↗
(fileUpdates: FsUpdates, srcPath: string, destPath: string)

Source from the content-addressed store, hash-verified

179}
180
181async function mergeIgnoresFile(fileUpdates: FsUpdates, srcPath: string, destPath: string) {
182 const srcContent = await fs.promises.readFile(srcPath, 'utf-8');
183
184 try {
185 const destContent = await fs.promises.readFile(destPath, 'utf-8');
186 const srcLines = srcContent.trim().split(/\r?\n/);
187 const destLines = destContent.trim().split(/\r?\n/);
188 for (const srcLine of srcLines) {
189 if (!destLines.includes(srcLine)) {
190 if (srcLine.startsWith('#')) {
191 destLines.push('');
192 }
193 destLines.push(srcLine);
194 }
195 }
196 fileUpdates.files.push({
197 path: destPath,
198 content: destLines.join('\n').trim() + '\n',
199 type: 'modify',
200 });
201 } catch (e) {
202 fileUpdates.files.push({
203 path: destPath,
204 content: srcContent,
205 type: 'create',
206 });
207 }
208}
209
210async function mergeCss(
211 fileUpdates: FsUpdates,

Callers 1

mergeIntegrationDirFunction · 0.85

Calls 1

joinMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…