declapract
Version:
A tool to declaratively define best practices, maintainable evolve them, and scalably enforce them.
29 lines • 1.71 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.readExampleDeclarations = void 0;
const ExampleDeclaration_1 = require("../../../domain/objects/ExampleDeclaration");
const listPathsInDirectory_1 = require("../../../utils/filepaths/listPathsInDirectory");
const readExampleDeclarations = (_a) => __awaiter(void 0, [_a], void 0, function* ({ declarationsRootDirectory, declaredExamplesDirectory, }) {
const exampleDirectories = yield (0, listPathsInDirectory_1.listPathsInDirectory)({
directory: declaredExamplesDirectory,
});
const examples = exampleDirectories.map((directory) => {
const name = directory;
return new ExampleDeclaration_1.ExampleDeclaration({
name,
exampleRootDirectory: `${declaredExamplesDirectory}/${directory}`.replace(`${declarationsRootDirectory}/`, ''),
});
});
return examples;
});
exports.readExampleDeclarations = readExampleDeclarations;
//# sourceMappingURL=readExampleDeclarations.js.map