Skip to content

Commit

Permalink
fix: do not use --force when choosing yarn
Browse files Browse the repository at this point in the history
1. yarn v2+ does not support it.
2. yarn v1 can install without the flag.

fixes #122
  • Loading branch information
aladdin-add committed May 31, 2024
1 parent 0e2ecd3 commit b66dc0b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/config-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,17 @@ export default [\n${exportContent}];`;
choices: ["npm", "yarn", "pnpm", "bun"]
})).packageManager;

// removing `--force` when:
// 1. yarn v2+ -- it does not support it.
// 2. eslint v8.x -- it does not need it.
if (packageManager === "yarn" || this.answers.eslintVersion === "8.x") {
const index = this.result.installFlags.indexOf("--force");

if (index !== -1) {
this.result.installFlags.splice(index, 1);
}
}

log.info("☕️Installing...");
installSyncSaveDev(this.result.devDependencies, packageManager, this.result.installFlags);
await writeFile(configPath, this.result.configContent);
Expand Down

0 comments on commit b66dc0b

Please sign in to comment.