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
Post a Comment