javascript - change dir to newly created yeoman project from yeoman generator itself -


i want scaffold project same named directory , after generator finished job want consumer redirected folder.

so i'm accepting project name argument: this.argument('name', { type: string, required: false }); , create folder , change destinationroot it:

if (this.name) {   mkdirp(this.name);   this.destinationroot(this.destinationpath(this.name)); } 

after want make kinda cd this.name @ end stage of runcontext cycle. tried change destinationroot parent directory , cd to it, , supposed work, doesn't:

end: function () {   if (this.name) {     console.log('before', ls('.'))     this.destinationroot('..');     console.log('after', ls('.'))     cd(this.name);   } }, 

here log:

before [ 'readme.md', 'index.js', 'package.json', 'test.js' ] after [ 'meow' ] 

but doesn't work because once yeoman finish it's job i’m still in currrent folder , not in meow folder. know how fix that?

yeoman doesn't change directory user.

you might able manually using process.chdir()


Comments

Popular posts from this blog

Unlimited choices in BASH case statement -

Redirect to a HTTPS version using .htaccess -

javascript - jQuery: Add class depending on URL in the best way -