You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A related issue (donejs/generator-donejs#140) outlines the method of using the .donejs folder to customize a generator's templates. It would be nice to have the ability to custom the generator itself.
Why
For a react-view-model project. Since a custom element tag name that the component prompt collects doesn't translate well to a react component so I'd like to change the prompt and it's validation.
You could also do things like making a component generator that prompts you for a type and builds one of several predefined types.
How
My immediate thought would be to modify the add command to do something like:
varpath=require('path');varutils=require('../utils');vargenerate=require('./cmd-generate');vardebug=require('debug')('donejs-cli:add');module.exports=function(root,name,params){vargenerators=require(path.join(root,'node_modules','generator-donejs'));varcustomGeneratorPath=path.join(process.cwd(),'.donejs','name','index.js');// Use the custom generator here!if(fs.exists(customGeneratorPath)){returnutils.generate(root,'.donejs',[name].concat(params))}if(generators[name]){debug('add called but running generate instead',name,params);returngenerate(root,name,params);}debug('add',name,params);returnutils.add(path.join(root,'node_modules'),name,params);};
Comments Please 😃
I am happy to implement this in my spare time because I'd like to see it done ASAP. I just would like a little input first so I know if I am heading down the wrong path before I start.
The text was updated successfully, but these errors were encountered:
To restate, I think you should create an rvm-component generator (instead of mixing this into the current generator). The types of generators is unlimited, making trying to support them all within DoneJS problematic. This is why we made creating new ones easy.
I agree about this becoming a generator. I think one reason why this type of request comes up often is because it's more natural to do donejs add component MyComponent than it is to do donejs add rvm-component MyComponent. For can-components it's not donejs add can-component my-component.
I wonder if we should support some method to alias generator names, so that you can use the shorthand. The flow might be like this:
What
A related issue (donejs/generator-donejs#140) outlines the method of using the
.donejs
folder to customize a generator's templates. It would be nice to have the ability to custom the generator itself.Why
For a
react-view-model
project. Since a custom element tag name that the component prompt collects doesn't translate well to a react component so I'd like to change the prompt and it's validation.You could also do things like making a component generator that prompts you for a type and builds one of several predefined types.
How
My immediate thought would be to modify the
add
command to do something like:Comments Please 😃
I am happy to implement this in my spare time because I'd like to see it done ASAP. I just would like a little input first so I know if I am heading down the wrong path before I start.
The text was updated successfully, but these errors were encountered: