Downloading shall actually work

This commit is contained in:
Radon Rosborough 2021-07-10 19:05:00 +00:00
parent fe7a746dc6
commit b05a388e41
1 changed files with 12 additions and 8 deletions

View File

@ -355,14 +355,18 @@ async function getUserInput(prompt) {
prompt: prompt, prompt: prompt,
}); });
rl.prompt(); rl.prompt();
let resolved = false;
const resp = await new Promise((resolve, reject) => { const resp = await new Promise((resolve, reject) => {
rl.on("line", (line) => { rl.on("line", (line) => {
resolved = true;
resolve(line); resolve(line);
}); });
rl.on("close", () => { rl.on("close", () => {
console.log(); if (!resolved) {
console.log(); console.log();
reject(new Error("cancelled")); console.log();
reject(new Error("cancelled"));
}
}); });
}); });
rl.close(); rl.close();
@ -494,7 +498,7 @@ async function executeDepGraph({
hashes.published[name] === hashes.desired[name] && hashes.published[name] === hashes.desired[name] &&
hashes.local[name] !== hashes.desired[name] hashes.local[name] !== hashes.desired[name]
) { ) {
statuses[name] = "downloadFromRegistry"; statuses[name] = "retrieveFromRegistry";
} else { } else {
statuses[name] = "buildLocally"; statuses[name] = "buildLocally";
} }
@ -534,10 +538,10 @@ async function executeDepGraph({
}); });
} }
} else { } else {
if (statuses === "downloadFromRegistry") { if (statuses === "retrieveFromRegistry") {
plan.push({ plan.push({
artifact: dep, artifact: dep,
action: "downloadFromRegistry", action: "retrieveFromRegistry",
}); });
} }
} }
@ -567,7 +571,7 @@ async function executeDepGraph({
} }
const shortnames = { const shortnames = {
buildLocally: "rebuild", buildLocally: "rebuild",
downloadFromRegistry: "download", retrieveFromRegistry: "download",
publishToRegistry: "publish", publishToRegistry: "publish",
}; };
const totals = {}; const totals = {};
@ -584,7 +588,7 @@ async function executeDepGraph({
plan.map(({ artifact, action }) => { plan.map(({ artifact, action }) => {
const desc = { const desc = {
buildLocally: " rebuild", buildLocally: " rebuild",
downloadFromRegistry: "download", retrieveFromRegistry: "download",
publishToRegistry: " publish", publishToRegistry: " publish",
}[action]; }[action];
if (!desc) { if (!desc) {