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/debug for extra verbose information #172

Merged
merged 3 commits into from
Jul 28, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/hot-spiders-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'lockfile-lint-api': minor
---

Add verbose information in debug
25 changes: 23 additions & 2 deletions package-lock.json

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

1 change: 1 addition & 0 deletions packages/lockfile-lint-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
},
"dependencies": {
"@yarnpkg/parsers": "^3.0.0-rc.32",
"debug": "^4.3.4",
"object-hash": "^3.0.0"
},
"devDependencies": {
Expand Down
4 changes: 4 additions & 0 deletions packages/lockfile-lint-api/src/ParseLockfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
/* eslint-disable security/detect-object-injection */
'use strict'

const debug = require('debug')('lockfile-lint')

const path = require('path')
const yarnParseSyml = require('@yarnpkg/parsers').parseSyml
const hash = require('object-hash')
Expand Down Expand Up @@ -229,6 +231,8 @@ class ParseLockfile {
// if (depName.indexOf('node_modules/') === 0) {
// depNameClean = depName.substring('node_modules/'.length)
// }

debug(`dependency full name: ${depName}`)
const depNameClean = this.extractedPackageName(depName)

npmDepMap[`${depNameClean}@${depMetadata.version}-${hashedDepValues}`] = depMetadataShortend
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict'

const debug = require('debug')('lockfile-lint')
const {REGISTRY} = require('../common/constants')

module.exports = class ValidatePackageNames {
Expand Down Expand Up @@ -28,6 +29,11 @@ module.exports = class ValidatePackageNames {
// Only handle package name validation matching per registry URL
// when the registry is one of the official public registries:
if (!Object.values(REGISTRY).includes(packageResolvedURL.host)) {
debug(
`skipping package name '${packageName}' validation for non-official registry '${
packageResolvedURL.origin
}'`
)
continue
}

Expand Down