Skip to content

Commit

Permalink
chore: fix remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDeBoey committed Nov 25, 2022
1 parent 9e2780f commit dd8c480
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,27 +148,31 @@ const hasDevDependency = (dependency, packageJson) => {
)
}

const runSValues = [new RegExp('run-s')]
const runSValues = [
/npm-run-all .* -s(?:$|\s|&|>|<)/,
/npm-run-all .* --sequential/,
/npm-run-all .* --serial/,
/run-s/,
]

const hasRunS = (packageJson) => {
if (hasDevDependency('npm-run-all', packageJson)) {
const scripts = packageJson.scripts
const betterScripts = packageJson.betterScripts

if (scripts) {
return Object.values(scripts).some((script) =>
runSValues.some((runSValue) => runSValue.test(script)),
)
}
if (!hasDevDependency('npm-run-all', packageJson)) {
return false
}

if (betterScripts) {
return Object.values(betterScripts).some((script) =>
runSValues.some((runSValue) => runSValue.test(script)),
)
}
const scripts = packageJson.scripts
const betterScripts = packageJson.betterScripts
if (scripts) {
return Object.values(scripts).some((script) =>
runSValues.some((runSValue) => runSValue.test(script)),
)
}

return false
if (betterScripts) {
return Object.values(betterScripts).some((script) =>
runSValues.some((runSValue) => runSValue.test(script)),
)
}
}

const sortScripts = onObject((scripts, packageJson) => {
Expand All @@ -195,9 +199,8 @@ const sortScripts = onObject((scripts, packageJson) => {
),
[],
)
const toReturn = sortObjectKeys(scripts, order)

return toReturn
return sortObjectKeys(scripts, order)
})

// fields marked `vscode` are for `Visual Studio Code extension manifest` only
Expand Down

0 comments on commit dd8c480

Please sign in to comment.