Skip to content

Commit

Permalink
feat: detect languages, payload is now mergeable
Browse files Browse the repository at this point in the history
  • Loading branch information
bodinsamuel committed Apr 26, 2023
1 parent d0d9332 commit a615b3a
Show file tree
Hide file tree
Showing 9 changed files with 4,586 additions and 29 deletions.
22 changes: 22 additions & 0 deletions src/analyser/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ describe('techAnalyser', () => {
});

expect(res.toJson()).toStrictEqual({
name: 'main',
path: '/',
tech: null,
services: [
{
edges: [],
Expand Down Expand Up @@ -61,12 +64,31 @@ describe('techAnalyser', () => {
'docker',
'stylelint',
'nodejs',
'javascript',
'fastify',
'prisma',
'react',
'vite',
'html',
'scss',
'css',
'shell',
'terraform',
],
languages: {
CSS: 1,
HCL: 31,
HTML: 2,
JSON: 17,
JavaScript: 4,
Markdown: 2,
Prisma: 1,
SCSS: 80,
Shell: 3,
TypeScript: 427,
XML: 1,
YAML: 2,
},
});
});
});
5 changes: 3 additions & 2 deletions src/analyser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async function recursive(
continue;
}

res.forEach((service) => pl.addService(service));
pl.merge(res);
}

// Detect Tech
Expand All @@ -39,6 +39,7 @@ async function recursive(
// Recursively dive in folders
for (const file of files) {
if (file.type === 'file') {
pl.detectLang(file.name);
continue;
}
if (IGNORED_DIVE_PATHS.includes(file.name)) {
Expand All @@ -53,7 +54,7 @@ export async function techAnalyser(
opts: TechAnalyserOptions
): Promise<Payload> {
const provider = opts.provider;
const pl = new Payload();
const pl = new Payload('main', '/');

await recursive(provider, pl, '/');

Expand Down

0 comments on commit a615b3a

Please sign in to comment.