mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-08 04:22:09 +00:00
[remix] Only add workspace check flag for Yarn v1 (#10364)
Yarn v2/v3 do not require this flag.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import semver from 'semver';
|
||||
import { execSync } from 'child_process';
|
||||
import { existsSync, promises as fs } from 'fs';
|
||||
import { basename, dirname, join, relative, resolve, sep } from 'path';
|
||||
import { pathToRegexp, Key } from 'path-to-regexp';
|
||||
@@ -283,10 +284,16 @@ export function addDependencies(
|
||||
}
|
||||
} else {
|
||||
// 'yarn'
|
||||
args.push('add', '--ignore-workspace-root-check');
|
||||
args.push('add');
|
||||
if (opts.saveDev) {
|
||||
args.push('--dev');
|
||||
}
|
||||
const yarnVersion = execSync('yarn -v', { encoding: 'utf8' }).trim();
|
||||
const isYarnV1 = semver.satisfies(yarnVersion, '1');
|
||||
if (isYarnV1) {
|
||||
// Ignoring workspace check is only needed on Yarn v1
|
||||
args.push('--ignore-workspace-root-check');
|
||||
}
|
||||
}
|
||||
|
||||
// Don't fail if pnpm is being run at the workspace root
|
||||
|
||||
Reference in New Issue
Block a user