oclif / oclif/core

outdated CJS-only dependencies

Open
#1,450 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
316
Forks
98
Avg merge
12h 32m
Merged PRs (30d)
2

Description

This issue tracks some of the dependencies that are at least 1 major behind but cannot update b/c they don't have CJS builds (which breaks supported CJS CLIs):

The following deps come (mostly?) fromsindresorhus and have switched to ESM-only builds in a major:

  • is-wsl using v2, latest is v3
  • widest-line using v3, latest is v5
  • string-width using v4, latest is v7
  • supports-color using v8, latest is 10

As long as we keep supporting CJS we should either replace usage of these deps or wait until node stabilizes requireing ESM from CJS (currently in RC state):
https://nodejs.org/api/modules.html#loading-ecmascript-modules-using-require

One of the requirements for this to work is that the ESM modules should not have TLA, is-wsl doesn't:
https://github.com/sindresorhus/is-wsl/blob/main/index.js

If all of the listed deps don't have TLA in their exports, the feature is GA and supported in our minimum required node version in oclif then we should give it a try and bump everything.

related:
https://github.com/oclif/core/issues/1234

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by checking the versions of is-wsl, widest-line, string-width, and supports-color, then compare the minimum Node.js version supported by oclif with Node's CJS-to-ESM require support. Review the linked Node.js documentation and related issue. Done means confirming that all listed ESM exports lack top-level await, the feature is supported by the minimum Node version, and the dependencies can be bumped without breaking supported CJS CLIs.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
cli
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.