Skip to content

Commit

Permalink
Clean up #20
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Nov 10, 2022
1 parent 37826ad commit 6cab3ab
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,9 @@ export default async function createXo(options = {}) {

if (hasYarn(packageCwd)) {
try {
const version = parseFloat(await execa('yarn', ['--version'], {cwd: packageCwd}));
if (version < 2) {
await execa('yarn', ['add', '--dev', '--ignore-workspace-root-check', 'xo'], {cwd: packageCwd});
} else {
await execa('yarn', ['add', '--dev', 'xo'], {cwd: packageCwd});
}
const version = Number.parseFloat(await execa('yarn', ['--version'], {cwd: packageCwd}));
const arguments_ = version > 1 ? ['add', '--dev', 'xo'] : ['add', '--dev', '--ignore-workspace-root-check', 'xo'];
await execa('yarn', arguments_, {cwd: packageCwd});
post();
} catch (error) {
if (error.code === 'ENOENT') {
Expand Down

0 comments on commit 6cab3ab

Please sign in to comment.