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

Add pnpm lockfiles as generated #6749

Merged
merged 7 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/linguist/generated.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def generated?
pdm_lock? ||
esy_lock? ||
npm_shrinkwrap_or_package_lock? ||
pnpm_lock? ||
terraform_lock? ||
generated_yarn_plugnplay? ||
godeps? ||
Expand Down Expand Up @@ -433,6 +434,13 @@ def npm_shrinkwrap_or_package_lock?
!!name.match(/npm-shrinkwrap\.json/) || !!name.match(/package-lock\.json/)
end

# Internal: Is the blob a generated pnpm lockfile?
#
# Returns true or false.
def pnpm_lock?
!!name.match(/pnpm-lock\.yaml/)
end

# Internal: Is the blob a generated Yarn Plug'n'Play?
#
# Returns true or false.
Expand Down
100 changes: 100 additions & 0 deletions test/fixtures/YAML/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions test/test_blob.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ def test_generated
# Nix generated flake.lock file
assert sample_blob_memory("JSON/filenames/flake.lock").generated?

# pnpm lockfile
assert fixture_blob_memory("YAML/pnpm-lock.yaml").generated?

# PEG.js-generated parsers
assert sample_blob_memory("JavaScript/parser.js").generated?

Expand Down
3 changes: 3 additions & 0 deletions test/test_generated.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ def test_check_generated
generated_sample_without_loading_data("Dummy/npm-shrinkwrap.json")
generated_sample_without_loading_data("Dummy/package-lock.json")

# pnpm lockfile
generated_sample_without_loading_data("Dummy/pnpm-lock.yaml")

# Yarn Plug'n'Play file
generated_sample_without_loading_data(".pnp.js")
generated_sample_without_loading_data(".pnp.cjs")
Expand Down
Loading