Skip to content

Conversation

tylerbutler
Copy link
Member

The resolver for the package.json repository.directory field was using absolute paths instead of relative ones. That is now fixed.

@tylerbutler tylerbutler requested review from Copilot and a team June 20, 2025 23:53
@github-actions github-actions bot added area: build Build related issues base: main PRs targeted against main branch labels Jun 20, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the repository.directory field in generated package.json files by switching from absolute to relative paths.

  • Updated the resolver function to accept the repository root (gitRoot)
  • Changed relativePkgDir computation to use path.relative against gitRoot
Comments suppressed due to low confidence (1)

build-tools/packages/build-cli/src/library/repoPolicyCheck/npmPackages.ts:841

  • Add or update unit tests to cover this new relative path resolution logic, including edge cases like files at the repo root and nested directories.
				const relativePkgDir = path.dirname(path.relative(gitRoot, file)).replace(/\\/g, "/");

return undefined;
},
resolver: (file: string): { resolved: boolean } => {
resolver: (file: string, gitRoot: string): { resolved: boolean } => {
Copy link
Preview

Copilot AI Jun 20, 2025

Choose a reason for hiding this comment

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

The resolver signature was changed to include gitRoot, but the Handler interface and any call sites need to be updated accordingly to prevent type mismatches or runtime errors.

Copilot uses AI. Check for mistakes.

@tylerbutler tylerbutler merged commit 67fc07d into microsoft:main Jun 23, 2025
32 checks passed
@tylerbutler tylerbutler deleted the bt-fix-npm-pkg-dir branch June 23, 2025 15:51
MarioJGMsoft pushed a commit to MarioJGMsoft/FluidFramework that referenced this pull request Jul 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: build Build related issues base: main PRs targeted against main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants