@featurevisor/core
Version:
Core package of Featurevisor for Node.js usage
31 lines • 1.26 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateHistory = generateHistory;
const path = require("path");
const fs = require("fs");
async function generateHistory(deps) {
const { projectConfig, datasource } = deps;
try {
const fullHistory = await datasource.listHistoryEntries();
const filteredHistory = fullHistory
.map((historyEntry) => {
return {
...historyEntry,
entities: historyEntry.entities.filter((entity) => {
// ignore test specs
return entity.type !== "test";
}),
};
})
.filter((historyEntry) => historyEntry.entities.length > 0);
const fullHistoryFilePath = path.join(projectConfig.siteExportDirectoryPath, "history-full.json");
fs.writeFileSync(fullHistoryFilePath, JSON.stringify(filteredHistory));
console.log(`History (full) generated at: ${fullHistoryFilePath}`);
return filteredHistory;
}
catch (error) {
console.error(`Error when generating history from git: ${error.status}\n${error.stderr.toString()}`);
return [];
}
}
//# sourceMappingURL=generateHistory.js.map