Skip to content

Commit

Permalink
fix(expo): pnpm+workspace build (#28209)
Browse files Browse the repository at this point in the history
## Current Behavior

build executors for expo crash when package manager pnpm and workspaces
are used

## Expected Behavior

no crashies

## Related Issue(s)

#28208

Fixes #28208

## FAQ

- why not handle the `undefined` by the calling code instead

The less the calling code knows about inner workings, the better: in
this case, doing this would add the implicit dependency on "pnpm and
workspaces" to the calling code

- but it's an empty function, my performance

We call it once per user interaction.

- but still, it's an empty function

We return an `empty array` when there are no elements; we don't return
`undefined` when the array is empty and `array` when array is non-empty.
Hopefully so.

- but,

The doc also says that this function returns a function.
  • Loading branch information
dearlordylord authored Oct 17, 2024
1 parent f9f3de0 commit 42da542
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/expo/src/executors/build/build.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function copyPackageJsonAndLock(
packageManager: PackageManager,
workspaceRoot: string,
projectRoot: string
) {
): () => void {
const packageJson = pathResolve(workspaceRoot, 'package.json');
const rootPackageJson = readJsonFile<PackageJson>(packageJson);
// do not copy package.json and lock file if workspaces are enabled
Expand All @@ -123,7 +123,8 @@ function copyPackageJsonAndLock(
existsSync(pathResolve(workspaceRoot, 'pnpm-workspace.yaml'))) ||
rootPackageJson.workspaces
) {
return;
// no resource taken, no resource cleaned up
return () => {};
}

const packageJsonProject = pathResolve(projectRoot, 'package.json');
Expand Down

0 comments on commit 42da542

Please sign in to comment.