@eagleoutice/flowr-dev
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
32 lines • 1.73 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.cranDatabaseAvailable = cranDatabaseAvailable;
exports.missingSigDbWarning = missingSigDbWarning;
exports.warnMissingSigDb = warnMissingSigDb;
const manifest_1 = require("../../project/sigdb/manifest");
const ansi_1 = require("../../util/text/ansi");
/** Whether a CRAN signature database is installed, i.e. more than the `base` shard every checkout ships. */
function cranDatabaseAvailable() {
return (0, manifest_1.defaultSigDbPath)('current') !== undefined || (0, manifest_1.defaultSigDbPath)('full') !== undefined;
}
/** The warning shown when a page that documents the signature database is generated without one. */
function missingSigDbWarning(target) {
const warn = (s) => ansi_1.ansiFormatter.format(s, { color: 3 /* Colors.Yellow */, effect: ansi_1.ColorEffect.Foreground });
return warn(`
${(0, ansi_1.bold)('!! no signature database installed !!', ansi_1.ansiFormatter)}
[${target}] documents the signature database, but only the bundled base shard is present.
Generating it now would replace the committed page with base-R-only numbers and examples.
Run ${(0, ansi_1.bold)('npm run sync:sigdb', ansi_1.ansiFormatter)} first (see wiki/Signature Database), or leave the page as it is.`);
}
/**
* Warns that `target` documents the signature database while none is installed, so whatever it would write
* shows base R alone. Returns whether the database is missing, so a caller can skip the page instead.
*/
function warnMissingSigDb(target) {
if (cranDatabaseAvailable()) {
return false;
}
console.warn(missingSigDbWarning(target));
return true;
}
//# sourceMappingURL=doc-sigdb.js.map