refactor: handle subpaths
This commit is contained in:
parent
42a40934fa
commit
95d4e2504d
|
@ -1,6 +1,11 @@
|
||||||
import D from 'debug';
|
import D from 'debug';
|
||||||
|
|
||||||
import {basename, extname} from 'path';
|
import {
|
||||||
|
basename,
|
||||||
|
dirname,
|
||||||
|
extname,
|
||||||
|
join,
|
||||||
|
} from 'path';
|
||||||
|
|
||||||
import {camelCase} from './string';
|
import {camelCase} from './string';
|
||||||
|
|
||||||
|
@ -21,7 +26,14 @@ export const decorateWithLatus = (
|
||||||
`decorateWithLatus: require(${path}).default is not a function (from: ${context.id})`,
|
`decorateWithLatus: require(${path}).default is not a function (from: ${context.id})`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const key = transformer(basename(path, extname(path)));
|
const parts = dirname(path).split('/');
|
||||||
|
if ('.' === parts[0]) {
|
||||||
|
parts.shift();
|
||||||
|
}
|
||||||
|
if ('index' === parts[parts.length - 1]) {
|
||||||
|
parts.pop();
|
||||||
|
}
|
||||||
|
const key = transformer(join(parts.join('-'), basename(path, extname(path))));
|
||||||
// eslint-disable-next-line no-param-reassign
|
// eslint-disable-next-line no-param-reassign
|
||||||
Gathered[key] = M(Gathered[key], latus);
|
Gathered[key] = M(Gathered[key], latus);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user