forked from todogroup/repolinter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
packagers.js
38 lines (35 loc) · 945 Bytes
/
packagers.js
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
// Copyright 2018 TODO Group. All rights reserved.
// Licensed under the Apache License, Version 2.0.
const Result = require('../lib/result')
module.exports = async function (fileSystem) {
const packageManagerPatterns = {
'pom.xml': 'maven',
'project.xml': 'maven1',
'package.json': 'npm',
'setup.py': 'pypi',
'*.nuspec': 'nuget',
'*.podspec': 'cocoapod',
'Cargo.toml': 'cargo',
'*.gemspec': 'rubygem',
DESCRIPTION: 'cran',
'Makefile.PL': 'cpan',
'Build.PL': 'cpan',
'package.xml': 'pear',
'ivy.xml': 'ivy',
'build.gradle': 'gradle'
}
const packagers = (
await Promise.all(
Object.entries(packageManagerPatterns).map(async ([pattern, packager]) =>
(await fileSystem.findFirst(pattern)) ? packager : null
)
)
).filter(p => p !== null)
return new Result(
'',
packagers.map(p => {
return { passed: true, path: p }
}),
true
)
}