Skip to content

Conversation

@serhalp
Copy link
Member

@serhalp serhalp commented Dec 18, 2025

Summary

@netlify/build-info currently uses two mechanisms for detecting a detected framework's version: a high-fidelity check of the installed package in node_modules and a low-fidelity fallback check based on the version range in package.json dependencies. It does this automatically and opaquely.

Much like the existing framework accuracy, this PR adds a framework version accuracy field on the result, for improved transparency.

private async npmDependenciesUsed(
pkgJSON: Partial<PackageJson>,
): Promise<{ name: string; version?: SemVer } | undefined> {
const allDeps = [...Object.entries(pkgJSON.dependencies || {}), ...Object.entries(pkgJSON.devDependencies || {})]
Copy link
Member Author

@serhalp serhalp Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't help myself here. This was unnecessarily complicated. Instead of just merging two record objects, we were turning them into an array [[k1, v1], [k2, v2], ...] for some reason, which is less readable, more complicated, and presumably less performant (we use .find() on this, twice).

@serhalp serhalp marked this pull request as ready for review December 18, 2025 17:23
@serhalp serhalp requested a review from a team as a code owner December 18, 2025 17:23
@serhalp serhalp requested a review from pieh December 18, 2025 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants