Fix install for projects with workspaces

This commit is contained in:
Stéphan Kochen
2023-01-23 14:34:41 +01:00
parent 34930ea160
commit 721d643e11
+7 -1
View File
@@ -154,8 +154,13 @@ let
mkdir -p "$out/libexec/$name" "$out/bin"
# Move the package contents to the output directory.
if grep -q '"workspaces"' package.json; then
# We can't use `yarn pack` in a workspace setup, because it only
# packages the outer workspace.
mv $PWD "$out/libexec/$name"
else
# - If the package.json has a `files` field, only files matching those patterns are copied
# - Otherwise all files are copied
# - Otherwise all files are copied.
yarn pack --out package.tgz
tar xzvf package.tgz --directory "$out/libexec/$name" --strip-components=1
@@ -170,6 +175,7 @@ let
# Otherwise, assume PnP. Copy the loader into the package.
cp .pnp.* "$out/libexec/$name"
fi
fi
cd "$out/libexec/$name"