bin/builder.js
function buildBarrel(directory, builder, quoteCharacter, semicolonCharacter, barrelName, logger, baseUrl, local, include, exclude) {
    logger(`Building barrel @ ${directory.path}`);
    const content = builder(directory, modules_1.loadDirectoryModules(directory, logger, include, exclude, local), quoteCharacter, semicolonCharacter, logger, baseUrl);
    const destination = path_1.default.join(directory.path, barrelName);
    if (content.length === 0) {
        // Skip empty barrels.
        return;
    }
    // Add the header
    const contentWithHeader = header_1.addHeaderPrefix(content);
    fs_1.default.writeFileSync(destination, contentWithHeader);
    // Update the file tree model with the new barrel.
    if (!directory.files.some((file) => file.name === barrelName)) {
        const convertedPath = utilities_1.convertPathSeparator(destination);
        const barrel = {
            name: barrelName,
            path: convertedPath
        };
        logger(`Updating model barrel @ ${convertedPath}`);
        directory.files.push(barrel);
        directory.barrel = barrel;
    }
}
function buildBarrel(directory, builder, quoteCharacter, semicolonCharacter, barrelName, logger, baseUrl, local, include, exclude) {
    logger(`Building barrel @ ${directory.path}`);
    const content = builder(directory, modules_1.loadDirectoryModules(directory, logger, include, exclude, local), quoteCharacter, semicolonCharacter, logger, baseUrl);
    const destination = path_1.default.join(directory.path, barrelName);
    if (content.length === 0) {
        // Skip empty barrels.
        return;
    }
    // Add the header
    const contentWithHeader = header_1.addHeaderPrefix(content);
    fs_1.default.writeFileSync(destination, contentWithHeader);
    // Update the file tree model with the new barrel.
    if (!directory.files.some((file) => file.name === barrelName)) {
        const convertedPath = utilities_1.convertPathSeparator(destination);
        const barrel = {
            name: barrelName,
            path: convertedPath
        };
        logger(`Updating model barrel @ ${convertedPath}`);
        directory.files.push(barrel);
        directory.barrel = barrel;
    }
}
function buildBarrel ( directory , builder , quoteCharacter , semicolonCharacter , barrelName , logger , baseUrl , local , include , exclude ) { logger ( ` ${ directory . path } ` ) ; const content = builder ( directory , modules_1 . loadDirectoryModules ( directory , logger , include , exclude , local ) , quoteCharacter , semicolonCharacter , logger , baseUrl ) ; const destination = path_1 . default . join ( directory . path , barrelName ) ; if ( content . length === 0 ) { // Skip empty barrels. return ; } // Add the header const contentWithHeader = header_1 . addHeaderPrefix ( content ) ; fs_1 . default . writeFileSync ( destination , contentWithHeader ) ; // Update the file tree model with the new barrel. if ( ! directory . files . some ( ( file ) => file . name === barrelName ) ) { const convertedPath = utilities_1 . convertPathSeparator ( destination ) ; const barrel = { name : barrelName , path : convertedPath } ; logger ( ` ${ convertedPath } ` ) ; directory . files . push ( barrel ) ; directory . barrel = barrel ; } }
Build a barrel for the specified directory.
Build a barrel for the specified directory .