Skip to content

Commit

Permalink
feat: detect if typescript project
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmanuelDemey committed Sep 6, 2024
1 parent 4030a9b commit 24054d1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
23 changes: 22 additions & 1 deletion audit/apps/audit/src/parsers/file-system-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,23 @@ const nodePackageManager = {
'yarn.lock': 'yarn',
};

const isTypescriptProject: Parser = (rootPath) => {
const files = new fdir()
.filter(
(path) =>
!path.includes('node_modules') &&
!path.includes('.nx') &&
!path.includes('tmp') &&
!path.includes('dist')
)
.filter((path) => path.endsWith('tsconfig.json'))
.withFullPaths()
.crawl(rootPath)
.sync();

return { name: 'typescript', result: files.length > 0 };
};

const getPackageManagerConfigurationFilePath: Parser = (rootPath) => {
const files = new fdir()
.filter(
Expand Down Expand Up @@ -55,7 +72,11 @@ const getPackageManager: Parser = (rootPath) => {
};

export class FileSystemParser {
#parsers = [getPackageManagerConfigurationFilePath, getPackageManager];
#parsers = [
getPackageManagerConfigurationFilePath,
getPackageManager,
isTypescriptProject,
];
#crawler: any;
constructor() {}

Expand Down
2 changes: 1 addition & 1 deletion audit/demo-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
only-parser: false
only-parser: true
urls:
- https://www.emmanueldemey.dev/

0 comments on commit 24054d1

Please sign in to comment.