padenot / ringbuf.js

Wait-free thread-safe single-consumer single-producer ring buffer using SharedArrayBuffer
https://ringbuf-js.netlify.app/
Mozilla Public License 2.0
201 stars 18 forks source link

Restructure ringbuf.js so it can be published as an NPM package #1

Closed rain-sk closed 4 years ago

rain-sk commented 4 years ago

The main and module keys in package.json give npm projects which consume this package information about where the bundled code can be imported from.

See: https://alligator.io/workflow/publishing-first-package-to-npm/#and-publish for a quick explanation of how to publish a package to NPM.

rain-sk commented 4 years ago

Moving the example code into a separate folder was done to make the package more "npm-canonical" but is not required.

chrisguttandin commented 4 years ago

Hi @spencerudnick, I was just about to do the same. :-)

One thing I noticed is that you added babel as a dev dependency but it seems to be not used. I actually think that's a good idea since the code depends on modern features and transpiling it to ES5 will not really help anyone.

Another thing - that I also just found out now - is that rollup plugins are now distributed under the @rollup scope. https://github.com/rollup/plugins

rain-sk commented 4 years ago

Hey @chrisguttandin,

Good catch about the dev dependency! I'll update this and the plugin names tonight.

(This was copied from some npm-package boilerplate I keep around).

rain-sk commented 4 years ago

@chrisguttandin @padenot I updated the dependencies to the latest versions and double-checked that the build script is still running. Have a look when you have time :)

chrisguttandin commented 4 years ago

Hi Spence, sorry for being so picky. I wonder why you added crossenv as a dependency? It was part of a typo squatting attack some time ago. Maybe it's okay to just remove it.

https://blog.npmjs.org/post/163723642530/crossenv-malware-on-the-npm-registry

rain-sk commented 4 years ago

Hey Christoph! Just fixed up the "remove unnecessary dependencies" commit. Thanks for helping me clear up my npm package boilerplate ;)

chrisguttandin commented 4 years ago

Thanks Spence, I don't have anything else to complain about. :-)

But Paul is the one who ultimately has to push the button.

padenot commented 4 years ago

Spencer, Chris, thank you very much for this! I'm un-breaking the example in another commit, but it's unclear to me if I'm doing it right (the probability is very low, to be honest).

I'll now try to understand a bit more how all this work, and publish it on NPM using the instructions linked.

Thanks again!