Fix missing PnP linkers if node_modules exists
This can happen because some tools write to `node_modules/.cache` as a convention.
This commit is contained in:
@@ -325,6 +325,8 @@ export default async (
|
|||||||
ISOLATED: isolatedCode.join("\n"),
|
ISOLATED: isolatedCode.join("\n"),
|
||||||
ISOLATED_INTEGRATION: indent(" ", isolatedIntegration.join("\n")),
|
ISOLATED_INTEGRATION: indent(" ", isolatedIntegration.join("\n")),
|
||||||
NEED_ISOLATED_BUILD_SUPPRORT: isolatedIntegration.length > 0,
|
NEED_ISOLATED_BUILD_SUPPRORT: isolatedIntegration.length > 0,
|
||||||
|
USES_PNP_LINKER: configuration.get("nodeLinker") === "pnp",
|
||||||
|
USES_NM_LINKER: configuration.get("nodeLinker") === "node-modules",
|
||||||
});
|
});
|
||||||
await xfs.writeFilePromise(nixExprPath, projectExpr);
|
await xfs.writeFilePromise(nixExprPath, projectExpr);
|
||||||
|
|
||||||
|
|||||||
@@ -174,14 +174,13 @@ let
|
|||||||
cp ${lockfile} "$out/libexec/$name/yarn.lock"
|
cp ${lockfile} "$out/libexec/$name/yarn.lock"
|
||||||
cp --recursive .yarn "$out/libexec/$name"
|
cp --recursive .yarn "$out/libexec/$name"
|
||||||
|
|
||||||
# If the project uses the node-modules linker, then
|
# Copy the Yarn linker output into the package.
|
||||||
# include the node_modules folder in the package.
|
#@@ IF USES_PNP_LINKER
|
||||||
if [ -d node_modules ]; then
|
|
||||||
cp --recursive node_modules "$out/libexec/$name"
|
|
||||||
else
|
|
||||||
# Otherwise, assume PnP. Copy the loader into the package.
|
|
||||||
cp .pnp.* "$out/libexec/$name"
|
cp .pnp.* "$out/libexec/$name"
|
||||||
fi
|
#@@ ENDIF USES_PNP_LINKER
|
||||||
|
#@@ IF USES_NM_LINKER
|
||||||
|
cp --recursive node_modules "$out/libexec/$name"
|
||||||
|
#@@ ENDIF USES_NM_LINKER
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "$out/libexec/$name"
|
cd "$out/libexec/$name"
|
||||||
@@ -190,10 +189,10 @@ let
|
|||||||
mkdir -p "$out/bin"
|
mkdir -p "$out/bin"
|
||||||
yarn nixify install-bin $out/bin
|
yarn nixify install-bin $out/bin
|
||||||
|
|
||||||
|
#@@ IF USES_NM_LINKER
|
||||||
# A package with node_modules doesn't need the cache
|
# A package with node_modules doesn't need the cache
|
||||||
if [ -d node_modules ]; then
|
|
||||||
yarn cache clean
|
yarn cache clean
|
||||||
fi
|
#@@ ENDIF USES_NM_LINKER
|
||||||
|
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|||||||
Reference in New Issue
Block a user