(project)
| 5 | const prependEmoji = require('@ember-tooling/blueprint-model/utilities/prepend-emoji'); |
| 6 | |
| 7 | async function run(project) { |
| 8 | let lintFixScriptName = 'lint:fix'; |
| 9 | let hasLintFixScript = Boolean(project.pkg.scripts[lintFixScriptName]); |
| 10 | |
| 11 | if (!hasLintFixScript) { |
| 12 | project.ui.writeWarnLine( |
| 13 | `Lint fix skipped: "${lintFixScriptName}" script not found in "package.json". New files might not pass linting.` |
| 14 | ); |
| 15 | |
| 16 | return; |
| 17 | } |
| 18 | |
| 19 | project.ui.writeLine(''); |
| 20 | project.ui.writeLine(prependEmoji('✨', `Running "${lintFixScriptName}" script...`)); |
| 21 | |
| 22 | let cwd = process.cwd(); |
| 23 | |
| 24 | if (await isPnpmProject(project.root)) { |
| 25 | await execa('pnpm', [lintFixScriptName], { cwd }); |
| 26 | } else if (isYarnProject(project.root)) { |
| 27 | await execa('yarn', [lintFixScriptName], { cwd }); |
| 28 | } else { |
| 29 | await execa('npm', ['run', lintFixScriptName], { cwd }); |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | module.exports = { |
| 34 | run, |
nothing calls this directly
no test coverage detected