Fix incomplete render when --mode is used
This commit is contained in:
+12
-1
@@ -10,6 +10,7 @@ import {
|
|||||||
Cache,
|
Cache,
|
||||||
execUtils,
|
execUtils,
|
||||||
hashUtils,
|
hashUtils,
|
||||||
|
InstallMode,
|
||||||
LocatorHash,
|
LocatorHash,
|
||||||
Package,
|
Package,
|
||||||
Project,
|
Project,
|
||||||
@@ -22,8 +23,12 @@ import projectExprTmpl from "./tmpl/yarn-project.nix.in";
|
|||||||
import { tmpdir } from "os";
|
import { tmpdir } from "os";
|
||||||
|
|
||||||
// Generator function that runs after `yarn install`.
|
// Generator function that runs after `yarn install`.
|
||||||
export default async (project: Project, cache: Cache, report: Report) => {
|
export default async (
|
||||||
|
project: Project,
|
||||||
|
opts: { cache: Cache; report: Report; mode?: InstallMode }
|
||||||
|
) => {
|
||||||
const { configuration, cwd } = project;
|
const { configuration, cwd } = project;
|
||||||
|
const { cache, report } = opts;
|
||||||
|
|
||||||
// This case happens with `yarn dlx`, for example, and may cause errors if
|
// This case happens with `yarn dlx`, for example, and may cause errors if
|
||||||
// special settings don't apply to those installations. (Like a `nixExprPath`
|
// special settings don't apply to those installations. (Like a `nixExprPath`
|
||||||
@@ -267,6 +272,11 @@ export default async (project: Project, cache: Cache, report: Report) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Render the Nix expression.
|
// Render the Nix expression.
|
||||||
|
//
|
||||||
|
// If isolated builds are used, we rely on the build state, so don't render
|
||||||
|
// if a special `--mode` was specified. This is because skipping builds may
|
||||||
|
// give us an incomplete build state.
|
||||||
|
if (opts.mode == null || isolatedBuilds.length === 0) {
|
||||||
const ident = project.topLevelWorkspace.manifest.name;
|
const ident = project.topLevelWorkspace.manifest.name;
|
||||||
const projectName = ident ? structUtils.stringifyIdent(ident) : `workspace`;
|
const projectName = ident ? structUtils.stringifyIdent(ident) : `workspace`;
|
||||||
const projectExpr = renderTmpl(projectExprTmpl, {
|
const projectExpr = renderTmpl(projectExprTmpl, {
|
||||||
@@ -293,6 +303,7 @@ export default async (project: Project, cache: Cache, report: Report) => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Preload the cache entries into the Nix store.
|
// Preload the cache entries into the Nix store.
|
||||||
if (
|
if (
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@ const plugin: Plugin<Hooks> = {
|
|||||||
opts.persistProject !== false &&
|
opts.persistProject !== false &&
|
||||||
project.configuration.get(`enableNixify`)
|
project.configuration.get(`enableNixify`)
|
||||||
) {
|
) {
|
||||||
await generate(project, opts.cache, opts.report);
|
await generate(project, opts);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user