Skip to content

Commit

Permalink
Merge pull request #670 from oclif/ew/network-mutex
Browse files Browse the repository at this point in the history
Yarn network mutex
  • Loading branch information
iowillhoit authored Sep 22, 2023
2 parents b0e66ec + dd262c8 commit 1aedc10
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/yarn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,16 @@ export default class Yarn {
async exec(args: string[] = [], opts: {cwd: string; verbose: boolean}): Promise<void> {
const cwd = opts.cwd
if (args[0] !== 'run') {
// https://classic.yarnpkg.com/lang/en/docs/cli/#toc-concurrency-and-mutex
// Default port is: 31997
const port = this.config.scopedEnvVar('NETWORK_MUTEX_PORT')
const optionalPort = port ? `:${port}` : ''
const mutex = this.config.scopedEnvVar('USE_NETWORK_MUTEX') ? `network${optionalPort}` : `file:${path.join(cwd, 'yarn.lock')}`
const cacheDir = path.join(this.config.cacheDir, 'yarn')
args = [
...args,
'--non-interactive',
`--mutex=file:${path.join(cwd, 'yarn.lock')}`,
`--mutex=${mutex}`,
`--preferred-cache-folder=${cacheDir}`,
'--check-files',
]
Expand Down

0 comments on commit 1aedc10

Please sign in to comment.