Skip to content

Commit

Permalink
feat: yarn network mutex
Browse files Browse the repository at this point in the history
  • Loading branch information
iowillhoit committed Sep 21, 2023
1 parent b0e66ec commit 68a3054
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/yarn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,17 @@ 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')}`
console.log('mutex', mutex);

Check failure on line 54 in src/yarn.ts

View workflow job for this annotation

GitHub Actions / unit-tests / unit-tests (ubuntu-latest, lts/-1)

Extra semicolon

Check failure on line 54 in src/yarn.ts

View workflow job for this annotation

GitHub Actions / unit-tests / unit-tests (ubuntu-latest, lts/*)

Extra semicolon

Check failure on line 54 in src/yarn.ts

View workflow job for this annotation

GitHub Actions / unit-tests / unit-tests (ubuntu-latest, latest)

Extra semicolon

Check failure on line 54 in src/yarn.ts

View workflow job for this annotation

GitHub Actions / unit-tests / unit-tests (windows-latest, lts/*)

Extra semicolon
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 68a3054

Please sign in to comment.