Adding dependency check scripts.
This commit is contained in:
parent
fd1dee993a
commit
0fd8436a15
|
@ -9,6 +9,7 @@
|
|||
"@types/node": "20.10.0",
|
||||
"@types/proper-lockfile": "^4.1.4",
|
||||
"@typescript-eslint/parser": "6.9.0",
|
||||
"depcheck": "^1.4.7",
|
||||
"esbuild": "^0.18.17",
|
||||
"esbuild-node-externals": "^1.14.0",
|
||||
"eslint": "^8.52.0",
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/node
|
||||
|
||||
const depcheck = require("depcheck")
|
||||
|
||||
function filterResults(missing) {
|
||||
if (missing.src) {
|
||||
delete missing.src
|
||||
}
|
||||
return missing
|
||||
}
|
||||
|
||||
function printMissing(missing) {
|
||||
for (let [key, value] of Object.entries(filterResults(missing))) {
|
||||
console.log(`Package ${key} missing in: ${value.join(", ")}`)
|
||||
}
|
||||
}
|
||||
|
||||
depcheck(process.cwd(), {
|
||||
ignorePatterns: ["dist"],
|
||||
skipMissing: false,
|
||||
}).then(results => {
|
||||
if (Object.values(filterResults(results.missing)).length > 0) {
|
||||
printMissing(results.missing)
|
||||
console.error("Missing packages found - stopping.")
|
||||
process.exit(-1)
|
||||
} else {
|
||||
console.log("No missing dependencies.")
|
||||
}
|
||||
})
|
Loading…
Reference in New Issue