Skip to content

Commit 062990e

Browse files
committed
cleanup and add ignore paths
1 parent aa9b926 commit 062990e

2 files changed

Lines changed: 22 additions & 22 deletions

File tree

codeflash/discovery/functions_to_optimize.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def qualified_name_with_modules_from_root(self, project_root_path: Path) -> str:
187187

188188

189189
def get_files_for_language(
190-
module_root_path: Path, ignore_paths: list[Path], language: Language | None = None
190+
module_root_path: Path, ignore_paths: list[Path] | None = None, language: Language | None = None
191191
) -> list[Path]:
192192
"""Get all source files for supported languages.
193193
@@ -200,18 +200,39 @@ def get_files_for_language(
200200
List of file paths matching supported extensions.
201201
202202
"""
203+
if ignore_paths is None:
204+
ignore_paths = []
205+
203206
if language is not None:
204207
support = get_language_support(language)
205208
extensions = support.file_extensions
206209
else:
207210
extensions = tuple(get_supported_extensions())
208211

212+
# Default directory patterns to always exclude for JS/TS
213+
js_ts_default_excludes = {
214+
"node_modules",
215+
"dist",
216+
"build",
217+
".next",
218+
".nuxt",
219+
"coverage",
220+
".cache",
221+
".turbo",
222+
".vercel",
223+
"__pycache__",
224+
}
225+
209226
files = []
210227
for ext in extensions:
211228
pattern = f"*{ext}"
212229
for file_path in module_root_path.rglob(pattern):
230+
# Check explicit ignore paths
213231
if any(file_path.is_relative_to(ignore_path) for ignore_path in ignore_paths):
214232
continue
233+
# Check default JS/TS excludes in path parts
234+
if any(part in js_ts_default_excludes for part in file_path.parts):
235+
continue
215236
files.append(file_path)
216237
return files
217238

codeflash/languages/javascript/vitest_runner.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -77,32 +77,11 @@ def _ensure_runtime_files(project_root: Path) -> None:
7777
project_root: The project root directory.
7878
7979
"""
80-
# Check if package is already installed
8180
node_modules_pkg = project_root / "node_modules" / "codeflash"
8281
if node_modules_pkg.exists():
8382
logger.debug("codeflash already installed")
8483
return
8584

86-
# Try to install from local package first (for development)
87-
local_package_path = Path(__file__).parent.parent.parent.parent / "packages" / "codeflash"
88-
if local_package_path.exists():
89-
try:
90-
result = subprocess.run(
91-
["npm", "install", "--save-dev", str(local_package_path)],
92-
check=False,
93-
cwd=project_root,
94-
capture_output=True,
95-
text=True,
96-
timeout=120,
97-
)
98-
if result.returncode == 0:
99-
logger.debug("Installed codeflash from local package")
100-
return
101-
logger.warning(f"Failed to install local package: {result.stderr}")
102-
except Exception as e:
103-
logger.warning(f"Error installing local package: {e}")
104-
105-
# Try to install from npm registry
10685
try:
10786
result = subprocess.run(
10887
["npm", "install", "--save-dev", "codeflash"],

0 commit comments

Comments
 (0)