Skip to content

[SP-15258] Convert to ES modules and bump remaining major dependencies - #94

Merged
spacetc62 merged 24 commits into
masterfrom
major-bumps
Nov 4, 2026
Merged

spacetc62 merged 24 commits into
masterfrom
major-bumps

Conversation

@anaptfox

@anaptfox anaptfox commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

What

  • Convert the codebase to native ES modules ("type": "module"). This replaces the earlier require()-of-ESM approach and removes the dynamic-import bridges for inquirer and update-notifier, plus the @rjhilgefort/export-dir directory scan, in favor of static imports.
  • Bump the packages that are now ESM-only or had major releases: commander, chokidar, losant-rest, rollbar, js-yaml, omnibelt, minimatch 11, glob 14, mime-types, eslint, nock, mocha, plus axios and the remaining patch/minor updates, with a refreshed lockfile.
  • Dev Node is now 24.22.2 and pnpm is 12.14.0, matching our current tooling. Dropping Node 16, 18 and 20 is called out as a breaking change in CHANGELOG.md.
  • Use inquirer's select prompt type, since list is no longer registered and crashed losant configure.
  • Treat an empty meta file as {}, since js-yaml v5 throws on empty documents.
  • Import lib/node-env.js first in every bin script so NODE_ENV is set before ESM import hoisting evaluates other modules.
  • Drop the shebang and exec bit from subcommand scripts. bin/losant.js is the only entry point.
  • Pad status labels before applying color so padEnd counts visible characters.
  • Add smoke tests for the bin entrypoints and a prompt-type test, and drop the dead mocha.opts.
  • Bump the LICENSE year and backfill CHANGELOG.md.

Why

Last code item on the SP-15258 housekeeping checklist. Several dependencies are ESM-only, so converting once is cleaner than maintaining bridges.

Testing

  • pnpm lint — passing
  • pnpm test — 79/79 passing
  • pnpm audit — 2 moderate advisories remain, both dev-only: minimatch and glob copies pinned to older majors under eslint and mocha. Nothing ships to users.
  • GitHub Actions (Linter + Run Tests) — pending on push

spacetc62

This comment was marked as resolved.

@spacetc62
spacetc62 requested a review from eeerin August 28, 2026 13:27
Comment thread CHANGELOG.md Resolved

@spacetc62 spacetc62 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Overall, this is a very clean and thorough migration from CommonJS to ECMAScript Modules (ESM):

  • Full ESM Conversion: All modules properly use native import/export, explicit .js extensions on relative paths, and JSON import attributes (with { type: 'json' }).
  • Dynamic Bridges Dropped: The dynamic require() scanning via @rjhilgefort/export-dir and the dynamic import bridges for inquirer and update-notifier have all been cleanly removed in favor of direct ESM imports.
  • Test Suite & Linter: All 58 unit tests pass and ESLint 10 with Flat Config passes with zero errors/warnings.

Left a few inline notes on the diff. Additionally, noting a few items outside the immediate diff of this PR:

  1. Legacy test/mocha.opts: This file is obsolete (Mocha deprecated mocha.opts in v6 and removed it in v8+; settings are now read from the "mocha" field in package.json). It can be safely deleted.
  2. package.json reinstall script typo: In package.json, line 28 has "reinstall": "rm -rf nodes_modules && pnpm install" (nodes_modules with an s).
  3. ANSI string padding in lib/utils.js: c.gray('processing').padEnd(13) measures length including ANSI escape bytes (~20 characters), so padEnd(13) has no effect. If strict column alignment in logs is desired, padding the text before applying Chalk is recommended.

Comment thread bin/losant-datatables.js Resolved
Comment thread bin/losant.js Resolved
Comment thread lib/utils.js Resolved
@anaptfox
anaptfox requested review from eeerin and spacetc62 October 5, 2026 16:08
Comment thread lib/utils.js Resolved
@anaptfox
anaptfox requested a review from spacetc62 October 6, 2026 14:29
@eeerin

eeerin commented Oct 7, 2026

Copy link
Copy Markdown
Member
 ../losant-cli/bin/losant.js configure
✔ Enter an Application Name: canary
Exited on unhandled rejection: Prompt type "list" is not registered. Available prompt types: checkbox, confirm, editor, expand, input, number, password, rawlist, search, select

flip type: 'list' on prompt to type: 'select'?

@eeerin eeerin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

found a bug.

@anaptfox anaptfox changed the title [SP-15258] Bump remaining major dependencies (v2.0.0) [SP-15258] Convert to ES modules and bump remaining major dependencies Nov 3, 2026
@anaptfox
anaptfox requested review from eeerin and spacetc62 November 3, 2026 21:34
@spacetc62
spacetc62 merged commit 798d111 into master Nov 4, 2026
4 checks passed
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