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

feat: refactoring the codebase to be ESM #558

Closed
wants to merge 3 commits into from
Closed

feat: refactoring the codebase to be ESM #558

wants to merge 3 commits into from

Conversation

erunion
Copy link
Member

@erunion erunion commented Aug 3, 2022

🧰 Changes

Our update-notifier dependency currently has a CVE for its nested got dependency. Unfortunately update-notifier has moved to being ESM-only in v6 and we can't use it without moving this codebase over to ESM.

That's this.

🐳 Problems

  • Most of the test suite currently fails because __dirname is unavailable with in ES scope in Node. I've polyflled it in a few spots but I'm not sure if thats the right solution or if we could replace it with a process.cwd() call instead.
  • Jest --watch is currently broken because of the way that we're loading commands for the help screen. Jest will run tests the first time just fine but if you make any changes it'll fail with a "module is not a module" error because we're dynamically loading in commands with await import() and Jest has already town down its environment. Instead of futzing with this it might be best to move away from dynamic command loading and have an index file in the cmds/ directory that exports everything.
  • I'm still unclear if having type: module in rdme will force you to have type: module in any package that has this as a dependency, or if it's fine because nobody is doing require('rdme').
  • Jest's ESM handling does not like chalk. At all. I've had to do some module resolution in the config to get it working and it's unfortunately causing us to not be able to upgrade chalk to its latest ESM-only version.

@erunion erunion added enhancement New feature or request refactor Issues about tackling technical debt labels Aug 3, 2022
@erunion erunion changed the title Feat/esm feat: refactoring the codebase to be ESM Aug 3, 2022
@erunion
Copy link
Member Author

erunion commented Aug 3, 2022

Alternatively we could say nuts to any package that goes ESM-only and replace it with something else.

@erunion erunion mentioned this pull request Aug 9, 2022
9 tasks
@erunion
Copy link
Member Author

erunion commented Aug 9, 2022

Closing this out for now in favor of #560.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactor Issues about tackling technical debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant