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

Commit

Permalink
feat: allow the replace-use-search-params codemod to accept relative …
Browse files Browse the repository at this point in the history
…paths (INT-2089) (#424)

feat: allow the replace-use-search-params codemod to accept relative paths (INT-2089)
  • Loading branch information
grzpab authored Nov 2, 2023
1 parent 32eedbc commit 0ae98ac
Show file tree
Hide file tree
Showing 17 changed files with 247 additions and 151 deletions.
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 @@ -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
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

0 comments on commit 0ae98ac

Please sign in to comment.