Skip to content

Commit 8f74ed0

Browse files
committed
fix: Fix registry option for ESLint
1 parent 8bc9720 commit 8f74ed0

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

cmd/install.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,20 @@ var installCmd = &cobra.Command{
2020
Long: "Installs all runtimes and tools specified in the project's config-file file.",
2121
Run: func(cmd *cobra.Command, args []string) {
2222
installRuntimes(&cfg.Config)
23-
installTools(&cfg.Config)
23+
installTools(&cfg.Config, registry)
2424
},
2525
}
2626

2727
func installRuntimes(config *cfg.ConfigType) {
28-
err := cfg.InstallRuntimes()
28+
err := cfg.InstallRuntimes(config)
2929
if err != nil {
3030
log.Fatal(err)
3131
}
3232
}
3333

34-
func installTools(config *cfg.ConfigType) {
34+
func installTools(config *cfg.ConfigType, registry string) {
3535
// Use the new tools-installer instead of manual installation
36-
err := cfg.InstallTools()
36+
err := cfg.InstallTools(config, registry)
3737
if err != nil {
3838
log.Fatal(err)
3939
}

config/runtimes-installer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import (
1111
)
1212

1313
// InstallRuntimes installs all runtimes defined in the configuration
14-
func InstallRuntimes() error {
15-
for name, runtimeInfo := range Config.Runtimes() {
14+
func InstallRuntimes(config *ConfigType) error {
15+
for name, runtimeInfo := range config.Runtimes() {
1616
err := InstallRuntime(name, runtimeInfo)
1717
if err != nil {
1818
return fmt.Errorf("failed to install runtime %s: %w", name, err)

config/tools-installer.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import (
1414
)
1515

1616
// InstallTools installs all tools defined in the configuration
17-
func InstallTools() error {
18-
for name, toolInfo := range Config.Tools() {
19-
err := InstallTool(name, toolInfo)
17+
func InstallTools(config *ConfigType, registry string) error {
18+
for name, toolInfo := range config.Tools() {
19+
err := InstallTool(name, toolInfo, registry)
2020
if err != nil {
2121
return fmt.Errorf("failed to install tool %s: %w", name, err)
2222
}
@@ -25,7 +25,7 @@ func InstallTools() error {
2525
}
2626

2727
// InstallTool installs a specific tool
28-
func InstallTool(name string, toolInfo *plugins.ToolInfo) error {
28+
func InstallTool(name string, toolInfo *plugins.ToolInfo, registry string) error {
2929
// Check if the tool is already installed
3030
if isToolInstalled(toolInfo) {
3131
fmt.Printf("Tool %s v%s is already installed\n", name, toolInfo.Version)
@@ -50,10 +50,10 @@ func InstallTool(name string, toolInfo *plugins.ToolInfo) error {
5050
}
5151

5252
// Handle other runtime-based tools
53-
return installRuntimeTool(name, toolInfo)
53+
return installRuntimeTool(name, toolInfo, registry)
5454
}
5555

56-
func installRuntimeTool(name string, toolInfo *plugins.ToolInfo) error {
56+
func installRuntimeTool(name string, toolInfo *plugins.ToolInfo, registry string) error {
5757
// Get the runtime for this tool
5858
runtimeInfo, ok := Config.Runtimes()[toolInfo.Runtime]
5959
if !ok {
@@ -65,7 +65,7 @@ func installRuntimeTool(name string, toolInfo *plugins.ToolInfo) error {
6565
"InstallDir": toolInfo.InstallDir,
6666
"PackageName": toolInfo.Name,
6767
"Version": toolInfo.Version,
68-
"Registry": "", // TODO: Get registry from config
68+
"Registry": registry,
6969
}
7070

7171
// Get package manager binary based on the tool configuration
@@ -76,12 +76,14 @@ func installRuntimeTool(name string, toolInfo *plugins.ToolInfo) error {
7676
}
7777

7878
// Set registry if provided
79-
if toolInfo.RegistryCommand != "" {
79+
if registry != "" {
8080
regCmd, err := executeToolTemplate(toolInfo.RegistryCommand, templateData)
8181
if err != nil {
8282
return fmt.Errorf("failed to prepare registry command: %w", err)
8383
}
8484

85+
log.Printf("Setting registry...\n %s %s\n", packageManagerBinary, regCmd)
86+
8587
if regCmd != "" {
8688
registryCmd := exec.Command(packageManagerBinary, strings.Split(regCmd, " ")...)
8789
if output, err := registryCmd.CombinedOutput(); err != nil {

plugins/tools/eslint/plugin.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ runtime_binaries:
66
execution: node
77
installation:
88
command: "install --prefix {{.InstallDir}} {{.PackageName}}@{{.Version}} @microsoft/eslint-formatter-sarif"
9-
registry_template: "{{if .Registry}}config set registry {{.Registry}}{{end}}"
9+
registry_template: "config set registry {{.Registry}}"
1010
binaries:
1111
- name: eslint
1212
path: "node_modules/.bin/eslint"

0 commit comments

Comments
 (0)