function publishSummary(version, total, unresolved) {
if (unresolved.length === 0) {
return {
text: `\nPublished sessionwiki ${version}: main + ${total} platform packages, all resolvable.`,
ok: true,
};
}
return {
text:
`\nPublished sessionwiki ${version}, but ${unresolved.length} of ${total + 1} package(s) ` +
`are NOT resolvable yet:\n` +
unresolved.map((s) => ` ${s}`).join("\n") +
`\nInstalling this version now can remove a working platform package and ` +
`install nothing in its place. Wait for the registry and re-check with ` +
`\`npm view <spec> version\` before installing.`,
ok: false,
};
}
function wantedSpecs(scope, platforms, version) {
return [
`${scope}/sessionwiki@${version}`,
...platforms.map((p) => `${scope}/${p.pkg}@${version}`),
];
}
module.exports = { publishSummary, wantedSpecs };