Using:
barrelsby -sqSD -d ./src"
if barrel doesn't exist:
export * from './modules/chrome/chrome.model'
export * from './modules/chrome/chrome.resolver'
export * from './modules/chrome/chrome.service'
export * from './modules/chrome/test'
export * from './modules/user/user.resolver'
export * from './modules/user/user.service'
if barrel already exists:
The error is here:
// Get any typescript modules contained at any depth in the current directory.
function getModules(directory, logger, local) {
logger(`Getting modules @ ${directory.path}`);
if (directory.barrel) {
// If theres a barrel then use that as it *should* contain descendant modules.
logger(`Found existing barrel @ ${directory.barrel.path}`);
return [directory.barrel]; <------------------------------------
}
const files = [].concat(directory.files);
if (!local) {
directory.directories.forEach((childDirectory) => {
// Recurse.
files.push(...getModules(childDirectory, logger, local));
});
}
// Only return files that look like TypeScript modules.
return files.filter((file) => file.name.match(utilities_1.isTypeScriptFile));
}
What is the purpose of returning early?
// If theres a barrel then use that as it should contain descendant modules.
Why should we assume it contains descendent modules...what if someone has added one?
directory.barrel only contains {name, path} of the a barrel file. Is this some sort of regression? I can't figure it out.
Using:
if barrel doesn't exist:
if barrel already exists:
The error is here:
What is the purpose of returning early?
Why should we assume it contains descendent modules...what if someone has added one?
directory.barrelonly contains{name, path}of the a barrel file. Is this some sort of regression? I can't figure it out.