Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

project structure of ionic start projects has changed in bad way #45

Closed
ibes opened this issue Jul 19, 2014 · 31 comments
Closed

project structure of ionic start projects has changed in bad way #45

ibes opened this issue Jul 19, 2014 · 31 comments

Comments

@ibes
Copy link

ibes commented Jul 19, 2014

Hi,

seems like there have been some changes how projects are initialized.

Why this https://github.com/driftyco/ionic-cli/blob/master/lib/ionic/start.js#L168?

I really don't care what name the boilerplate had, I used.
Why force me to have such ugly folder names like ionic-app-base-master - just call it "app" or something.

But where does the "ionic.project" file comes from? What is it for?
Why not put it beside the rest of the app?

Seems ugly this way and forces me to make another cd ugly-folder-name to be able to do some gulp, ionic etc stuff.

This also crashs your documentation as it needs the info to have another cd.

Seems like a mistake and doesn't seems like fun.

@adamdbradley
Copy link

What version of Ionic-cli are you using?
What command are you running?

This does sound like something is wrong, but not sure how to replicate it. With the latest ionic-cli, v1.1.0, let's say my working directory is /User/adam/, and then I run ionic start myapp it will then create the directory /User/adam/myapp/. If I run ionic start myapp2 sidemenu then it creates /User/adam/myapp2/ based off of the side menu template. How are you creating your apps?

Also, the ionic.project file is used to keep track of the Ionic App Id which we could use to uniquely identify an app for our Ionic services, such as the package service. Thanks

@ibes
Copy link
Author

ibes commented Jul 19, 2014

I have the latest version of ionic-cli

created the project ionic start myapp

got
|
|- myapp
|- ionic-app-base-master
|- a lot of files and folders :)
|- ionic.project

See the picture
ionic-folder-structure

If I get the start strict right (see in my first post) this is what should happen.
But that's not nice ;)

@mlynch
Copy link
Contributor

mlynch commented Jul 19, 2014

@ibes I think what you found here is a symptom of a different problem. We use ionic-app-base-master which is the output folder when we fetch the core template from github. It's supposed to be removed during the normal functioning of the ionic start command.

So, a few questions:

  • Are you behind a firewall or proxy?
  • What platform are you on?
  • Are you running the newest version of node.js?

@ibes
Copy link
Author

ibes commented Jul 19, 2014

So things are collected in ionic-app-base-master and will then be moved in the project folder? Something like this?

My answers:

  • no firewall or proxy (as far as I know - and I am at home, so basic equipment)
  • Mac OS X 10.9.4
  • node --version: v0.11.13
  • ionic --version: Ionic CLI version 1.1.0

any logs or stuff I could check?

I have been able to reproduce this in different folders, with different base themes and different project names.

@ibes
Copy link
Author

ibes commented Jul 19, 2014

I try to understand the start.js

Maybe it helps you to know, that the quickTip does not show up.
Maybe something is broken.

And - as can be seen in the image above - I required the 'tabs' starter, but got the 'base' starter (see the directory name; and the files are the files of the base starter)

@ibes
Copy link
Author

ibes commented Jul 19, 2014

I guess the config.xml is also not updated.

maybe some trouble with cp() or rm() ?!

@mlynch
Copy link
Contributor

mlynch commented Jul 19, 2014

Hmm. What shell are you using?

Sent from my iPhone

On Jul 19, 2014, at 1:58 PM, ibes notifications@github.com wrote:

So things are collected in ionic-app-base-master and will then be moved in the project folder? Something like this?

My answers:

no firewall or proxy (as far as I know - and I am at home, so basic equipment)
Mac OS X 10.9.4
node --version: v0.11.13
ionic --version: Ionic CLI version 1.1.0
any logs or stuff I could check?

I have been able to reproduce this in different folders, with different base themes and different project names.


Reply to this email directly or view it on GitHub.

@ibes
Copy link
Author

ibes commented Jul 19, 2014

zsh

and around this

  • iTerm
  • oh-my-zsh

I will try the same thing from bash

@ibes
Copy link
Author

ibes commented Jul 19, 2014

bash returns the same results

What else could I check, update, install, zip, unzip it...

@mlynch
Copy link
Contributor

mlynch commented Jul 19, 2014

@ibes, are you prepared to dig deeper? :)

If so, I'd love to have you check out the repo and try it locally, and then set breakpoints or console log debugging to see what's going on in start.js.

Once you check it out, cd into bin and run node ionic start myApp

What seems to be happening is this _fetchWrapper() is throwing an error, and I'd love to see what the error message is.

Maybe add some console logs or debugger breakpoints into https://github.com/driftyco/ionic-cli/blob/master/lib/ionic/start.js#L89?

@ibes
Copy link
Author

ibes commented Jul 20, 2014

:)

I have already tried a few things.

After spending another half hour with my console and sweet sublime (instead of sleeping) I figured out, that this promise won't be resolved.

https://github.com/driftyco/ionic-cli/blob/master/lib/ionic.js#L400

That's the reason, that the copy stuff won't be triggered in the start.js

The code around
https://github.com/driftyco/ionic-cli/blob/master/lib/ionic/start.js#L89 is triggered when the promise is resolved - but it won't be resolved.

But also doesn't seem to be rejected.

Any idea for further digging?

== In short words what I have tried ==

But in a ton of "console.logs" with names "before xy", "in function xy".
Tried to understand the flow of the script.
Noticed placed, where the console.log doesn't get printed.
Narrowed it down to one line that seems to be the bottleneck.

@mlynch
Copy link
Contributor

mlynch commented Jul 20, 2014

If it's not resolving or not rejecting, I suspect node is just flat out
crashing, which certainly isn't unheard of.

Now to figure out why...

Could just be unzip is a bad module...

On Sat, Jul 19, 2014 at 8:11 PM, ibes notifications@github.com wrote:

:)

I have already tried a few things.

After spending another half hour with my console and sweet sublime
(instead of sleeping) I figured out, that this promise won't be resolved.

https://github.com/driftyco/ionic-cli/blob/master/lib/ionic.js#L400

That's the reason, that the copy stuff won't be triggered in the start.js

The code around
https://github.com/driftyco/ionic-cli/blob/master/lib/ionic/start.js#L89
is triggered when the promise is resolved - but it won't be resolved.

But also doesn't seem to be rejected.

Any idea for further digging?

== In short words what I have tried ==

But in a ton of "console.logs" with names "before xy", "in function xy".
Tried to understand the flow of the script.
Noticed placed, where the console.log doesn't get printed.
Narrowed it down to one line that seems to be the bottleneck.


Reply to this email directly or view it on GitHub
#45 (comment).

Max Lynch
CTO and Co-founder
http://ionicframework.com/

@ibes
Copy link
Author

ibes commented Jul 20, 2014

Some more research:

I am quite sure, that there is a problem with the "close" event, that should be triggered by unzip.

Seems like other people had/have some trouble too: EvanOxfeld/node-unzip#21

So might be a problem with unzip and my setup.
But I don't see what's the problem.
But also seems like the unzip package is not that stable (the author has ask if anyone is interessed in having it stable; last update about a year ago)

Any ideas?

I could try another unzip package.

I don't have a clue about streams - maybe there is a way to trigger a custom event or trigger the 'close'-event manually?!

@mlynch
Copy link
Contributor

mlynch commented Jul 20, 2014

You know, I had a hell of a time finding a good unzip package, so I'm not
surprised I picked a bad one. This really, really helps though. Want to
take a stab at switching the unzip package @adamdbradley?

On Sat, Jul 19, 2014 at 8:17 PM, ibes notifications@github.com wrote:

Some more research:

I am quite sure, that there is a problem with the "close" event, that
should be triggered by unzip.

Seems like other people had/have some trouble too:
EvanOxfeld/node-unzip#21
EvanOxfeld/node-unzip#21

So might be a problem with unzip and my setup.
But I don't see what's the problem.
But also seems like the unzip package is not that stable (the author has
ask if anyone is interessed in having it stable; last update about a year
ago)

Any ideas?

I could try another unzip package.

I don't have a clue about streams - maybe there is a way to trigger a
custom event or trigger the 'close'-event manually?!


Reply to this email directly or view it on GitHub
#45 (comment).

Max Lynch
CTO and Co-founder
http://ionicframework.com/

@ibes
Copy link
Author

ibes commented Jul 20, 2014

Hm - seems like the same problem #23

I tried to be bleeding edge with node.js to be able to use koa.js with --harmony to get generator-magic.

I guess that's the difference because I have been running the CLI successfully some weeks ago and the code is 'old' (nothing, that has changed in the last weeks).

So I guess my node.js is just to new for unzip.

Don't know if that's a good reason to change the unzip package (but maybe a version of 0.19 and a maintainer who is quite uncertain about how to maintain the package is a good reason; see: EvanOxfeld/node-unzip#50)

So my next try for tomorrow: back to stable on node.js...

@adamdbradley
Copy link

Ok, the biggest culprit was this line with the unknown stdout variable:
a118acd#diff-26488b21857121cfbc2862f3af3b0a3cL189

The promise now resolves like it should and the quick help shows up again. I also added in another catch in hopes to print out any other clues.

@ibes would you be able to test out v1.1.1-beta1? npm install ionic@1.1.1-beta1

Thanks

@mlynch
Copy link
Contributor

mlynch commented Jul 20, 2014

@adamdbradley that might fix the output, but I want to make sure we look
into the unzip issue as well. My guess is it has some subtle bugs that make
the entire thing crash.

Notice how his output completely ends, but running ionic start right now
for you and I works through the download and then adds the plugins. So even
with the proper output he won't get to that point since he's getting a
crash before that.

That make sense?

On Sat, Jul 19, 2014 at 9:41 PM, Adam Bradley notifications@github.com
wrote:

Ok, the biggest culprit was this line with the unknown stdout variable:
a118acd#diff-26488b21857121cfbc2862f3af3b0a3cL189
a118acd#diff-26488b21857121cfbc2862f3af3b0a3cL189

The promise now resolves like it should and the quick help shows up again.
I also added in another catch in hopes to print out any other clues.

@ibes https://github.com/ibes would you be able to test out
v1.1.1-beta1? npm install example@1.1.1-beta1

Thanks


Reply to this email directly or view it on GitHub
#45 (comment).

Max Lynch
CTO and Co-founder
http://ionicframework.com/

@adamdbradley
Copy link

So yes it can be narrowed down to the repo being downloaded and when it gets unzipped. But the unzip writeStream did not have an onerror listener, nor did writing and closing the zip's file stream, and rarely was an error rejecting the promise. The updates may not fix the issue, but hopefully it helps debug what's going on.

I just published beta2 npm install ionic@1.1.1-beta2

@ibes
Copy link
Author

ibes commented Jul 20, 2014

@adamdbradley no sorry - beta1 and beta2 leed to the same output without the quickHelp (I have checked ionic --version so the npm install worked)

Yeah - as I thought the problem for me is, that the script won't ever reach the position to trigger the cordova plugin installation (and the xml configuration) as both are in the then() of the promise that's not resolved for me.
unzip is the gate everything has to get through. I have no clue why node breaks silently (but I don't have much clue about node.js at all ^^ )

As far as I understand unzip uses stream functionality and streams seem to have error, finish etc. handlers by definition (they are supposed to have them?!).
But changing the listen-event on something else didn't work out - beside of "pipe", which is fired as soon as anything is put into the stream.
http://nodejs.org/api/stream.html

@ibes
Copy link
Author

ibes commented Jul 20, 2014

also tried it with beta3
Nice improvements, by the way.

But for ionic --version I get
`Installed Ionic CLI version: 1.1.1-beta3
Error loading current npm version: http GET https://registry.npmjs.org/ionic
Error loading current npm version: http 304 https://registry.npmjs.org/ionic
1.1.0

  • Use npm update -g ionic to update to the latest version`
    maybe that's not like it was supposed to be...

@ibes
Copy link
Author

ibes commented Jul 20, 2014

I downgraded my node to 0.10.28

Now it works like expected.

I guess it is not necessary to have ionic work in node versions that are newer than stable...

@omeid
Copy link

omeid commented Jul 20, 2014

Hello,

As I am working on #42 I have went through the portion of code that is responsible for this in detail. I think instead of trying to pin down this problem, it is the good time to just move on and use nodegit instead of dealing with the zip file and temporary folders, it will also makes it possible to pull a specific release (or commit) of a template which will be very handy once 3rd party templates grow.

I would like to hear some feedback on #42 and also switching to nodegit instead of downloading the zip.

@ibes
Copy link
Author

ibes commented Jul 20, 2014

I think this is brilliant (var this = the idea and the concept; haven't really digged into your code)

Being able to have custom templates would open up a lot more possibilities.

@mlynch
Copy link
Contributor

mlynch commented Jul 20, 2014

Sounds really interesting. We are also going to be adding the ability to
start projects from mockups in the creator tool, but that's not ready yet:
http://ionicframework.com/creator

On Sun, Jul 20, 2014 at 10:08 AM, ibes notifications@github.com wrote:

I think this is brilliant (var this = the idea and the concept; haven't
really digged into your code)

Being able to have custom templates would open up a lot more possibilities.


Reply to this email directly or view it on GitHub
#45 (comment).

Max Lynch
CTO and Co-founder
http://ionicframework.com/

@ibes
Copy link
Author

ibes commented Jul 20, 2014

Looks nice.
Even if I prefer code to drag-dropping-things :)

@omeid
Copy link

omeid commented Jul 20, 2014

Looks neat.

@adamdbradley
Copy link

Going to close this and will open it back up if the stable version has issues. We did add more error handling and a few features, so this was a good update.

@h4harish
Copy link

if am writing on command prompt npm start myApp sidemenu this command is throwing a module.js:328
throw err;

Error: Cannot find module 'C:\Users\harish\AppData\Roaming\npm\node_modules\ionic\bin\ionic'
how to solve this..please solve IT

@h4harish
Copy link

am using node --version v5.4.0,please solve this .

@ibes
Copy link
Author

ibes commented Jan 13, 2016

Maybe you haven't install the dependicies of ionic.
I guess it will work through npm install (but I haven't created something with npm in some month)

Your question is most likely not related to this ticket so this is not the right place to ask.

@h4harish
Copy link

ok thanks for reply dude.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants