rush-archive-project-plugin
Version:
Rush plugin to archive project
70 lines • 2.56 kB
JavaScript
;
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertProjectMetadataToMD = void 0;
var json2md_1 = __importDefault(require("json2md"));
// Generate a md file with the corresponding json content for archived projects
var convertProjectMetadataToMD = function (archivedProjectMetadataObject) {
var e_1, _a;
// Try saving a md file of this json file
var mdFileContents = [
{ h2: "Archived Projects" }
];
var tableRows = [];
try {
for (var _b = __values(Object.entries(archivedProjectMetadataObject)), _c = _b.next(); !_c.done; _c = _b.next()) {
var _d = __read(_c.value, 2), projectName = _d[0], projectMetadata = _d[1];
tableRows.push([
projectName,
projectMetadata.checkpointBranch,
projectMetadata.description,
projectMetadata.archivedOn
]);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
mdFileContents.push({
table: {
headers: ["Project Name", "Checkpoint Branch", "Description", "Archive Date"],
rows: tableRows
}
});
return (0, json2md_1.default)(mdFileContents);
};
exports.convertProjectMetadataToMD = convertProjectMetadataToMD;
//# sourceMappingURL=generateMD.js.map