feat: update color usage, telemetry activation logic, and command/util dependencies#3646
Merged
feat: update color usage, telemetry activation logic, and command/util dependencies#3646
Conversation
- Update @heroku-cli/command from ^12.2.2 to ^12.3.1 - Update @heroku/heroku-cli-util from ^10.7.0 to ^10.8.0 - Replace deprecated color.dim() calls with color.gray() and color.inactive() - Update telemetry initialization to use isTelemetryEnabled() helper - Standardize color method usage across all command files
- Fix telemetry tests to enable telemetry in test environment - Set ENABLE_WINDOWS_TELEMETRY for Windows CI compatibility - Add test to verify telemetry is disabled by default on Windows - Properly save/restore environment variables - Fix spaces/format test for updated color.gray() ANSI code - Fix pg:copy test to handle line wrapping differences between CI and local - Normalize whitespace in warning message assertions - Handle oclif's warning prefix (›) in wrapped output - Set FORCE_COLOR=3 in test init to ensure consistent color output All tests now pass in local, Linux CI, and Windows CI environments.
The oclif warning prefix differs between platforms: - Unix/Linux/macOS: › (single angle quote) - Windows: » (double angle quote) Updated the regex to handle both characters when normalizing output.
The telemetry worker was spawned with stderr set to 'inherit', which created a persistent file descriptor reference preventing the parent CLI process from exiting until the worker completed. This caused the CLI to hang for users. Changes: - Only inherit stderr when DEBUG is set (for development) - Worker explicitly closes stderr before exiting (in DEBUG mode) - Uses setImmediate to allow stderr to flush before closing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR updates two key dependencies, refactors color method usage across the codebase, and fixes a telemetry worker issue:
@heroku-cli/commandfrom^12.2.2to^12.3.1@heroku/heroku-cli-utilfrom^10.7.0to^10.8.0color.dim()calls withcolor.gray()andcolor.inactive()isTelemetryEnabled()helper functionUpdating these core dependencies brings some lazy loading improvements to cli execution start time. We also correct many instances of using
ansisdirectly with our own themed color.Also, we changed the logic of
heroku-cli-utilto default to no color in non-tty environments, even if the environment supports truecolor (which is different from default ansis behavior). Right now, our tests actually expect color, even though it's non-tty. So, I've forced colors in init.mjs for now. Long term, I actually think it would be better to have our tests not test for color generally, and then have specific tests for colors where we think it's important. But, that's a change for a future PR.Telemetry Worker Fix
The telemetry worker was spawned with
stderr: 'inherit', creating a persistent file descriptor reference that prevented the parent CLI process from exiting until the worker completed. This caused the CLI to appear to hang for users.Changes:
DEBUGis set (for development debugging)setImmediateto ensure stderr flushes before closingType of Change
Feature Additions (minor semver update)
Patch Updates (patch semver update)
Testing
Steps:
DEBUG=heroku:*is set