Skip to content

feat(other): migrate to redocly-cli v2#118

Merged
h0pped merged 7 commits into
mainfrom
feat/cli-v2
May 25, 2026
Merged

feat(other): migrate to redocly-cli v2#118
h0pped merged 7 commits into
mainfrom
feat/cli-v2

Conversation

@h0pped
Copy link
Copy Markdown
Contributor

@h0pped h0pped commented May 20, 2026

What/Why/How?

Migrates the action to @redocly/cli v2, which is published as a pure ESM module.

  • Bump @redocly/cli 1.34.13 → 2.31.2 and add @redocly/openapi-core 2.31.2 as a direct dep (used for loadConfig).
  • Switch the action to ESM: "type": "module" in package.json, module: ESNext / moduleResolution: bundler in tsconfig.json, Node >=20.19.0.
  • Replace ncc with an esbuild bundler script (scripts/build.mjs) that emits an ESM dist/index.js.
  • Includes a small esbuild plugin that shims @redocly/cli's internal utils/package.js by reading name / version / engines from the installed @redocly/cli/package.json at build time, so the bundled CLI reports the correct version
  • Defer-load the CLI (src/redocly-cli.ts, src/redocly-config.ts): the CJS Jest runner can't statically import the pure-ESM CLI (ERR_REQUIRE_ESM), so handlePush / handlePushStatus / loadConfig are now dynamically imported at call time.
  • Update ESLint plugins and Jest config for the ESM setup; refresh tests for the new dynamic-import flow.

Reference

Testing

  • npm run all (prettier, lint, unit tests, package).
  • Smoke tests pass against the rebuilt dist/index.js.
  • Tested by performing cicd push via gh action on that branch

Screenshots / Video (optional)

image

Additional context

Comment thread .github/linters/.eslintrc.yml
@h0pped h0pped requested a review from a team May 22, 2026 12:01
@h0pped h0pped marked this pull request as ready for review May 22, 2026 12:01
@h0pped h0pped merged commit 7e187ed into main May 25, 2026
5 checks passed
@h0pped h0pped deleted the feat/cli-v2 branch May 25, 2026 07:29
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