UNPKG

@tobiastengler/create-relay-app

Version:

Easy configuration of Relay for existing projects

27 lines (26 loc) 745 B
export class YarnPackageManager { constructor(cwd, cmdRunner) { this.cwd = cwd; this.cmdRunner = cmdRunner; this.id = "yarn"; } addDependency(packages) { return this.installDependency(packages, false); } addDevDependency(packages) { return this.installDependency(packages, true); } installDependency(packages, isDevDependency) { const args = ["add", "--exact", "--cwd", this.cwd]; if (isDevDependency) { args.push("--dev"); } if (typeof packages === "string") { args.push(packages); } else { args.push(...packages); } return this.cmdRunner.run("yarn", args, this.cwd); } }