publish to npm with a single http request
publish a module with a single http request.
in recent npm versions npm also uses an atomic publish, pretty much just like this, but not exactly.
CHECK_CACHE check for
if it's not present, assume it's a new module and goto DEFAULTS, else, goto PUBLISH
DEFAULTS set up the doc for a fresh publish. goto PUBLISH
PUBLISH add the tarball inline to the document,
and attempt to push to the registry.
If you get 2xx goto DONE.
If there was an error, and this was the first time you tried goto UPDATE_CACHE,
else it's the second time you have tried to publish, then goto ABORT.
UPDATE_CACHE do a get request for the module, and update the cache.
If this fails with a 404, goto DEFAULTS (this will only happen after an unpublish)
If it succeeds, goto PUBLISH, else goto ABORT
ABORT post an issue!
DONE write another module!
npm install -g npm-atomic-publishcd your-module/npm-atomic-publish