Skip to content

Conversation

@shafeeqd959
Copy link
Contributor

@shafeeqd959 shafeeqd959 commented Feb 27, 2025

Migration to oclif v4

Summary

This PR migrates our CLI from oclif v3 to oclif v4, updating dependencies and adapting to the latest changes in the oclif ecosystem.

Dependencies Updated

  • oclif: ^3.17.2 → ^4.17.30
  • eslint-config-oclif: ^4.0.0 → ^6.0.15
  • @oclif/core: ^3.27.0 → ^4.2.7
  • @oclif/plugin-help: ^5.2.20 → ^6.2.25
  • @oclif/plugin-not-found: ^2.4.3 → ^3.2.42

Key Changes in oclif v4

One of the major changes in this version is the slimmer ux module, where many methods have been removed or replaced with alternatives. The retained, renamed, and new methods are:

Unchanged:

  • colorize, error, exit, action, warn

Renamed:

  • stdout → ux.log
  • stderr → ux.logToStderr

New:

  • colorizeJson (Applies color theme to JSON)

Removed:

  • annotation, anykey, confirm, debug, done, flush, info, progress, prompt, styledHeader, styledJSON, styledObject, table, trace, tree, url, wait

Read more : https://github.com/oclif/core/releases/tag/4.0.0

Implementation

Since we maintain our own cliux module, which internally uses oclif core ux, the migration was streamlined. The key changes include:

  • Updated Contentstack CLI Utilities plugin to align with oclif v4
  • Migrated:
    • log → stdout
    • prompt → inquirer prompt
    • confirm → inquirer confirm
    • table → tty-table

Table Migration:

  • Introduced cliux.table and cliux.table2

    • cliux.table supports the current table format and internally converts data to the new format
    • cliux.table2 is the completely new implementation
  • Updated all plugins in the GitHub repository to reflect these changes

Pending Work

  • Audit plugin table migration
  • Flags support in new table plugin

@shafeeqd959 shafeeqd959 changed the base branch from development to feature/oclif-v4-migration-base February 27, 2025 09:03
@shafeeqd959 shafeeqd959 marked this pull request as ready for review March 3, 2025 08:49
@shafeeqd959 shafeeqd959 requested a review from a team as a code owner March 3, 2025 08:49
@shafeeqd959 shafeeqd959 merged commit c616ffd into feature/oclif-v4-migration-base Mar 3, 2025
4 checks passed
@shafeeqd959 shafeeqd959 deleted the feature/oclif-v4-migration branch March 3, 2025 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants