Skip to content

Commit

Permalink
deps: use resolve.isCore instead of is-builtin-module for better …
Browse files Browse the repository at this point in the history
…data and better node compat (#99)

PR-URL: #99
Credit: @ljharb
Reviewed-By: @aeschright
  • Loading branch information
ljharb authored and aeschright committed Feb 4, 2019
1 parent de56d3e commit f97372c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 28 deletions.
2 changes: 1 addition & 1 deletion lib/fixer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var semver = require("semver")
var validateLicense = require('validate-npm-package-license');
var hostedGitInfo = require("hosted-git-info")
var isBuiltinModule = require("is-builtin-module")
var isBuiltinModule = require("resolve").isCore
var depTypes = ["dependencies","devDependencies","optionalDependencies"]
var extractDescription = require("./extract_description")
var url = require("url")
Expand Down
30 changes: 14 additions & 16 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"dependencies": {
"hosted-git-info": "^2.1.4",
"is-builtin-module": "^1.0.0",
"resolve": "^1.10.0",
"semver": "2 || 3 || 4 || 5",
"validate-npm-package-license": "^3.0.1"
},
Expand Down
24 changes: 14 additions & 10 deletions test/normalize.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,26 @@ tap.test("core module name", function(t) {
function warn(m) {
warnings.push(m)
}
var coreModules = ["http", "_stream_writable"]
var a
normalize(a={
name: "http",
readme: "read yourself how about",
homepage: 123,
bugs: "what is this i don't even",
repository: "Hello."
}, warn)
var expect = []
for (var i = 0; i < coreModules.length; ++i) {
normalize(a={
name: coreModules[i],
readme: "read yourself how about",
homepage: 123,
bugs: "what is this i don't even",
repository: "Hello."
}, warn)

var expect = [
safeFormat(warningMessages.conflictingName, 'http'),
expect = expect.concat([
safeFormat(warningMessages.conflictingName, coreModules[i]),
warningMessages.nonEmailUrlBugsString,
warningMessages.emptyNormalizedBugs,
warningMessages.nonUrlHomepage,
warningMessages.missingLicense
]
])
}
t.same(warnings, expect)
t.end()
})
Expand Down

0 comments on commit f97372c

Please sign in to comment.