-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweb-components-maturity-checker.go
57 lines (50 loc) · 1.29 KB
/
web-components-maturity-checker.go
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package main
import (
"fmt"
cd "github.com/ypetya/web-components-maturity-checker/component_detector"
config "github.com/ypetya/web-components-maturity-checker/config"
s "github.com/ypetya/web-components-maturity-checker/source_scanner"
"os"
)
func debug() bool {
if len(os.Args) > 1 && os.Args[1] == "debug" {
return true
}
return false
}
func main() {
if c, err := config.Load("./config.json"); err != nil {
panic(err)
} else {
// print config
if debug() {
fmt.Println("Component library name:", c.ComponentLibraryName)
fmt.Println("Component folder:", c.ComponentFolder)
fmt.Println("Source folders:")
}
for i, _ := range c.SourceFolders {
c.SourceFolders[i].ResolvePackageJson(c.ComponentLibraryName)
if debug() {
v := c.SourceFolders[i]
fmt.Println(i, v.Name, ":", v.Folder, "Version:", v.Version)
}
}
// discover components
components, _ := cd.Detect(c.ComponentFolder, c.ComponentExtension)
var componentKeys []string
for component := range components {
if debug() {
fmt.Println("Component:", component)
}
componentKeys = append(componentKeys, component)
}
// detect
stats := s.Scan(&c.SourceFolders, &componentKeys)
// print output
if debug() {
fmt.Println(" *** Stats ")
stats.Debug()
}
stats.PrintMarkDown()
}
}