Skip to content

Commit

Permalink
fix: totalDependencyCount
Browse files Browse the repository at this point in the history
  • Loading branch information
Icaruk committed Feb 18, 2024
1 parent a96b1ef commit 2f884e7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
5 changes: 5 additions & 0 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ vars:
sh: 'Powershell.exe -File getPackageVersion.ps1'

tasks:
test:
cmds:
- go test ./...

build:
cmds:
- task: test
- task: prepareDistFolder
- task: setVersion
- echo "Building version {{.VERSION}}"
Expand Down
32 changes: 22 additions & 10 deletions pkg/updater/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,25 @@ func printUpdatablePackagesTable(versionComparison map[string]versionpkg.Version
t.SetOutputMirror(os.Stdout)
t.AppendHeader(table.Row{"Package", "Current", "Latest"})

t.SetColumnConfigs(([]table.ColumnConfig{
{
Name: "Package",
Align: text.AlignLeft,
},
{
Name: "Current",
Align: text.AlignRight,
},
{
Name: "Latest",
Align: text.AlignRight,
},
}))

// Add rows
for key, value := range versionComparison {
latestColorized := versionpkg.ColorizeVersion(value.Latest, value.VersionType)
t.AppendRow(table.Row{key, value.Current, latestColorized}, table.RowConfig{AutoMergeAlign: text.AlignRight})
t.AppendRow(table.Row{key, value.Current, latestColorized})
}

t.Render()
Expand Down Expand Up @@ -348,11 +363,10 @@ func Init(cfg npm.CmdFlags) {
versionComparison := map[string]versionpkg.VersionComparisonItem{}

// Progress bar
maxBar := len(dependencies)
bar := initProgressBar(maxBar)
totalDependencyCount := len(dependencies) + len(devDependencies)
bar := initProgressBar(totalDependencyCount)

// Process dependencies
dependencyCount := len(dependencies)
readDependencies(dependencies, versionComparison, false, bar, cfg.Filter)

// Process devDependencies
Expand All @@ -361,7 +375,7 @@ func Init(cfg npm.CmdFlags) {
}

// Count total dependencies and filtered dependencies
filteredDependencyCount := dependencyCount
filteredDependencyCount := totalDependencyCount
if isFilterFilled {
filteredDependencyCount = len(versionComparison)
}
Expand All @@ -384,7 +398,7 @@ func Init(cfg npm.CmdFlags) {

// Print summary line (1 major, 1 minor, 1 patch)
if isFilterFilled {
fmt.Println("Filtered", aurora.Blue(filteredDependencyCount), "dependencies from a total of", aurora.Blue(dependencyCount))
fmt.Println("Filtered", aurora.Blue(filteredDependencyCount), "dependencies from a total of", aurora.Blue(totalDependencyCount))
} else {
fmt.Println("Total dependencies: ", aurora.Cyan(filteredDependencyCount))
}
Expand Down Expand Up @@ -463,10 +477,8 @@ func Init(cfg npm.CmdFlags) {
urlMetadata := repositorypkg.GetRepositoryUrlMetadata(value.RepositoryUrl)

// Fetch repository from github
// _, err := repositorypkg.FetchRepositoryLatestRelease(urlMetadata.Username, urlMetadata.RepositoryName)
// missingLatestRelease := err != nil

missingLatestRelease := true
_, err := repositorypkg.FetchRepositoryLatestRelease(urlMetadata.Username, urlMetadata.RepositoryName)
missingLatestRelease := err != nil

var changelogMdUrl string

Expand Down

0 comments on commit 2f884e7

Please sign in to comment.