Skip to content

Commit

Permalink
prune/dedupe
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Dickey committed Apr 28, 2016
1 parent aaf78c9 commit e0cfee4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
20 changes: 20 additions & 0 deletions npm.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,26 @@ func (p *Plugins) ClearCache() error {
return cmd.Run()
}

func (p *Plugins) dedupe() error {
cmd, err := p.npmCmd("prune")
if err != nil {
return err
}
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
return cmd.Run()
}

func (p *Plugins) prune() error {
cmd, err := p.npmCmd("prune")
if err != nil {
return err
}
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
return cmd.Run()
}

func (p *Plugins) npmCmd(args ...string) (*exec.Cmd, error) {
if err := os.MkdirAll(p.modulesPath(), 0755); err != nil {
return nil, err
Expand Down
4 changes: 3 additions & 1 deletion setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ var setupCmd = &Command{
for name, v := range pjson["dependencies"].(map[string]interface{}) {
plugins = append(plugins, name+"@"+v.(string))
}
corePlugins.installPackages(plugins...)
ExitIfError(corePlugins.installPackages(plugins...))
ExitIfError(corePlugins.dedupe())
ExitIfError(corePlugins.prune())
for _, plugin := range plugins {
plugin, err := corePlugins.ParsePlugin(strings.Split(plugin, "@")[0])
ExitIfError(err)
Expand Down

0 comments on commit e0cfee4

Please sign in to comment.