generate-readme
generate-readme copied to clipboard
again some problem with the name
In combination with latest *-dest
and *-package
.
Like so https://asciinema.org/a/79981 (that screencast looks ugly, damn, maybe becaus emy new GUI)
I can see the sense in this behaving, but I think this should work too.
edit: and again not 100% sure if problem comes from here
thanks for the screencast. Hmm, I thought i fixed this.
I think this should work too.
It definitely should work - this is a bug. If you look at one of the demos on the readme, I'm doing this and it doesn't ask the questions more than once. I need to figure out why... there are two reasons I can think of.
In case this helps (so you can help me debug if you want).
Potential reason 1: new instances
Every generator function is a new instance of Generate. We do this to ensure that state is not shared across generators. Basically the equivalent of this (I know you're familiar with most of this, but maybe not the last part):
var Generate = require('generate');
var app = new Generate();
function generator(app) {
}
// when a generator is run, we do something like this
// before running the `default` task, or specified task on the generator
generate(app);
K, now the point is that doing the following will not share data across generators:
app.data(whatever);
To share data, we need to add data to app.base
, which is a special "shared instance" of Generate:
app.base.data(whatever);
It's possible that the answers aren't adding the data to an object that is accessible by both generators, e.g. the app.base
instance. I thought I was doing this, but I'm in a habit of using app.data()
instead of app.base.data()
, so it's very possible that I forgot to do this somewhere.
Potential reason 2: question property names
The ask
helper might be asking the same question, but using different property names on each generator. I don't think this is it though, particularly since author.name
is pretty specific, whereas "project name" might be on either name
or project.name
(fwiw I initially thought it was a good idea to use project.name
, but realized that it would make it more difficult to just use package.json data as-is. So reverted back to using just name
. Brilliant, right?)
Hm. Yea, sounds more like a first reason to me too.