Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions packages/cli/src/migration/__tests__/renovate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,19 @@ describe('Renovate configuration', () => {
},
);

// Creating a file symlink on Windows needs extra privileges.
it.skipIf(process.platform === 'win32')('skips a linked config file', async () => {
const target = await config('shared/renovate.json', '{}');
await fs.symlink(target, path.join(root, 'renovate.json'));
expect(await findRenovateConfigToUpdate(root)).toBeUndefined();
});

it('skips a config in a linked directory', async () => {
const target = await config('shared/renovate.json', '{}');
await fs.symlink(path.dirname(target), path.join(root, '.github'), 'junction');
expect(await findRenovateConfigToUpdate(root)).toBeUndefined();
});

it('ignores projects without Renovate and does not recreate a config removed after detection', async () => {
await config('package.json', '{"name":"demo"}');
expect(await findRenovateConfigToUpdate(root)).toBeUndefined();
Expand Down
5 changes: 5 additions & 0 deletions packages/cli/src/migration/renovate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ export async function findRenovateConfigToUpdate(rootDir: string): Promise<strin
const file = path.join(rootDir, name);
try {
const source = await fs.readFile(file, 'utf8');
// A linked config can be shared with other projects, so edit only a file in this workspace.
const [realRoot, realFile] = await Promise.all([fs.realpath(rootDir), fs.realpath(file)]);
if (realFile !== path.join(realRoot, name)) {
return undefined;
}
const updated = await withVitePlusPreset(file, source);
return updated === undefined ? undefined : file;
} catch (error) {
Expand Down
Loading