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

Move to ESM format #601

Closed
7 tasks
nnmrts opened this issue Feb 13, 2021 · 10 comments · Fixed by #683
Closed
7 tasks

Move to ESM format #601

nnmrts opened this issue Feb 13, 2021 · 10 comments · Fixed by #683

Comments

@nnmrts
Copy link
Contributor

nnmrts commented Feb 13, 2021

Description

Encapsulating #599 and implementing sindresorhus/meta#15, moving to ESM is an obvious step in the right direction. I'm aware that @sindresorhus wants to "start with the lowest level packages that most of my other packages depend on", which is A LOT in this case and I understand the intention behind that, but moving np to ESM anyway would firstly be a great way to test it out in the "sindresorhus ecosystem" and secondly a relatively easy project to do this on, since its public API is just the CLI and it has no Typescript related files.

Is the feature request related to a problem?

Not really, ESM is just better and more modern.

Possible implementation

Below is a checklist copied from the mentioned discussion post:

  • Add "type": "module", to package.json (below the author field)
  • Add "exports": "./index.js", to package.json (below the type field)
  • Update engines field in package.json to Node.js 12.
  • Update index.d.ts to use ESM imports/exports.
  • Update code examples in readme and index.d.ts to use ESM and also top-level await.
  • Remove 'use strict';.
  • Convert '.' to './index.js'.
@nnmrts
Copy link
Contributor Author

nnmrts commented Feb 13, 2021

I don't want to ignore

Can I help out?
Sure, but not yet. I need to figure out the best way to approach this first.

so I will wait for a green light from you to start a PR for this.

@sindresorhus
Copy link
Owner

I would prefer to wait until the end of April for this. Mostly because a lot of people depend on np and I don't want to bother them to upgrade until I can use the argument that Node.js 10 is obsolete.

@nnmrts
Copy link
Contributor Author

nnmrts commented Feb 20, 2021

That's fine. Feel free to ping me here, when the ESM switch starts happening.

@sindresorhus
Copy link
Owner

This can now be done.

@talentlessguy
Copy link

talentlessguy commented Apr 25, 2021

May I be assigned work on this please, @sindresorhus?

@sindresorhus
Copy link
Owner

@talentlessguy Sure, if you know what you're doing. I don't have time for endless PR reviews.

Ensure you follow: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#how-can-i-move-my-commonjs-project-to-esm

@talentlessguy
Copy link

@sindresorhus thanks! I am using cjstoesm tool to automatically convert everything to ESM

and I will test it locally if it works for ESM and then will PR

@nnmrts
Copy link
Contributor Author

nnmrts commented Apr 25, 2021

Dang, I would've been really motivated to work on this or other repos moving to ESM. I'm sorry but I'm afraid I can't really help out or focus at the moment since my mother recently got transferred to a palliative ward. :(

But have fun, people! I'm really looking forward to using and contributing to the transformed projects. I don't know if other people than myself can tick the checkboxes in the checklist in the original post here, so feel free to ping me here when one of the tasks is done, so I can check them.

@dopecodez
Copy link
Collaborator

@nnmrts if youre still up for it, you can take this up now 😄

@nnmrts
Copy link
Contributor Author

nnmrts commented May 18, 2021

@dopecodez I still neither feel able to communicate in a non emotional matter nor do I know if I have the power or time to do this right now. However, it might be a good distraction, I'll look into it today and maybe I can make a draft PR tomorrow. Not guaranteeing anything though.

Again, I'm sorry, initially I was really motivated to start working on this (as you can see by my first post here), it's just bad timing in this case. I'm still convinced that someone else could do the job better and quicker than me at this point in time, and I won't be upset if someone decides to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants