Libraries naming convention

Are there any official guidelines on how to name libraries? E.g. res-<lib> or rescript-<lib>.

It would be great having single recognizable and searchable pattern.

7 Likes

No convention for now, but definitely tag your lib with the rescript keyword.

I’d say res-* but it’s possible that you can check in the JS output and have it usable by vanilla JS users too. Which would be a great and free advertising opportunity each time.

2 Likes

Gotcha! In this particular case, it’s ppx, so checking in JS output doesn’t make much sense, but noted for non-ppx abstractions :+1:

1 Like

I just got npm ERR! 403 403 Forbidden - PUT https://registry.npmjs.org/res-log - Package name too similar to existing packages.

Though I don’t see anything nearly similar to res-log in the search, res-* name can’t be used for publishing to npm. I think it should be considered since many other packages won’t be publishable for the same reason as well.

cc @chenglou

Looks like there are at least a few? E.g. https://www.npmjs.com/package/res-msg-fg , https://www.npmjs.com/package/res-awesome (which is similar to https://www.npmjs.com/package/awesome ).

Their name similarity rules might have changed in the meantime. Maybe publishing under a scope will work? E.g. @alex.fedoseev/res-log.

There is reslog which is deemed similar enough.

A lot of people are annoyed by this functionality, but there you have it. I guess you can always publish it as @alexfedoseev/res-log or something.

I can’t explain why but I don’t feel like I want to use my personal scope for publishing packages. The point I’m trying to make is that it might be easier publishing packages using rescript-* prefix rather then res-*, b/c it’s less likely that npm would consider such packages similar to existing ones. And it would be impossible to rename existing re-* packages to the res-* name as well.

Anyway, I was able to publish res-logger and will proceed with for now.

4 Likes