Skip to content

Commit

Permalink
Add pnpm lockfiles as generated (#6749)
Browse files Browse the repository at this point in the history
* add yarn and pnpm lockfiles as generated

* update tests

* revert yarn.lock addition

* Update test_blob.rb

* nevermind test should use a fixture

* add fixture

* reduce pnpm-lock.yaml size
  • Loading branch information
SuperchupuDev authored Mar 12, 2024
1 parent ca188d5 commit 28b457e
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 0 deletions.
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

0 comments on commit 28b457e

Please sign in to comment.