Open deepu105 opened 8 years ago
I think its something to do with path selection which might be trying do unix style in windows
Tested few other generators all does the same, files are generated in yeoman-app root folder instead of the folder i selected
guys I can try to debug and fix this but where should I start looking at??
First you should read the basics how the app and the ipc communication works: https://github.com/yeoman/yeoman-app/blob/master/docs/events.md
On windows 7 it generates the files in the selected folder. From your logs I can see that the target path seems to be correct.
{ action: 'generator:run', args: [ 'generator-jhipster', 'D:\\Projects\\test\\yeo-app' ] }
Try to replace the run
function
yo.js with the code below, too see if it's a yeoman-enviroment
issue.
function run(generatorName, cwd) {
process.chdir(cwd);
fs.mkdirSync('yeoman-says-hello');
sendCommandToAppWindow('generator:done', cwd);
}
Ok guys I did a small test and this indeed might be a yeoman-environment issue
I wrote the below and ran it and it behaves the same as in issue, the files are generated in the root folder where I run instead of the specified folder. Ill open a issue in yeoman-environment as well
var fs = require('fs');
var _ = require('lodash');
var yeoman = require('yeoman-environment');
var env = yeoman.createEnv();
var init = function () {
//process.chdir('./testDir');
console.log('init yeoman-environment');
console.log(process.cwd());
// Here we register a jhipster generator based on its path. Providing the namespace
env.register(require.resolve('generator-jhipster'), 'jhipster:app');
};
var runApp = function () {
console.log('running yo app');
run('jhipster:app', './testDir')
};
function sendCommandToAppWindow(name, data) {
if (data instanceof Error) {
console.error(data);
data = data.toString();
}
}
function run(generatorName, cwd) {
if (!generatorName) {
return sendCommandToAppWindow('generator:error', new Error('You must provide a generator name'));
}
if (!fs.existsSync(cwd)) {
return sendCommandToAppWindow('generator:error', new Error('The given path does not exist or is not a directory'));
}
console.log(process.cwd());
process.chdir(cwd);
console.log(process.cwd());
function done(err) {
if (err) {
return sendCommandToAppWindow('generator:error', err);
}
}
// invoke generator
env.run(generatorName, { 'skip-install': true }, done);
}
module.exports = {
init : init,
runApp : runApp
}
most probably a .yo-rc.json
in your home folder.
You were right for the sample above which caused the same behavior. But for the behavior within the yeoman-app which I originally reported in this issue is not the case as the yeoman-app root folder did not have any .yo-rc.json
file
can you open this plz as its still an issue
Yeah, let's reopen this one for now.
This does works fine with yo
, so let's keep the discussion here as it is only affecting yeoman-app.
not just yeoman-app, its probably something to do with yeoman-environment itself so should affect any app that uses yeoman-environment and provides an option to choose folder to generate files to.
Thanks & Regards, Deepu
On Thu, Feb 25, 2016 at 3:29 PM, Simon Boudrias notifications@github.com wrote:
Yeah, let's reopen this one for now.
This does works fine with yo, so let's keep the discussion here as it is only affecting yeoman-app.
— Reply to this email directly or view it on GitHub https://github.com/yeoman/yeoman-app/issues/104#issuecomment-188650910.
What kind of files are generated in the yeoman-app directory? Always the same files or is it random? What is your OS?
All the app and test files that particular generator generated. I am on OSX 10.10.
On Mon, Mar 28, 2016 at 9:45 PM, Stefan Buck notifications@github.com wrote:
What kind of files are generated in the yeoman-app directory? Always the same files or is it random? What is your OS?
— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/yeoman/yeoman-app/issues/104#issuecomment-202466843
with regards, Revath S Kumar, Rubyist / JavaScripter / PHP
markdownblogger.herokuapp.com
www.phprepo.in revathskumar.com +919995436867
http://twitter.com/revathskumar http://www.linkedin.com/in/revathskumar http://www.gplus.to/rsk http://www.about.me/revathskumar http://www.phprepo.in/ http://www.github.com/revathskumar http://www.youtube.com/revathskumar http://blog.revathskumar.com https://foursquare.com/revathskumar [image: normal-1.png] http://careers.stackoverflow.com/revathskumar
platform: windows node v5.5 npm v37.1
Generator used: https://github.com/jhipster/generator-jhipster
when running the generator even when i select a folder the files are cretaed in the actual yeoman-app root folder, there are some folders alone created in the folder I choose.
Trace below.
PS: we use the this.copy and this.template methods to write files