diff --git a/README.md b/README.md index 10515e6..549c726 100644 --- a/README.md +++ b/README.md @@ -42,14 +42,14 @@ etherscan version Install the CLI globally: ```sh -npm install -g @etherscan/etherscan +npm install -g @etherscan/cli etherscan version ``` Or run it once without keeping a global installation: ```sh -npx @etherscan/etherscan version +npx @etherscan/cli version ``` The npm package downloads the matching native release archive and verifies its SHA-256 checksum during installation. Lifecycle scripts must be enabled. @@ -393,7 +393,7 @@ Update through the same channel used to install the CLI: | Installation channel | Update command | | --- | --- | | Homebrew | `brew upgrade etherscan/etherscan-cli/etherscan` | -| npm | `npm install -g @etherscan/etherscan@latest` | +| npm | `npm install -g @etherscan/cli@latest` | | macOS/Linux or Windows installer script | `etherscan update` | | Go | `go install github.com/etherscan/etherscan-cli/cmd/etherscan@latest` | | Manual release archive | Download and verify the new archive from [GitHub Releases](https://github.com/etherscan/etherscan-cli/releases/latest) | diff --git a/internal/cli/root.go b/internal/cli/root.go index 19555c6..bc0e599 100644 --- a/internal/cli/root.go +++ b/internal/cli/root.go @@ -604,7 +604,7 @@ func updateCommand(info BuildInfo, updates updateManager) *cobra.Command { detectedMethod := updates.DetectMethod() if detectedMethod == updater.MethodNPM { fmt.Fprintln(cmd.OutOrStdout(), "This installation is managed by npm. Run:") - fmt.Fprintln(cmd.OutOrStdout(), " npm install -g @etherscan/etherscan@latest") + fmt.Fprintln(cmd.OutOrStdout(), " npm install -g @etherscan/cli@latest") return nil } if method == "" { @@ -612,7 +612,7 @@ func updateCommand(info BuildInfo, updates updateManager) *cobra.Command { } if method == updater.MethodNPM { fmt.Fprintln(cmd.OutOrStdout(), "This installation is managed by npm. Run:") - fmt.Fprintln(cmd.OutOrStdout(), " npm install -g @etherscan/etherscan@latest") + fmt.Fprintln(cmd.OutOrStdout(), " npm install -g @etherscan/cli@latest") return nil } fmt.Fprintf(cmd.OutOrStdout(), "Updating Etherscan CLI %s -> %s using %s...\n", result.Current, result.Latest, method) @@ -656,7 +656,7 @@ func offerUpdate(ctx context.Context, updates updateManager, current string, in method := updates.DetectMethod() if method == updater.MethodNPM { fmt.Fprintln(out, "This installation is managed by npm. Run:") - fmt.Fprintln(out, " npm install -g @etherscan/etherscan@latest") + fmt.Fprintln(out, " npm install -g @etherscan/cli@latest") return true, nil } fmt.Fprintf(out, "Updating with %s...\n", method) diff --git a/internal/cli/update_test.go b/internal/cli/update_test.go index 3209474..41e3487 100644 --- a/internal/cli/update_test.go +++ b/internal/cli/update_test.go @@ -86,7 +86,7 @@ func TestOfferUpdateChoices(t *testing.T) { if err != nil || !exit || manager.upgradedVersion != "" { t.Fatalf("unexpected result: exit=%v err=%v manager=%+v", exit, err, manager) } - if !strings.Contains(out.String(), "npm install -g @etherscan/etherscan@latest") { + if !strings.Contains(out.String(), "npm install -g @etherscan/cli@latest") { t.Fatalf("output = %q, want npm install instruction", out.String()) } }) @@ -126,7 +126,7 @@ func TestUpdateCommandShowsNPMInstruction(t *testing.T) { if manager.upgradedVersion != "" { t.Fatalf("npm update invoked updater: %+v", manager) } - if !strings.Contains(out.String(), "npm install -g @etherscan/etherscan@latest") { + if !strings.Contains(out.String(), "npm install -g @etherscan/cli@latest") { t.Fatalf("output = %q, want npm install instruction", out.String()) } } @@ -147,7 +147,7 @@ func TestUpdateCommandCannotForceScriptForNPMInstallation(t *testing.T) { if manager.upgradedVersion != "" { t.Fatalf("npm update invoked forced script updater: %+v", manager) } - if !strings.Contains(out.String(), "npm install -g @etherscan/etherscan@latest") { + if !strings.Contains(out.String(), "npm install -g @etherscan/cli@latest") { t.Fatalf("output = %q, want npm install instruction", out.String()) } } diff --git a/internal/updater/upgrade.go b/internal/updater/upgrade.go index 13b92b3..2ec5e3e 100644 --- a/internal/updater/upgrade.go +++ b/internal/updater/upgrade.go @@ -33,7 +33,7 @@ func (s *Service) DetectMethod() string { executable = resolved } normalized := strings.ToLower(filepath.ToSlash(executable)) - if strings.Contains(normalized, "/node_modules/@etherscan/etherscan/") { + if strings.Contains(normalized, "/node_modules/@etherscan/cli/") { return MethodNPM } if strings.Contains(normalized, "/cellar/etherscan/") || strings.Contains(normalized, "/linuxbrew/.linuxbrew/cellar/etherscan/") { @@ -62,7 +62,7 @@ func (s *Service) Upgrade(ctx context.Context, method, version string, stdout, s return false, fmt.Errorf("unsupported update method %q (use homebrew, npm, or script)", method) } if method == MethodNPM { - return false, fmt.Errorf("npm manages this installation; run npm install -g @etherscan/etherscan@latest") + return false, fmt.Errorf("npm manages this installation; run npm install -g @etherscan/cli@latest") } if method == MethodHomebrew { if _, err := s.lookPath()("brew"); err != nil { diff --git a/internal/updater/upgrade_test.go b/internal/updater/upgrade_test.go index 91b523c..ee34089 100644 --- a/internal/updater/upgrade_test.go +++ b/internal/updater/upgrade_test.go @@ -24,7 +24,7 @@ func TestDetectMethod(t *testing.T) { t.Fatalf("DetectMethod() = %q, want %q", got, MethodScript) } service.Executable = func() (string, error) { - return filepath.Join(string(filepath.Separator), "usr", "lib", "node_modules", "@etherscan", "etherscan", "vendor", "etherscan"), nil + return filepath.Join(string(filepath.Separator), "usr", "lib", "node_modules", "@etherscan", "cli", "vendor", "etherscan"), nil } if got := service.DetectMethod(); got != MethodNPM { t.Fatalf("DetectMethod() = %q, want %q", got, MethodNPM) @@ -39,7 +39,7 @@ func TestDetectMethod(t *testing.T) { func TestNPMUpgradeReturnsPackageManagerInstruction(t *testing.T) { service := NewService() _, err := service.Upgrade(context.Background(), MethodNPM, "1.2.0", &bytes.Buffer{}, &bytes.Buffer{}) - if err == nil || !strings.Contains(err.Error(), "npm install -g @etherscan/etherscan@latest") { + if err == nil || !strings.Contains(err.Error(), "npm install -g @etherscan/cli@latest") { t.Fatalf("Upgrade() error = %v, want npm install instruction", err) } } diff --git a/npm/bin/etherscan.js b/npm/bin/etherscan.js index 601d7b9..a413f15 100644 --- a/npm/bin/etherscan.js +++ b/npm/bin/etherscan.js @@ -16,7 +16,7 @@ const executable = path.join( if (!fs.existsSync(executable)) { console.error( "Etherscan CLI is not installed in this npm package. " + - "Reinstall @etherscan/etherscan without --ignore-scripts.", + "Reinstall @etherscan/cli without --ignore-scripts.", ); process.exit(1); } diff --git a/npm/prepublish-check.js b/npm/prepublish-check.js index 0bdf4b6..90e8322 100644 --- a/npm/prepublish-check.js +++ b/npm/prepublish-check.js @@ -10,6 +10,6 @@ try { throw new Error(`invalid release version: ${packageInfo.version}`); } } catch (error) { - console.error(`Refusing to publish @etherscan/etherscan: ${error.message}`); + console.error(`Refusing to publish @etherscan/cli: ${error.message}`); process.exit(1); } diff --git a/package-lock.json b/package-lock.json index 04773b0..bac5f9f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "@etherscan/etherscan", + "name": "@etherscan/cli", "version": "0.0.0-development", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "@etherscan/etherscan", + "name": "@etherscan/cli", "version": "0.0.0-development", "hasInstallScript": true, "license": "MIT", diff --git a/package.json b/package.json index da26888..0993a67 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@etherscan/etherscan", + "name": "@etherscan/cli", "version": "0.0.0-development", "description": "Command-line client and interactive explorer for the Etherscan V2 API", "license": "MIT",