np
np copied to clipboard
Move to ESM format
Description
Encapsulating #599 and implementing https://github.com/sindresorhus/meta/discussions/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'.
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.
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.
That's fine. Feel free to ping me here, when the ESM switch starts happening.
This can now be done.
May I be assigned work on this please, @sindresorhus?
@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
@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
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.
@nnmrts if youre still up for it, you can take this up now 😄
@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.