Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

feat: allow the replace-use-search-params codemod to accept relative paths (INT-2089) #424

Merged
merged 2 commits into from
Nov 2, 2023
Merged
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
10 changes: 7 additions & 3 deletions cal.com/app-directory-boilerplate-calcom/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,13 @@ const transform = async (json: DirectoryJSON) => {

const api = buildApi<{
tsmorph: typeof tsmorph;
}>(unifiedFileSystem, () => ({
tsmorph,
}));
}>(
unifiedFileSystem,
() => ({
tsmorph,
}),
'/',
);

return executeFilemod(api, repomod, '/', {}, {});
};
Expand Down
6 changes: 5 additions & 1 deletion cal.com/generate-metadata-tests-calcom/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ const transform = async (json: DirectoryJSON) => {
fileSystemManager,
);

const api = buildApi<Record<string, never>>(unifiedFileSystem, () => ({}));
const api = buildApi<Record<string, never>>(
unifiedFileSystem,
() => ({}),
'/',
);

return executeFilemod(api, repomod, '/', { testPath: '/opt/tests' }, {});
};
Expand Down
10 changes: 7 additions & 3 deletions i18n/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
const volume = Volume.fromJSON(json);

const fileSystemManager = new FileSystemManager(
volume.promises.readdir as any,

Check warning on line 17 in i18n/test.ts

View workflow job for this annotation

GitHub Actions / Run codemod unit tests

Unexpected any. Specify a different type
volume.promises.readFile as any,

Check warning on line 18 in i18n/test.ts

View workflow job for this annotation

GitHub Actions / Run codemod unit tests

Unexpected any. Specify a different type
volume.promises.stat as any,

Check warning on line 19 in i18n/test.ts

View workflow job for this annotation

GitHub Actions / Run codemod unit tests

Unexpected any. Specify a different type
);

const fileSystem = createFsFromVolume(volume) as any;

Check warning on line 22 in i18n/test.ts

View workflow job for this annotation

GitHub Actions / Run codemod unit tests

Unexpected any. Specify a different type

const unifiedFileSystem = new UnifiedFileSystem(
fileSystem,
Expand All @@ -29,10 +29,14 @@
const api = buildApi<{
tsmorph: typeof tsmorph;
unifiedFileSystem: UnifiedFileSystem;
}>(unifiedFileSystem, () => ({
tsmorph,
}>(
unifiedFileSystem,
}));
() => ({
tsmorph,
unifiedFileSystem,
}),
'/',
);

return executeFilemod(api, repomod, '/', {}, {});
};
Expand Down
6 changes: 5 additions & 1 deletion next-i18next/copy-keys/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ const transform = async (json: DirectoryJSON, options: Options) => {
fileSystemManager,
);

const api = buildApi<Record<string, never>>(unifiedFileSystem, () => ({}));
const api = buildApi<Record<string, never>>(
unifiedFileSystem,
() => ({}),
'/',
);

return executeFilemod(api, repomod, '/', options, {});
};
Expand Down
16 changes: 10 additions & 6 deletions next/13/app-directory-boilerplate/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,16 @@ const transform = async (json: DirectoryJSON) => {
parseMdx: typeof parseMdx;
stringifyMdx: typeof stringifyMdx;
visitMdxAst: typeof visit;
}>(unifiedFileSystem, () => ({
tsmorph,
parseMdx,
stringifyMdx,
visitMdxAst: visit,
}));
}>(
unifiedFileSystem,
() => ({
tsmorph,
parseMdx,
stringifyMdx,
visitMdxAst: visit,
}),
'/',
);

return executeFilemod(api, repomod, '/', {}, {});
};
Expand Down
10 changes: 7 additions & 3 deletions next/13/remove-next-export/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,13 @@ const transform = async () => {

const api = buildApi<{
tsmorph: typeof tsmorph;
}>(unifiedFileSystem, () => ({
tsmorph,
}));
}>(
unifiedFileSystem,
() => ({
tsmorph,
}),
'/',
);

return executeFilemod(api, repomod, '/', {}, {});
};
Expand Down
10 changes: 7 additions & 3 deletions next/13/replace-api-routes/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,14 @@ const transform = async (json: DirectoryJSON) => {
const api = buildApi<{
tsmorph: typeof tsmorph;
unifiedFileSystem: UnifiedFileSystem;
}>(unifiedFileSystem, () => ({
tsmorph,
}>(
unifiedFileSystem,
}));
() => ({
tsmorph,
unifiedFileSystem,
}),
'/',
);

return executeFilemod(api, repomod, '/', {}, {});
};
Expand Down
18 changes: 11 additions & 7 deletions next/13/replace-next-head/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,18 @@ const transform = async (json: DirectoryJSON) => {
visitMdxAst: typeof visit;
filterMdxAst: typeof filter;
unifiedFileSystem: UnifiedFileSystem;
}>(unifiedFileSystem, () => ({
tsmorph,
parseMdx,
stringifyMdx,
visitMdxAst: visit,
filterMdxAst: filter,
}>(
unifiedFileSystem,
}));
() => ({
tsmorph,
parseMdx,
stringifyMdx,
visitMdxAst: visit,
filterMdxAst: filter,
unifiedFileSystem,
}),
'/',
);

return executeFilemod(api, repomod, '/', {}, {});
};
Expand Down
9 changes: 8 additions & 1 deletion next/13/replace-use-search-params/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@
"name": "useCompatSearchParamsHookAbsolutePath",
"description": "Absolute path of the hook that will be created by the codemod",
"kind": "string",
"required": true,
"required": false,
"default": ""
},
{
"name": "useCompatSearchParamsHookRelativePath",
"description": "Relative path of the hook that will be created by the codemod",
"kind": "string",
"required": false,
"default": ""
},
{
Expand Down
Loading
Loading