Skip to content

Commit

Permalink
Revert "Compatibility: npm, yarn and pnpm run scripts"
Browse files Browse the repository at this point in the history
This reverts commit b8d3ded.
  • Loading branch information
bcomnes committed Jul 4, 2024
1 parent c707195 commit fc35f0d
Showing 1 changed file with 2 additions and 23 deletions.
25 changes: 2 additions & 23 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,29 +112,8 @@ function applyArguments (patterns, args) {
* @returns {string[]} Parsed patterns.
*/
function parsePatterns (patternOrPatterns, args) {
let patterns = toArray(patternOrPatterns)

const isNPM = process.env.npm_config_user_agent && process.env.npm_config_user_agent.startsWith('npm')

if (!isNPM) {
// yarn | pnpm
patterns = patterns.map((pattern) => {
const match = ARGS_PATTERN.exec(pattern)

if (!match) {
return pattern
}

const patternList = pattern.split(' ')
const doubleDashIndex = patternList.findIndex((item) => item === '--')
patternList.splice(doubleDashIndex, 1)
pattern = patternList.join(' ')

return pattern
})
}

const hasPlaceholder = patterns.some((pattern) => ARGS_PATTERN.test(pattern))
const patterns = toArray(patternOrPatterns)
const hasPlaceholder = patterns.some(pattern => ARGS_PATTERN.test(pattern))

return hasPlaceholder ? applyArguments(patterns, args) : patterns
}
Expand Down

0 comments on commit fc35f0d

Please sign in to comment.