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 22, 2022
1 parent 70d68f8 commit 1df19f0
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,27 +148,26 @@ const hasDevDependency = (dependency, packageJson) => {
)
}

const runSValues = [new RegExp('run-s')]
const runSValues = [/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 +194,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 1df19f0

Please sign in to comment.