Isolated builds of dependencies

This commit is contained in:
Stéphan Kochen
2021-04-30 11:39:05 +02:00
parent 0f378786d6
commit 153254f62a
14 changed files with 578 additions and 133 deletions
+5 -6
View File
@@ -4,16 +4,16 @@ import {
Cache,
CommandContext,
Configuration,
LocatorHash,
Project,
StreamReport,
structUtils,
} from "@yarnpkg/core";
// Internal command that fetches a single locator.
// Used from within Nix to build the cache for the project.
export default class FetchOneCommand extends Command<CommandContext> {
@Command.String()
locatorHash: string = ``;
locator: string = ``;
@Command.Path(`nixify`, `fetch-one`)
async execute() {
@@ -29,11 +29,10 @@ export default class FetchOneCommand extends Command<CommandContext> {
const report = await StreamReport.start(
{ configuration, stdout: this.context.stdout },
async (report) => {
const pkg = project.originalPackages.get(
this.locatorHash as LocatorHash
);
const { locatorHash } = structUtils.parseLocator(this.locator, true);
const pkg = project.originalPackages.get(locatorHash);
if (!pkg) {
report.reportError(0, `Invalid locator hash`);
report.reportError(0, `Invalid locator`);
return;
}