Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/oclif v4 migration #1784

Draft
wants to merge 6 commits into
base: feature/oclif-v4-migration-base
Choose a base branch
from

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
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.

2 participants