Skip to content

Commit

Permalink
fix: class name updater does not support absolute paths
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rh-gvincent committed Nov 13, 2024
1 parent 0f187d7 commit c21018d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/class-name-updater/src/classNameUpdate.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { sync } from "glob";
import { readFileSync, writeFileSync } from "fs";
import { join } from "path";
import { isAbsolute, join } from "path";
import { isDir } from "./utils";
import { printDiff } from "./printDiff";

Expand Down Expand Up @@ -31,7 +31,7 @@ export async function classNameUpdate(
);

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

Expand Down

0 comments on commit c21018d

Please sign in to comment.