installing contributor modules
- Dominant language
- JavaScript
- Stars
- 132
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
Transformer modules (which define Types, Codecs, or Conversions) are addressed with an id: `/` (`` defaults to `transformer/`).
Currently, transformer will `require` modules from NPM:
``` js
Loader.LoadFromNpm = function (id) {
name = Loader.NpmName(id)
return require(name);
}
Loader.NpmName = function(id) {
return 'transformer-' + id.toLowerCase().replace('/', '-');
}
```
From https://github.com/jbenet/transformer/blob/master/js/loader.js#L37-L44
Meaning, id `jbenet/custom-timestamp` resolves to module `transformer-jbenet-custom-timestamp`. And is then loaded with `require('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:
```
> npm install -g dat-transformer
> transform mafintosh/a maxogden/b < a_data > b_data
Error: transformer needs the following npm modules to perform this conversion:
- transformer-mafintosh-a
- transformer-maxogden-b
To install them in this directory, run:
npm install transformer-mafintosh-a transformer-maxogden-b
To install them globally, run (you may need to sudo):
npm install -g transformer-mafintosh-a transformer-maxogden-b
Or, if you want transformer to automatically install them for you, run:
transform --install-deps mafintosh/a maxogden/b
transform --install-deps-global mafintosh/a maxogden/b
```
@maxogden @mafintosh thoughts?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with js/loader.js, especially Loader.LoadFromNpm and Loader.NpmName, then trace the CLI path used by `transform`. Reproduce a conversion with missing modules and define the error and installation behavior for local, global, and automatic dependency installation; done means the CLI clearly lists required modules and provides the proposed commands or flags.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100