Skip to content

Commit 893bd3e

Browse files
justin808claude
andcommitted
Fix lockfile resolution for local paths to prevent CI failures
Problem: - CI was failing because yarn.lock contains version "0.0.0" for local links - The resolve_version method was checking lockfiles before detecting local paths - This caused "0.0.0" to be returned instead of the local path from package.json Solution: - Check if package.json version is a local path/URL BEFORE resolving from lockfiles - Add local_path_or_url_version? helper method - Skip lockfile resolution for local paths since they have placeholder versions This fixes the CI failures where spec/dummy uses "link:.yalc/react-on-rails" and yarn.lock contains version "0.0.0" for this local link. All 65 tests still passing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent aa6a04b commit 893bd3e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/react_on_rails/version_checker.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,12 @@ def parts
338338
private
339339

340340
# Resolve version from lockfiles if available, otherwise use package.json version
341+
# rubocop:disable Metrics/CyclomaticComplexity
341342
def resolve_version(package_json_version, package_name)
343+
# If package.json specifies a local path or URL, don't try to resolve from lockfiles
344+
# Lockfiles may contain placeholder versions like "0.0.0" for local links
345+
return package_json_version if local_path_or_url_version?(package_json_version)
346+
342347
# Try yarn.lock first
343348
if yarn_lock && File.exist?(yarn_lock)
344349
lockfile_version = version_from_yarn_lock(package_name)
@@ -354,6 +359,14 @@ def resolve_version(package_json_version, package_name)
354359
# Fall back to package.json version
355360
package_json_version
356361
end
362+
# rubocop:enable Metrics/CyclomaticComplexity
363+
364+
# Check if a version string represents a local path or URL
365+
def local_path_or_url_version?(version)
366+
return false if version.nil?
367+
368+
version.include?("/") && !version.start_with?("npm:")
369+
end
357370

358371
# Parse version from yarn.lock
359372
# Looks for entries like:

0 commit comments

Comments
 (0)