Runner: Erkennung pnpm/yarn-Details
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e2c517a015
commit
b8174e296a
2 files changed
+9
-3
No files matched your search
@@ -33,13 +33,14 @@ function installCmd(pm, files) {
|
|||||||
? ['npm', 'ci', '--include=dev']
|
? ['npm', 'ci', '--include=dev']
|
||||||
: ['npm', 'install', '--include=dev', '--no-audit', '--no-fund'];
|
: ['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'];
|
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) {
|
function devCmdFor(pm, port) {
|
||||||
const args = ['--host', '0.0.0.0', '--port', String(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 } = {}) {
|
export function detectProject(files, { mode, index, previewJson } = {}) {
|
||||||
|
|||||||
@@ -38,7 +38,12 @@ test('pnpm-lock ⇒ pnpm', () => {
|
|||||||
assert.equal(r.pm, 'pnpm');
|
assert.equal(r.pm, 'pnpm');
|
||||||
assert.deepEqual(r.install, ['pnpm', 'install', '--frozen-lockfile']);
|
assert.deepEqual(r.install, ['pnpm', 'install', '--frozen-lockfile']);
|
||||||
assert.deepEqual(r.buildCmd, ['pnpm', 'run', 'build']);
|
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', () => {
|
test('yarn.lock und bun.lockb/bun.lock', () => {
|
||||||
|
|||||||
Reference in new issue
Block a user