Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core: Do not add packageManager field to package.json during storybook dev #29152

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions code/core/src/common/js-package-manager/JsPackageManagerFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,17 +125,35 @@ export class JsPackageManagerFactory {
}

function hasNPM(cwd?: string) {
const npmVersionCommand = spawnSync('npm', ['--version'], { cwd, shell: true });
const npmVersionCommand = spawnSync('npm', ['--version'], {
cwd,
shell: true,
env: {
COREPACK_ENABLE_STRICT: '0',
},
});
return npmVersionCommand.status === 0;
}

function hasPNPM(cwd?: string) {
const pnpmVersionCommand = spawnSync('pnpm', ['--version'], { cwd, shell: true });
const pnpmVersionCommand = spawnSync('pnpm', ['--version'], {
cwd,
shell: true,
env: {
COREPACK_ENABLE_STRICT: '0',
},
});
return pnpmVersionCommand.status === 0;
}

function getYarnVersion(cwd?: string): 1 | 2 | undefined {
const yarnVersionCommand = spawnSync('yarn', ['--version'], { cwd, shell: true });
const yarnVersionCommand = spawnSync('yarn', ['--version'], {
cwd,
shell: true,
env: {
COREPACK_ENABLE_STRICT: '0',
},
});

if (yarnVersionCommand.status !== 0) {
return undefined;
Expand Down
Loading