Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Brian Woodward
    @doowb
    Which version of generate are you using?
    It could be that an older version has an older base-questions or that something is happening during the transpiling… also, you should be passing a callback to the default task and calling it after the console.log to indicate that the task has finished.
    David Fox-Powell
    @dtothefp
    @doowb it might be that I'm testing this locally in an npm script without installing generate globally. maybe that's messing something up?
    not sure the best way to test generator functionality locally?
    Jon Schlinkert
    @jonschlinkert
    @dtothefp you shouldn't need to install it globally. are you trying to get "cached" answers or persisted answers?
    David Fox-Powell
    @dtothefp
    I have a directory structure like this
    ./packages
    ├── generator-slo-mo
    │   ├── dist
    │   │   └── index.html
    │   ├── generator.js
    │   ├── package.json
    │   └── src
    │       ├── generator.js
    │       └── index.html
    └── slo-mo
        ├── bin
        │   └── cli.js
        ├── dist
        │   ├── github.js
        │   ├── slack.js
        │   ├── slo-mo.js
        │   ├── speedcurve.js
        │   └── task.js
        ├── package.json
        ├── src
        │   ├── github.js
        │   ├── slack.js
        │   ├── slo-mo.js
        │   ├── speedcurve.js
        │   └── task.js
        └── test
            └── sample-spec.js
    where generator-slo-mo/generator.js is my compiled generator from src/generator.js
    and I run generate in an npm script in package.json
    it all works, I'm just not seeing those answers appended on the cache
    @jonschlinkert I'm not sure the difference between "cached answers" and "persisted answers"
    I was under the impression that answers would be added to app.cache.answers after the ask
    @doowb I'm on "version": "0.9.8"
    I can make a small example and push it up to github
    David Fox-Powell
    @dtothefp
    @doowb @jonschlinkert crisis averted, bumping to 0.12.1 did the trick, not sure why I had an older version
    Brian Woodward
    @doowb
    :+1:
    I thought it might be a version issue
    Jon Schlinkert
    @jonschlinkert
    :+1:
    by cached I meant "in-memory" and by persisted I meant stored on disk and available across sessions
    David Fox-Powell
    @dtothefp
    cool, thanks for the help
    just out of curiosity why if you have a default task does it look like [14:13:48] ✔ running tasks: [ 'default:default' ]
    with the doubled up default?
    Jon Schlinkert
    @jonschlinkert
    depends on what you're running. The left side of default:default is the generator name, the right side is the task name
    so in that case it's coincidental that you're running the default task on the default generator (which is the local generator.js if you happen to have one)
    David Fox-Powell
    @dtothefp
    @jonschlinkert is there a way to to rename the local generator? i'm assuming if my generator was installed globally it would have a name other than default
    Jon Schlinkert
    @jonschlinkert
    yeah, if it's installed globally it will use the generator's "alias" which is the full name of the generator with generate- stripped off
    but you can also namespace generators locally by making them sub-generators. Example
    module.exports = function(app) {
      this.task('default', function(cb) {
        console.log(app.namespace, 'task >', this.name);
        cb();
      });
    
      // sub-generator "foo"
      this.generator('foo', function(foo) {
        this.task('default', function(cb) {
          console.log(foo.namespace, 'task >', this.name);
    
          // run the `default` task on `app`
          app.build('default', cb);
        });
    
        // sub-generator "foo.bar"
        this.generator('bar', function(bar) {
          this.task('default', function(cb) {
            console.log(bar.namespace, 'task >', this.name);
    
            // run the `default` task on `foo`
            foo.build('default', cb);
          });
        });
      });
    };
    the awesome thing about sub-generators is that you can require in other generators, like how you organize your tasks sometimes into different files
    David Fox-Powell
    @dtothefp
    cool, I'll have to try this out