fix(core): fix no such file or directory, open 'package-lock.json' (#21835)
Co-authored-by: Miroslav Jonaš <missing.manual@gmail.com>
This commit is contained in:
parent
320b086290
commit
a09e70a291
@ -61,7 +61,7 @@ commands:
|
|||||||
name: Install Dependencies
|
name: Install Dependencies
|
||||||
command: |
|
command: |
|
||||||
pnpm install --frozen-lockfile
|
pnpm install --frozen-lockfile
|
||||||
pnpm playwright install --with-deps firefox webkit chrome
|
pnpm playwright install --with-deps
|
||||||
- save_cache:
|
- save_cache:
|
||||||
name: Save pnpm Package Cache
|
name: Save pnpm Package Cache
|
||||||
key: node-deps-{{ arch }}-v3-{{ checksum "pnpm-lock.yaml" }}
|
key: node-deps-{{ arch }}-v3-{{ checksum "pnpm-lock.yaml" }}
|
||||||
|
|||||||
@ -143,6 +143,19 @@ export function getLockFileName(packageManager: PackageManager): string {
|
|||||||
throw new Error(`Unknown package manager: ${packageManager}`);
|
throw new Error(`Unknown package manager: ${packageManager}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getLockFilePath(packageManager: PackageManager): string {
|
||||||
|
if (packageManager === 'yarn') {
|
||||||
|
return YARN_LOCK_PATH;
|
||||||
|
}
|
||||||
|
if (packageManager === 'pnpm') {
|
||||||
|
return PNPM_LOCK_PATH;
|
||||||
|
}
|
||||||
|
if (packageManager === 'npm') {
|
||||||
|
return NPM_LOCK_PATH;
|
||||||
|
}
|
||||||
|
throw new Error(`Unknown package manager: ${packageManager}`);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create lock file based on the root level lock file and (pruned) package.json
|
* Create lock file based on the root level lock file and (pruned) package.json
|
||||||
*
|
*
|
||||||
@ -157,7 +170,7 @@ export function createLockFile(
|
|||||||
packageManager: PackageManager = detectPackageManager(workspaceRoot)
|
packageManager: PackageManager = detectPackageManager(workspaceRoot)
|
||||||
): string {
|
): string {
|
||||||
const normalizedPackageJson = normalizePackageJson(packageJson);
|
const normalizedPackageJson = normalizePackageJson(packageJson);
|
||||||
const content = readFileSync(getLockFileName(packageManager), 'utf8');
|
const content = readFileSync(getLockFilePath(packageManager), 'utf8');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (packageManager === 'yarn') {
|
if (packageManager === 'yarn') {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user