mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-10 12:57:47 +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:
5
.changeset/stupid-pumpkins-crash.md
Normal file
5
.changeset/stupid-pumpkins-crash.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'@vercel/remix-builder': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Only add workspace check flag for Yarn v1
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import semver from 'semver';
|
import semver from 'semver';
|
||||||
|
import { execSync } from 'child_process';
|
||||||
import { existsSync, promises as fs } from 'fs';
|
import { existsSync, promises as fs } from 'fs';
|
||||||
import { basename, dirname, join, relative, resolve, sep } from 'path';
|
import { basename, dirname, join, relative, resolve, sep } from 'path';
|
||||||
import { pathToRegexp, Key } from 'path-to-regexp';
|
import { pathToRegexp, Key } from 'path-to-regexp';
|
||||||
@@ -283,10 +284,16 @@ export function addDependencies(
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 'yarn'
|
// 'yarn'
|
||||||
args.push('add', '--ignore-workspace-root-check');
|
args.push('add');
|
||||||
if (opts.saveDev) {
|
if (opts.saveDev) {
|
||||||
args.push('--dev');
|
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
|
// Don't fail if pnpm is being run at the workspace root
|
||||||
|
|||||||
Reference in New Issue
Block a user