-
Notifications
You must be signed in to change notification settings - Fork 79
Support devDependencies #95
Comments
i imagine it being similar to |
In my projects, I use jasmine a lot. Right now I need to bundle a version of jasmine inside some |
If [1] gets merged, you could have an [1] #125 |
In view of the 1.0 rewrite, I'd like to bump this issue. It still would be very helpful if Already haven taken a peek into the new ender source, I see two areas which would have to be amended:
Ok, I hope some of this makes sense. If someone could give me a few pointers, I'd be glad to help implement this feature. Best |
I'm still not entirely clear of the use case, could you explain it with an example perhaps? If you just wanted to include the Jasmine CSS etc. then wouldn't an To get From what I understand your saying, you just want to npm-install the devDependencies so you could add an extra argument to If you just want the top level devDependencies then perhaps you can just apply some trickery here. You could have main-build-util.js generate two package lists for you, one to send to npm for an install (which would include devDependencies) and one to pass through to So, an , exec = function (options, out, callback) {
var packages = buildUtil.packageList(options, false)
, installPackages = options.dev ? buildUtil.packageList(options, true) : packages
, handler = handle.bind(null, options, packages, out, callback)
out && out.buildInit(packages)
packageUtil.preparePackagesDirectory(function (err) {
if (err) return callback(err) // wrapped in util.js
repository.setup(function (err) {
if (err) return callback(err) // wrapped in repository.js
repository.install(installPackages, handler)
})
})
} with The whole internal dependency tree build could probably be avoided if you just want to npm-install the devDependencies and not do anything fancy with them as part of your build. Even then, if you wanted to included them in your output file then you really just need to change Does that make sense? Does that sound like what you're wanting to do? |
Thank you for your detailed answer. I hacked away on a solution this morning and ended up with something quite similar to what you are suggesting. But first of all let me clarify my use case. We are about to split an existing app into a bunch of npm modules. Each module consists of of some js files which are processed in a custom, rake based build step. The build task generates two main products: a
Now I am free to require testing helper modules inside my unit tests along with other modules. Furthermore I can easily run the unit tests of each module, while having zero boiler-plate code in each individual repository. Now to my proposed solution. By default npm installs devDependencies of the top level module. So either by further understanding the caching problem I mentioned or by doing a separate I hope I could clarify things a little bit. Later today I will fork the repository and try to implement the feature since I really see no better way of solving our problem. Thanks again for taking the time to talk this through! |
I have pushed some commits to the devdep branch of ender fork. I still have to finish the integration tests, for which I started to add fixture file support for |
Nice work, still trying to get my head totally around the use-case and your implementation, I think I just need a bit more time to be able to sit down with this and consider how it fits into the broader picture--i.e. if we're extend ./package.json usage for the special Some questions for you: The devDependencies are only appended to It's interesting that you switched around Good work on adding some unit tests for this, the quirks of npm also point to the need for good functional tests for it too so we know when (not if) it breaks upstream. I'll see if I can set aside some time this week to think about this in more detail. |
(updated that last comment with better links) |
I found some more time to work on this. First of all I've pushed an enhanced version of the Furthermore, I rebased my devdeps branch against the filefixtures branch and added a functional test for building from a package.json with the new --dev option. I've started to use specific versions of packages installed in functional tests, which I think would be a good idea for all other functional test, too. Otherwise a package update which changes dependencies could break ender functional tests. UPDATE: Please note that much of the following discussion in this post is made obsolete by the simpler implementation I describe in the next posts. So you might just skim through this. Now to your questions: By default npm installs devDependencies from The only case which still has to be handled is when the npm config option I realize that most of the above explanation should be added as a comment somewhere in the source code. It's a bit sad that the rather straightforward |
The more I think about it, the division into |
This idea worked out fine. The devdep2 branch contains the amended commits together with some more functional tests. From my point of view, the final question is how to display dev dependencies in the @rvagg If you need more details on my particular use case, I'd be happy to answer. |
And as another note: Reversing the order of the npm installs is now also no longer necessary since we no longer rely on npm's handling of devDependencies (which probably is a good thing). |
I like what you've done with the code, nice and clean, but yes I'd really like more detail on your use-case to understand this a bit better. I'm not a Jasmine user so perhaps I need a bit of background there to understand what kind of code you need to go in to your build to support your tests. Personally I'd prefer unit tests to not require anything extra of my production code in order to have them run and I don't mind exposing more than the plain API in order to achieve this (one of the reasons that this CLI code is in so many modules, much more exposed for unit tests to access). But I suspect I might be missing the point of what you're trying to achieve. Perhaps if you could imagine having to write this up for a wiki page (which we'd probably need for this feature), why would people want to use |
I really do not think that this has much to do with jasmine. Much rather - with testing frameworks getting a lot more modular - I'd imagine declaring your favorite testing library, mocking library and expectations library as devDependencies. Additionally we have a lot of custom assertions and syntactic sugar helpers for testing things like promises and asynchronous constructs. I'd like to package, version and share those between projects. Does this make sense to you? Earlier you talked about ender specific extensions of the |
OK, I get it now, sorry to be slow. You're wanting to include the testing & related libs in there, Jasmine, Sinon, custom assertions, etc. So you'd end up with an ender-dev.js that is the same as an ender.js would be but with the additional stuff on the end. #131 is where I've tried to pull together some of the thinking about enhancing package.json, in particular see point 3 under Proposals. Building CWD (./) is increasingly becoming a special case where you want to (and can) do things that you can do with a build that just involves modules from npm or non-CWD paths. Your extension fits nicely into this of course because you're wanting to only have this executed when you include CWD in a build. The idea in proposal 3 is that package.json becomes a substitute for an ender.json config file (perhaps we could have both), where you can put things into the "ender" key that would substitute for supplying command line arguments. My concern is simply making sure that your CWD-special-case fits in nicely with the proposed CWD-special-case use. Having said all that though I'm not sure I can see a problem with this, plus you have the early-implementer advantage. PackageDescriptor.js is the beginning of implementation of #131, we'd just add "devDependencies" as something that can be overridden with the "ender" key (which would be handy if you're using Feel free to put in a PR any time and we can use it to discuss before it gets committed. Some additional thoughts for now:
|
I agree with all three suggestions. I will see when I have some time to make these additions. In parallel I will start using my ender fork locally. Maybe still other needs come up, even though I do not reckon so. I'm still unclear on how to amend the |
here's an idea, make
Use Make sense? |
I'm really sorry @tf but I've done a ton of work in the build/install/npm area and messed up your changes on the latest branch. main-build-util.js has been split up into DependencyTree.js (now an object with instance methods), install.js and install-util.js but the good news is that we've taken a lot of control back from npm so repository.js has been simplified somewhat ( |
Never mind. I've been meaning to finish this a long time ago. I'll try to look into this as soon as possible. |
Hello,
I think it would be great if
ender
supporteddevDependencies
(it doesn't at the moment, rigth?). I'd like to put my testing libraries in there, and have a specialender --dev
or whatever include those for my test suite build.What do you think? I might look into creating a patch if other's also like the idea.
Best
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/742663-support-devdependencies?utm_campaign=plugin&utm_content=tracker%2F165667&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F165667&utm_medium=issues&utm_source=github).Tim
The text was updated successfully, but these errors were encountered: