Merge pull request #56 from stephank/fix/subdir

Fix yarn path when nix expr is in a subdirectory
This commit is contained in:
Stéphan Kochen
2023-01-23 14:06:55 +01:00
committed by GitHub
+6 -4
View File
@@ -47,8 +47,11 @@ export default async (
// Sanity checks. // Sanity checks.
const yarnPathAbs = configuration.get(`yarnPath`); const yarnPathAbs = configuration.get(`yarnPath`);
let yarnPath = ppath.relative(cwd, yarnPathAbs); const nixExprPath = configuration.get(`nixExprPath`);
if (yarnPath.startsWith(`../`)) { let yarnPath: PortablePath;
if (yarnPathAbs.startsWith(cwd)) {
yarnPath = ppath.relative(ppath.dirname(nixExprPath), yarnPathAbs);
} else {
yarnPath = yarnPathAbs; yarnPath = yarnPathAbs;
report.reportWarning( report.reportWarning(
0, 0,
@@ -79,7 +82,6 @@ export default async (
} }
// Determine relative paths for Nix path literals. // Determine relative paths for Nix path literals.
const nixExprPath = configuration.get(`nixExprPath`);
const lockfileFilename = configuration.get(`lockfileFilename`); const lockfileFilename = configuration.get(`lockfileFilename`);
// Build a list of cache entries so Nix can fetch them. // Build a list of cache entries so Nix can fetch them.
@@ -284,7 +286,7 @@ export default async (
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,
}); });
await xfs.writeFilePromise(configuration.get(`nixExprPath`), projectExpr); await xfs.writeFilePromise(nixExprPath, projectExpr);
// Create a wrapper if it does not exist yet. // Create a wrapper if it does not exist yet.
if (configuration.get(`generateDefaultNix`)) { if (configuration.get(`generateDefaultNix`)) {