Closed Ovski4 closed 8 years ago
Try on the latest version.
Also, init
is not a valid priority name.
I am already using the latest version (0.20.2)
I edited init to initializing, now I got the following
END
FIRST
INIT
FIRST
PROMPTING
? Your project name: Ok
Ok
The 'prompting' function is still running after the 'end' function
Will investigate. My guess is the first task is running right away as it's the first one queued.
Thanks. I think you are right, I'll run more tests
Hey guys, any clue? I'm facing the same issue here. Is there something wrong with my code?
Here is my ../app/index.js
var yeoman = require('yeoman-generator');
var util = require('util');
var chalk = require('chalk');
var prompt = require('./prompting');
var MyIonicGenerator = module.exports = function MyIonicGenerator(args, options) {
yeoman.generators.Base.apply(this, arguments);
this.argument('appname', { type: String, required: true, desc: 'The name of the app'});
prompt.init(this);
};
util.inherits(MyIonicGenerator, yeoman.generators.Base);
MyIonicGenerator.prototype.install = function install() {
var c = this.config;
var args = ['start', this.appname];
if (c.useStarterTeamplate) {
args.push(c.starterTemplate);
}
if (c.package) {
args.push('-i');
args.push(c.package);
}
if (c.ionicAppID) {
args.push('--io-app-id');
args.push(c.ionicAppID);
}
if (c.useSass) {
args.push('--sass');
}
var ionicCli = this.spawnCommand('ionic', args);
ionicCli
.on('error', function (err) {
this.log(chalk.red(JSON.stringify(err)));
}.bind(this));
};
MyIonicGenerator.prototype.prompting = function prompting() {
var done = this.async();
this.prompt(prompt.questions(), function (answers) {
this.config = answers;
done();
}.bind(this));
};
When runing it, the first thing executed is the install
method, any help?
Maybe just order the priority in the right order for the time being?
That's what I did for the time being. Even though it's still an issue, I'm using group priorities in the right order and it works as expected
Any progress here? I have issue with end, it is called before initialization or not at all. yo version 1.4.8
@luckylooke your issue doesn't look related.
@SBoudrias why? It also depends on position of end
property. If I move it on top, it will be fired before initialization
. If I move it down (in 'right' order you mentioned), it will not fire at all. I have feeling that it is caused by same bug.
@luckylooke okay so you have a part of the answer (why it triggers first). But if it doesn't fire when you move it after, it's because your generator is never ending. My educated guess is you're dead looping the process with some asynchronicity management.
@SBoudrias, Ok, thanks for clues.. I will test some things later on it.
Hi,
I'm just getting started and trying to build my own generator, but I don't understand how priorities work.
Here is my package.json file
Here is my generators/app/index.js
I read the docs at http://yeoman.io/authoring/running-context.html so here is what I expected by running yo ovski-custom:
And here is what i got:
Maybe I didn't understood, and the "grouped-queue thing" is only triggered if I start composing generators together? I get the same behaviour with group priorities, and with the version 0.17.7 of the yeoman-generator dependency.
Thanks!