MCPcopy Create free account
hub / github.com/npm/cli / strictAllowScriptsError

Function strictAllowScriptsError

workspaces/arborist/lib/unreviewed-scripts.js:81–99  ·  view source on GitHub ↗
(unreviewed, { remediation } = {})

Source from the content-addressed store, hash-verified

79// caller-specific guidance appended after the package list (npm install vs
80// npm exec have different remediation commands).
81const strictAllowScriptsError = (unreviewed, { remediation } = {}) => {
82 const lines = unreviewed.map(({ node, scripts }) => {
83 const events = Object.entries(scripts)
84 .map(([event, body]) => `${event}: ${body}`)
85 .join('; ')
86 const name = node.package?.name || node.name
87 const version = node.package?.version || ''
88 const label = version ? `${name}@${version}` : name
89 return ` ${label} (${events})`
90 }).join('\n')
91
92 return Object.assign(
93 new Error(
94 `--strict-allow-scripts: ${unreviewed.length} package(s) have install ` +
95 `scripts not covered by allowScripts:\n${lines}\n${remediation}`
96 ),
97 { code: 'ESTRICTALLOWSCRIPTS' }
98 )
99}
100
101module.exports = { collectUnreviewedScripts, strictAllowScriptsError }

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected