Skip to content

Conversation

@camden11
Copy link
Contributor

@camden11 camden11 commented Oct 16, 2025

Description and Context

This PR migrates local-dev-lib to use ESM rather than CommonJS. It does a few other things to make this possible

  • Switch from jest to vitest (works better with ESM and is consistent with the CLI tests)
  • Bumps min node version to 20 to coincide with the CLI node version upgrade
  • Updates a few dependencies to newer versions (in most cases, when an upgrade was needed to enable ESM)

The vast majority of the changes in this PR are just updates to import paths (for ESM) and changes from vite to jest. I tried to call out anything beyond that in the comments

TODO

  • We'll need to test this thoroughly locally by yarn linking with the CLI

Who to Notify

@brandenrodgers @chiragchadha1 @joe-yeager

path && logger.debug(`Loading config from ${path}`);
if (path) {
logger.debug(`Loading config from ${path}`);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Had to update these to satisfy new eslint rules

},
};
});

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am admittedly not 100% sure why this one was necessary, but it's just a test so I think that's ok. Claude really struggled with getting mocking to work to test behavior on windows

Copy link
Contributor

Choose a reason for hiding this comment

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

Wait how did you test this on Windows?

* @returns {Promise} - Returns _default_ exported content if ESM, or exported module content if CJS.
*/
async function dynamicImport(filePath: string): Promise<any> {
if (semver.gte(process.version, '13.2.0')) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We should test this but I don't think any of this code was necessary because we no longer support this node version

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah this is ok to remove if this is going to be a major release anyways

}
};

async close(): Promise<void> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding this helper made the PortManagerServer a lot easier to test (failing tests here were why I started this process in the first place)

@camden11 camden11 marked this pull request as ready for review October 21, 2025 17:38
"yargs": "^17.7.2"
},
"exports": {
"./*": "./lib/*.js",
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add a line here for ./*/*? Or is that what you're doing in a more targeted way with the new cms export?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I figured it'd be better to be explicit about it (we do the same thing with the config dir) but open to changing it too

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.

4 participants