A few small requests for npm users...

33 views
Skip to first unread message

Isaac Schlueter

unread,
Oct 28, 2010, 3:19:33 PM10/28/10
to nod...@googlegroups.com
If you put a package.json file in your project (which is a great way
to automatically link in your deps with npm, even if you don't plan on
publishing it for others to use), and you should do the following:


1. If it's a website or something, provide a "start" command.

Your package.json file could be something like this:

{ "name" : "my-blog"
, "version" : "1.2.3"
, "dependencies" : { "express" : "*" }
, "scripts" : { "start" : "node my-blog.js" }
}

There are also "stop" and "restart" commands that you can put in
there, if they make sense. These aren't terribly useful at the
moment, since npm doesn't handle pid management and such, but it
provides a consistent hook that can be leveraged automatically in the
future.


2. Regardless of what it is, but especially if it's a library or util
designed for others to use, provide a test command:

{ "name" : "my-tdd-app"
, "version" : "1.2.3"
, "scripts" : { "test" : "make test" }
}

To run the test script, "npm test my-tdd-app".


3. If there are dependencies that are *only* required for testing or
other development scenarios, then list them as "devDependencies",
rather than "dependencies".

{ "name" : "my-express-app"
, "version" : "1.2.3"
, "dependencies" : { "express" : "*" }
, "devDependencies" : { "expresso" : "*"}
, "scripts" : { "test" : "expresso blah blah" }
}

To install the dev dependencies, you can either set the `dev` config
to true, or do `npm install whatever --dev`, or just do `npm link` in
your project dir, and it'll pull in the dev dependencies as well as
the "normal" dependencies.


Some of these things aren't yet very useful, but they're going to be
awesome in the near-ish future, so you should start adding them to
your package now.

--i

Felix Geisendörfer

unread,
Oct 28, 2010, 3:36:09 PM10/28/10
to nodejs
> 2. Regardless of what it is, but especially if it's a library or util
> designed for others to use, provide a test command:

Just updated node-mysql. One question about testing so:

Are you planning to execute these tests when installing a package in
the future? If so, it would probably be wise to only run tests that
are independent of environment (think database credentials), right?

--fg

Ryan Gahl

unread,
Oct 28, 2010, 3:38:33 PM10/28/10
to nod...@googlegroups.com
Holy crap npm is getting all kinds of win and awesome added it to it!

When the day finally arrives for us to package something, you can bet we'll be adding all the sugar. 

I know you know it, but saying it anyway... you rock.



--
You received this message because you are subscribed to the Google Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com.
To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nodejs?hl=en.


Ryan Gahl

unread,
Oct 28, 2010, 3:42:09 PM10/28/10
to nod...@googlegroups.com
Wasn't there a nifty site (or github Pages site) for npm once, with a groovy ASCII-lookin logo? and more docs? 

Or was that just in a dream I had?

Ryan Gahl

unread,
Oct 28, 2010, 3:43:20 PM10/28/10
to nod...@googlegroups.com
Nevermind on the "more docs" thing... found plenty.  :)

Nathan Rajlich

unread,
Oct 28, 2010, 4:02:05 PM10/28/10
to nod...@googlegroups.com
@Ryan http://npmjs.org/

@isaacs is devDependencies new? That's a feature I've been wanting!!

Isaac Schlueter

unread,
Oct 28, 2010, 4:13:41 PM10/28/10
to nod...@googlegroups.com
2010/10/28 Felix Geisendörfer <fe...@debuggable.com>:

> Are you planning to execute these tests when installing a package in
> the future?

I'm not going to execute tests on install, no. In fact, I'm not
entirely sure exactly what it's going to look like long-term, but in
my foggy imaginings of the future, I see a CI system where brave
volunteers can install and test packages, and automatically upload
their results. Then, we can gather information about package
stability and worth, and have some heuristics that can help people
decide which piece of software is best for their needs.

The "test" script will be a bit part of making all that work. It will
probably not be until well after a 1.0.0 release, I'm sure.

On Thu, Oct 28, 2010 at 13:02, Nathan Rajlich <nat...@tootallnate.net> wrote:
> is devDependencies new? That's a feature I've been wanting!!

No, it's been sitting quietly in `npm help json` for a while now.

--i

Reply all
Reply to author
Forward
0 new messages