Skip to content

Commit f5ec201

Browse files
authored
fix: class name updater does not support absolute paths (#803)
Closes #802 If the path given to class name updater is an absolute path, the tool raises an error. It adds the current working dir regardless of the path type. This patch fixes this issue and only adds the current working dir if the file path is not absolute.
1 parent 0f187d7 commit f5ec201

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/class-name-updater/src/classNameUpdate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { sync } from "glob";
22
import { readFileSync, writeFileSync } from "fs";
3-
import { join } from "path";
3+
import { isAbsolute, join } from "path";
44
import { isDir } from "./utils";
55
import { printDiff } from "./printDiff";
66

@@ -31,7 +31,7 @@ export async function classNameUpdate(
3131
);
3232

3333
includedFiles.forEach(async (file: string) => {
34-
const filePath = join(process.cwd(), file);
34+
const filePath = isAbsolute(file) ? file : join(process.cwd(), file);
3535
const isDirectory = await isDir(filePath);
3636
const isUnexpectedFile = !acceptedFileTypesRegex.test(filePath);
3737

0 commit comments

Comments
 (0)