Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(check:policy): Add policy handler to check for extraneous lockfiles #12726

Merged
merged 4 commits into from
Nov 1, 2022

Conversation

tylerbutler
Copy link
Member

@tylerbutler tylerbutler commented Oct 29, 2022

Adds a policy handler that checks that package-lock.json files appear only in the root of release groups or independent packages. Additional paths can be added to the fluidBuild.additionalLockfilePaths array in package.json.

Related to #9956.

@github-actions github-actions bot added the base: main PRs targeted against main branch label Oct 29, 2022
@tylerbutler tylerbutler marked this pull request as ready for review October 29, 2022 01:21
@tylerbutler tylerbutler requested review from msfluid-bot and a team as code owners October 29, 2022 01:21
package.json Outdated Show resolved Hide resolved
@tylerbutler tylerbutler changed the title feat(policy:check): Add policy handler to check for extraneous lockfiles feat(check:policy): Add policy handler to check for extraneous lockfiles Oct 31, 2022
if (Array.isArray(arr)) {
knownPaths.push(...arr.map((p) => p.toString()));
}
}
Copy link
Member

Choose a reason for hiding this comment

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

The above seems compute the same thing again and again. Should we cache it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Refactored this out into a get function that calculates the known paths once and returns the cached value subsequently.

@tylerbutler tylerbutler requested a review from curtisman November 1, 2022 17:27
@tylerbutler tylerbutler merged commit a477941 into microsoft:main Nov 1, 2022
@tylerbutler tylerbutler deleted the cli/lockfile-policy branch November 1, 2022 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
base: main PRs targeted against main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants