Skip to content

Commit

Permalink
fix(core): fix no such file or directory, open 'package-lock.json' (#…
Browse files Browse the repository at this point in the history
…21835)

Co-authored-by: Miroslav Jonaš <missing.manual@gmail.com>
  • Loading branch information
alonronin and meeroslav committed Mar 6, 2024
1 parent 320b086 commit a09e70a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ commands:
name: Install Dependencies
command: |
pnpm install --frozen-lockfile
pnpm playwright install --with-deps firefox webkit chrome
pnpm playwright install --with-deps
- save_cache:
name: Save pnpm Package Cache
key: node-deps-{{ arch }}-v3-{{ checksum "pnpm-lock.yaml" }}
Expand Down
15 changes: 14 additions & 1 deletion packages/nx/src/plugins/js/lock-file/lock-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,19 @@ export function getLockFileName(packageManager: PackageManager): string {
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
*
Expand All @@ -157,7 +170,7 @@ export function createLockFile(
packageManager: PackageManager = detectPackageManager(workspaceRoot)
): string {
const normalizedPackageJson = normalizePackageJson(packageJson);
const content = readFileSync(getLockFileName(packageManager), 'utf8');
const content = readFileSync(getLockFilePath(packageManager), 'utf8');

try {
if (packageManager === 'yarn') {
Expand Down

0 comments on commit a09e70a

Please sign in to comment.