-
Notifications
You must be signed in to change notification settings - Fork 79
installing dependencies separately fails in some cases #63
Comments
lame -- i'm going to look into this today |
possible related note. i've noticed recently (and not only me, but co-workers) that sometimes the ender-js client isn't first in the source... making things like |
yeah -- i'm looking at that now. Also, everything is still async. |
this should work for you as of v0.6.6. Can you please test and reopen if you run into any issue. (also, a side note -- i've taken the packageJSON.main default of |
How about trying
p.s. should just leave as |
Hm... is this a standard? Could you point to it somewhere? The problem is, we alert the user if a defined main is missing and i think it would be a nontrivial change to add this. |
Is what a standard? using When you require a package in node, it looks for Alerting that the problem is possibly a missing |
alright -- i opened a new issue about it #80 |
Did you push the changes to npm? I'm still having the same problem and I have run |
what version of ender are you running after update? |
|
that's true -- i should add Anyways, with 0.6.6 this |
Heres' my mkender.sh:
The local modules have the correct dependencies in package.json as well. It seems like the order in which the modules load is non-deterministic. |
I just tried this without the local modules and it actually wrote
|
The fact that underscore was before ender-js makes me think you are on ender 0.6.5 -- are you sure you're on 0.6.6? |
i just published a new version of ender which has a version method.... can you update to ender 0.6.7 and run |
ender builds packages asynchronously, which means if you do something like this:
You aren't guaranteed the order in which you specify packages. The only guaranteed order is related to specific dependency maps. If any of those depend on order, that should be specified in the relevant package.json. does that make sense? ender.js should always be first however, and i think i might have just uncovered a tiny bug with that. |
Hmm... either it's catching an error that exists in my code that was previously causing things to fail silently or it's more broken.
testing against
Is there a way to output more information? I've also tested other things, but they're still loading in the wrong order. P.S. Both Jameson (beatgammit) and I would like to get more involved with Ender, but the coding styling is very foreign to us and hard to wrap our heads around. |
I don't know how you're calculating dependencies, but I think the best way to do it would be to store dependencies by depth NOTE: This is working, tested code. If the dependency tree looks something like this:
You could traverse it like this
The result of the traversal will be this:
And then you can reduce that result into a simple list like so:
As you can see, this produces a very clean array of which order the modules must be used and installed in:
Then you can do the module installs and write out to ender.js:
Some may argue that you could do this in fewer lines of code or more efficiently with fewer loops, etc. What do you think about this approach? If you think it's good and you give me some guidance then I'll dig around and try to implement it. |
I just pushed some code which fixed the regression from earlier -- i had set the version on the process object like a n00b which apparently caused your module to fail internally inside npm. Weird it didn't effect other modules o_O Anyhow, i added a As far as the dependencies go, i believe our current implementation is actually working and not too different from what you've done here. The -1 is very valuable for accounting for paths with missing dependencies. Npm is very smart about installing modules but also fairly closed off with what it exposes to you with regard to what it actually installs. Because of this, the -1 gives you a clue as to if a package exists at a particular location or not. I chose a 0 rather than an empty object to signify a package with no dependencies because it's an easier conditional check. Otherwise the tree is very simliar to what you proposed. That said, if you feel like going down that road I'd be happy to help you along/take any advice. All that code lives in Ender.file.js. Before you do that though, i would give your install one more shot, because it throws no errors for me during the build process and everything seems good. |
Also, reading back over that
sorry to hear :( What sort of things are most unusual? I think this particular code/logic is probably the most challenging in the cli. I'd be happy to work through a better/simpler solution though. If you start with the |
I'm not sure what I'm doing wrong, if anything, but I just can't get this to build correctly. Can I give you a tarball of the local modules and my |
As for the coding style: It seems that most node.js modules have a pattern similar to this:
actually, far too few people are using "use strict"; despite how many errors it can catch and the supposed speed increase, but I always do that. You guys seem to follow the jQuery style, which I haven't spend a lot of time with. I don't understand the background and purpose of the object-wrap convention. If I did it probably would seem as natural to me as the above, but something about it is just harder to follow. I can't quite put my finger on it.
and also I've seen this type of thing in ender where if, while, and other blocks in one line;
which is a bit more difficult to understand than
and I understand that some developers condensing their code to save bytes, but I believe the newer compilers such as uglify-js do that sort of thing for you when it's compiled. Also, I very rarely succumb to javascript-foo, so I'm not as familiar with the things that happen to work (but don't make sense unless you've spent a lot of time on wtfjs) -- like using bitwise operators changes strings and objects to numbers, etc. Those are the main things that confuse me about the style. |
Oh, I haven't poked around with assemble yet, but I'll take a peek tonight. |
I've been working on a rewrite of the build process that solves the sometimes out-of-order issue, the multiple file per package issue, the package.ender.dependencies issue, and some other things. It's basically an API to get the dependency, file, and order-of-install info that would work great as a submodule for any packaging system. I'll post back when it's fully functional. |
awesome, i'm looking forward to it! :) |
Okay, here's the first part: https://github.com/coolaj86/node-pakman. This packages a single module, including any subrequires, but not including npm deps. I'm finishing up with the code to recursively include npm deps. |
I'm so close to having a fully working example of Last night as I was going to bed I found that I wasn't properly handling |
@fat, So I've got http://github.com/coolaj86/node-pakman as an API and http://github.com/coolaj86/node-pakmanager as an example on top of it. Tell me what you think. I'd like to get this merged into ender - perhaps an ender 2.0. |
a lot of these dependency issues seem to be sorted out in the 1.0-wip branch now. |
Works
Fails
Additionally, this reports a successful build when it wasn't actually successful
The text was updated successfully, but these errors were encountered: