Skip to content

Commit

Permalink
fix: ignore import path transformations on win32 platform (#570)
Browse files Browse the repository at this point in the history
* fix: ignore import path transformations on win32 platform

* fix: fixed a "code smell" to pass the code analysis
  • Loading branch information
pradiev committed Jan 22, 2024
1 parent eafd79b commit 4089bb4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/classes/transformer-plugin/src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function getDecoratorOrUndefinedByNames(
names: string[],
decorators?: readonly Decorator[]
): Decorator | undefined {
return (decorators || []).find((item) =>
return (decorators ? decorators : []).find((item) =>
names.includes(getDecoratorName(item) as string)
);
}
Expand Down Expand Up @@ -110,6 +110,11 @@ export function replaceImportPath(
if (!importPath) {
return undefined;
}

if (process.platform === 'win32') {
return typeReference.replace('import', 'require')
}

importPath = importPath.slice(2, importPath.length - 1);

let relativePath = posix.relative(dirname(fileName), importPath);
Expand Down

0 comments on commit 4089bb4

Please sign in to comment.