diff --git a/runner/src/detect.js b/runner/src/detect.js index 52952c4..5886985 100644 --- a/runner/src/detect.js +++ b/runner/src/detect.js @@ -33,13 +33,14 @@ function installCmd(pm, files) { ? ['npm', 'ci', '--include=dev'] : ['npm', 'install', '--include=dev', '--no-audit', '--no-fund']; } + if (pm === 'yarn' && files.has('.yarnrc.yml')) return ['yarn', 'install', '--immutable']; // Yarn Berry return [pm, 'install', '--frozen-lockfile']; } -// npm/pnpm brauchen `--` vor den Skript-Argumenten, yarn/bun reichen sie direkt durch. +// Nur npm braucht `--` vor den Skript-Argumenten, pnpm/yarn/bun reichen sie direkt durch. function devCmdFor(pm, port) { const args = ['--host', '0.0.0.0', '--port', String(port)]; - return pm === 'npm' || pm === 'pnpm' ? [pm, 'run', 'dev', '--', ...args] : [pm, 'run', 'dev', ...args]; + return pm === 'npm' ? [pm, 'run', 'dev', '--', ...args] : [pm, 'run', 'dev', ...args]; } export function detectProject(files, { mode, index, previewJson } = {}) { diff --git a/runner/test/detect.test.js b/runner/test/detect.test.js index 01ae6e7..d51b063 100644 --- a/runner/test/detect.test.js +++ b/runner/test/detect.test.js @@ -38,7 +38,12 @@ test('pnpm-lock ⇒ pnpm', () => { assert.equal(r.pm, 'pnpm'); assert.deepEqual(r.install, ['pnpm', 'install', '--frozen-lockfile']); assert.deepEqual(r.buildCmd, ['pnpm', 'run', 'build']); - assert.deepEqual(r.devCmd, ['pnpm', 'run', 'dev', '--', '--host', '0.0.0.0', '--port', '5173']); + assert.deepEqual(r.devCmd, ['pnpm', 'run', 'dev', '--host', '0.0.0.0', '--port', '5173']); +}); + +test('yarn Berry (.yarnrc.yml) ⇒ --immutable', () => { + const r = detectProject(fake({ 'package.json': pkg({ build: 'x' }), 'yarn.lock': '', '.yarnrc.yml': '' }), {}); + assert.deepEqual(r.install, ['yarn', 'install', '--immutable']); }); test('yarn.lock und bun.lockb/bun.lock', () => {