|
|
|
|
@ -128,6 +128,18 @@ function collectPublicSomaComponentDirs(): string[] {
|
|
|
|
|
.sort();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function collectMorfoComponentNamesByScope(scope: string): string[] {
|
|
|
|
|
const root = join(HERE, 'morfo', 'components');
|
|
|
|
|
return readdirSync(root)
|
|
|
|
|
.filter((file) => file.endsWith('.ts') && !file.endsWith('.test.ts'))
|
|
|
|
|
.filter((file) => {
|
|
|
|
|
const source = stripComments(readFileSync(join(root, file), 'utf8'));
|
|
|
|
|
return new RegExp(`scope:\\s*\\[[^\\]]*'${scope}'`).test(source);
|
|
|
|
|
})
|
|
|
|
|
.map((file) => file.replace(/\.ts$/, ''))
|
|
|
|
|
.sort();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function collectComponentLangPathViolations(source: string, file: string): string[] {
|
|
|
|
|
const clean = stripComments(source);
|
|
|
|
|
const violations: string[] = [];
|
|
|
|
|
@ -306,6 +318,10 @@ describe('UIX layer contracts', () => {
|
|
|
|
|
expect(missingExports).toEqual([]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('guards Soma public component modules against Morfo soma scope', () => {
|
|
|
|
|
expect(collectPublicSomaComponentDirs()).toEqual(collectMorfoComponentNamesByScope('soma'));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('guards Soma public component modules with local README docs', () => {
|
|
|
|
|
const missingReadmes = collectPublicSomaComponentDirs().filter(
|
|
|
|
|
(dir) => !existsSync(join(HERE, 'soma', 'components', dir, 'README.md'))
|
|
|
|
|
|