-
Notifications
You must be signed in to change notification settings - Fork 117
CLI --use <plugin> <config> #362
Comments
sweet, so I can give you my thoughts on (1) and (2):
The standard plugin structure is to take a function and return either a synchronous, asynchronous or generator function. Here's what I mean: // sync
function plugin(opts) {
return function jade(file, entry) {
// some transforms
}
}
// async
function plugin(opts) {
return function jade(file, entry, fn) {
// some transforms
fn()
}
}
// generator
function plugin(opts) {
return function *jade(file, entry) {
// some transforms
}
} As for (3), I'm thinking we could do something similar to what jade does with their |
I don't see any examples in $ duo client/index.js --use foobar '{a:1, b:2, c:3}' would be a valid duo counterpart, no? Also why not add data file support too: $ duo client/index.js --use foobar options.json
# or YAML?
$ duo client/index.js --use foobar options.yml
# or a JavaScript file that exports a function which must return a configuration?
$ duo client/index.js --use foobar options.js
# or a consolidated plugin configuration file?
# Each plugin would have its config under a key-based namespace named according
# to that plugin's name, eg: { foobar: {a:1, b:2, c:3}, blah: { z:1 }}
$ duo client/index.js --use foobar --use-config options.json #or
$ duo client/index.js --use foobar --use-config options.yml #or
$ duo client/index.js --use foobar --use-config options.js
# using short flags, U for --use-config
$ duo client/index.js -u foobar -U options.json
# and, of course, -U would accept a literal:
$ duo client/index.js -u foobar -U '{foobar:{ a:1, b:2, c:3}}' @matthewmueller However, to achieve this (3) I believe
No? |
If we're working on changing up the plugin architecture, let's not forget to address #346 as well. We need a clean way to distinguish between per-file and per-build plugins. (perhaps they need separate code-paths altogether) |
@dominicbarnes I am changing this issue to be strictly about config-passing on the CLI as I believe it to be a feature resilient against whatever happens in #346 and beyond. CLI config-passing is just a plain general problem. It may need to evolve to support different plugin types but fundamentally the idea will hold. |
@matthewmueller I am going to pursue a pull-request supporting |
There is a similar PR already #276 |
@cristiandouce Thanks, I've chimed in there. From what I understand of that proposal I am considerably more in favour of my design so far here. |
Yep, I like this much more. |
I think we should only allow single arguments as well to keep the implementation clean and to encourage consistent API design. Basically to your point in #276 (comment). |
@matthewmueller sweet glad consensus is building. I am going to get to work on that then. |
given also, any updates? |
FYI I'm no longer a duo user so won't be active on this issue. Cheers. |
well, the only reason for me is working on a analytics.js related project |
-- edit
I have refocused this issue to be _only about point 3 below_.
I am considering creating a duo plugin library that provides more structure than is currently available.
What I would like to standardize:
$ duo --use
should be able to accept config too in some standard wayI imagine point 3 as something like these?:
$ duo client/index.js --use foobar 'a b c'
$ duo client/index.js --use foobar '{a:1, b:2, c:3}'
The text was updated successfully, but these errors were encountered: