Open jbenet opened 10 years ago
Would probably lose the --install-deps
and just rely on npm. Other than that :+1:
Why do we need the username namespace?
the target users of transformer are not necessarily programmers. They are people that may have to program, but the target audience is pretty general.
I spent a while reading https://github.com/npm/npm/issues/798 which has some of the best arguments for non-namespacing, and chatted with substack quite a bit.
Still unclear to me whether pkg mgrs should enforce namespacing. However, I think there is one major reason to use namespaces in transformer: i want the transformer stdlib (the core set of types) to be distinct (transformer/
). Many people may be running that code all over the place and I want people to not have to wonder about the code being used. I.e. it's been merged into the main project, so it does not need to be installed. And you can trust it. (people have already asked me about security in this...).
Also, I think i have the answer to the main argument people use for not namespacing. That there should be "one canonical module" for a thing. And not many A ... Z/foo
, which is unclear. IMO namespacing doesn't break this. One canonical namespace is used to "symlink" (require) modules into the canonical space. E.g. I publish jbenet/foo
, but it's great so gets merged into transformer/foo
.
More relevant information and thoughts in #10
Transformer modules (which define Types, Codecs, or Conversions) are addressed with an id:
<namespace>/<module name>
(<module name>
defaults totransformer/<module_name>
).Currently, transformer will
require
modules from NPM:From https://github.com/jbenet/transformer/blob/master/js/loader.js#L37-L44
Meaning, id
jbenet/custom-timestamp
resolves to moduletransformer-jbenet-custom-timestamp
. And is then loaded withrequire('transformer-jbenet-custom-timestamp')
.This is all well and good, but when people use transformer they'll have to install the required modules. If run without the required modules, transformer should error out with an exception saying which modules need to be installed. This is fine in js development, but using the cli, transformer should lead the user to install things correctly.
Something like:
@maxogden @mafintosh thoughts?