This repository has been archived by the owner on Aug 11, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
has-modern-meta: git deps do not need shasum or integrity
- Loading branch information
Showing
3 changed files
with
12 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
'use strict' | ||
module.exports = hasModernMeta | ||
|
||
const npa = require('npm-package-arg') | ||
const moduleName = require('../utils/module-name.js') | ||
|
||
function isLink (child) { | ||
return child.isLink || (child.parent && isLink(child.parent)) | ||
} | ||
|
||
function hasModernMeta (child) { | ||
if (!child) return false | ||
const resolved = child.package._resolved && npa.resolve(moduleName(child), child.package._resolved) | ||
return child.isTop || isLink(child) || ( | ||
child.package && | ||
child.package._resolved && | ||
(child.package._integrity || child.package._shasum) | ||
resolved && | ||
(child.package._integrity || child.package._shasum || resolved.type === 'git') | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters