On Sat, Jan 5, 2013 at 4:54 PM, Eric Mill <[email protected]> wrote:

> It can often be a good idea to add comments for yourself and others around
> your dependencies, especially on a large project.
>

What more does a configuration file need to convey about dependencies,
beyond "This is a dependency; this is the required version."? Anything more
then that belongs in actual documentation and not doing so reeks of
negligence and sloppy practices.

Rick



> It doesn't mean you made bad choices about your dependencies. When stuff
> gets large, it helps to group things, label them, etc.
>

> As package.json's get used for more and more things (for example, my
> deploys to my app host involve setting custom fields in package.json that
> they use to govern DNS and stuff), it'll become handier to have the ability
> to comment things.
>
> Also, to comment things in and out at will, during development. We all do
> that with things.
>
> Plus, yes, being able to drop the quotes around keys is nice too.
>
> This is why when I make config files for myself, I make them .js files
> instead of .json. Preface the object with a "module.exports = ", and you
> can say "var config = require("./config")" very easily. It's a lot more
> convenient.
>
> -- Eric
>
>
> On Sat, Jan 5, 2013 at 3:44 PM, Rick Waldron <[email protected]>wrote:
>
>> I'd be more concerned with having configuration options that were obtuse
>> enough to require in-line comments.
>>
>>
>> Rick
>>
>>
>> On Sat, Jan 5, 2013 at 3:35 PM, Ilya Dmitrichenko <
>> [email protected]> wrote:
>>
>>> Why cannot you add a section on dependencies in the README file? There
>>> you can explain in plain-english whatever you wanna say about those
>>> dependencies!
>>>
>>> Cheers,
>>> --
>>> Ilya
>>>
>>>
>>> On 5 January 2013 18:22, Alex Kocharin <[email protected]> wrote:
>>>
>>>> Hello, everybody.
>>>>
>>>>
>>>> TL;DR: I think that JSON is not a suitable config file format, and I
>>>> want npm to be able to read configs stored in some other way by default. It
>>>> might be just javascript, or yaml, I don't really care as long as it better
>>>> for configuration files than json.
>>>>
>>>>
>>>> So, there is a dependency list in package.json, and it would be a good
>>>> practice to have a comment for every line describing why we require that
>>>> package, why we require that version of that package, what known problems
>>>> we have and so on.
>>>>
>>>> But there's a small issue. JSON format doesn't allow comments in any
>>>> way.
>>>>
>>>> Right now there are a couple of different ways around it of course:
>>>>
>>>> 1. Non-standard JSON entries like "@comment": "blablabla".
>>>> Unfortunately, javascript editors doesn't highlight it as a comment, and
>>>> it's just plain ugly. Also this violates strict javascript mode, so God
>>>> knows what trouble it'll cause in the future.
>>>> 2. Keep a commented dependency list in a separate file. This violates
>>>> DRY principle, so we could update one file and forget to update another.
>>>> The same goes for /**package **/ hack I believe.
>>>> 3. Use some kind of build system. Just for damn comments in one file?
>>>>
>>>> Also, there's another wrong thing with JSON, it's too strict. You can't
>>>> omit double quotes from keys, you can't leave a trailing comma, etc. JSON
>>>> is human-readable, but it's just not damn human-writable.
>>>>
>>>> Well... I went for 3rd option for a very long time. We used package.js
>>>> file and a Makefile that compile js to json. Yes, that's three damn files
>>>> instead of one. That's an example of our package.js file.
>>>> https://gist.github.com/4462764 . But a number of supported packages
>>>> grew, and compiling this slowly became a major pain in the ass. I recently
>>>> got an issue when I updated package.js, but forgot to compile it, and
>>>> debugging this one was a quite interesting experience. So, I'm now in a
>>>> mood of forking things and making all my public packages incompatible with
>>>> mainstream npm...
>>>>
>>>>
>>>> So, there's a couple of alternatives. For example, Travis use YAML, and
>>>> there is CSON (it's coffeescript version with blackjack and hookers).
>>>>
>>>> And I think there was a couple of discussions about it. So, did anybody
>>>> come up with more or less sane idea how to deal with this? What happened to
>>>> package.json.js?
>>>>
>>>>
>>>> Happy New Year!
>>>>
>>>> --
>>>> Job Board: http://jobs.nodejs.org/
>>>> Posting guidelines:
>>>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>>>> You received this message because you are subscribed to the Google
>>>> Groups "nodejs" group.
>>>> To post to this group, send email to [email protected]
>>>> To unsubscribe from this group, send email to
>>>> [email protected]
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>>>
>>>
>>>  --
>>> Job Board: http://jobs.nodejs.org/
>>> Posting guidelines:
>>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>>> You received this message because you are subscribed to the Google
>>> Groups "nodejs" group.
>>> To post to this group, send email to [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>> For more options, visit this group at
>>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>>
>>
>>  --
>> Job Board: http://jobs.nodejs.org/
>> Posting guidelines:
>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> You received this message because you are subscribed to the Google
>> Groups "nodejs" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>
>
>  --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to