-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.barro.config.cjs
40 lines (38 loc) · 1.33 KB
/
.barro.config.cjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const { readFileSync } = require('fs');
module.exports = () => [
{
matchDirectory: 'src/calendar/core',
match: '*.ts',
out: 'src/calendar/core/index.ts',
template: ({ files }) => files.map((file) => `export { ${file.name} } from './${file.path}';`).join('\n') + '\n',
},
{
matchDirectory: 'src/calendar',
match: '*.ts',
matchIgnore: ['HinduAlgorithms.ts'],
out: 'src/calendar/index.ts',
template: ({ files }) => files.map((file) => `export { ${file.name} } from './${file.path}';`).join('\n') + '\n',
},
{
matchDirectory: 'src',
match: '**/*.ts',
matchIgnore: ['create-dist-package.json.ts', '**/HinduAlgorithms.ts'],
ignoreBarrels: false,
out: 'src/index.ts',
template: ({ files }) =>
files
.map((file) => {
let exports = `export { ${file.name} }`;
if ('Astro' === file.name || 'Const' === file.name) {
const content = readFileSync(`${file.absolutePath}`, 'utf8');
// exports = content
// .replace(/(\r\n|\n|\r)/gm, ' ')
// .replace(/^.*export {(.+)}.+$/gm, '$1')
// .replace(/ [ ]+/, ' ');
exports = content.replace(/^[\s\S]*(export {[\s\S]+})[\s\S]*$/gm, '$1');
}
return `${exports} from './${file.path}';`;
})
.join('\n') + '\n',
},
];