@@ -68,18 +68,7 @@ Version must be parseable by
6868[ node-semver] ( https://github.com/isaacs/node-semver ) , which is bundled
6969with npm as a dependency. (` npm install semver ` to use it yourself.)
7070
71- Here's how npm's semver implementation deviates from what's on semver.org:
72-
73- * Versions can start with "v"
74- * A numeric item separated from the main three-number version by a hyphen
75- will be interpreted as a "build" number, and will * increase* the version.
76- But, if the tag is not a number separated by a hyphen, then it's treated
77- as a pre-release tag, and is * less than* the version without a tag.
78- So, ` 0.1.2-7 > 0.1.2-7-beta > 0.1.2-6 > 0.1.2 > 0.1.2beta `
79-
80- This is a little bit confusing to explain, but matches what you see in practice
81- when people create tags in git like "v1.2.3" and then do "git describe" to generate
82- a patch version.
71+ More on version numbers and ranges at semver(7).
8372
8473## description
8574
@@ -335,24 +324,23 @@ configs.
335324
336325## dependencies
337326
338- Dependencies are specified with a simple hash of package name to version
339- range. The version range is EITHER a string which has one or more
340- space-separated descriptors, OR a range like "fromVersion - toVersion"
327+ Dependencies are specified with a simple hash of package name to
328+ version range. The version range is a string which has one or more
329+ space-separated descriptors. Dependencies can also be identified with
330+ a tarball or git URL.
341331
342- ** Please do not put test harnesses in your ` dependencies ` hash. ** See
343- ` devDependencies ` , below.
332+ ** Please do not put test harnesses or transpilers in your
333+ ` dependencies ` hash. ** See ` devDependencies ` , below.
344334
345- Version range descriptors may be any of the following styles, where "version"
346- is a semver compatible version identifier.
335+ See semver(7) for more details about specifying version ranges.
347336
348337* ` version ` Must match ` version ` exactly
349- * ` =version ` Same as just ` version `
350338* ` >version ` Must be greater than ` version `
351339* ` >=version ` etc
352340* ` <version `
353341* ` <=version `
354- * ` ~version ` See 'Tilde Version Ranges' below
355- * ` 1.2.x ` See 'X Version Ranges' below
342+ * ` ~version ` "Approximately equivalent to version" See semver(7)
343+ * ` 1.2.x ` 1.2.0, 1.2.1, etc., but not 1.3.0
356344* ` http://... ` See 'URLs as Dependencies' below
357345* ` * ` Matches any version
358346* ` "" ` (just an empty string) Same as ` * `
@@ -376,40 +364,9 @@ For example, these are all valid:
376364 }
377365 }
378366
379- ### Tilde Version Ranges
380-
381- A range specifier starting with a tilde ` ~ ` character is matched against
382- a version in the following fashion.
383-
384- * The version must be at least as high as the range.
385- * The version must be less than the next major revision above the range.
386-
387- For example, the following are equivalent:
388-
389- * ` "~1.2.3" = ">=1.2.3 <1.3.0" `
390- * ` "~1.2" = ">=1.2.0 <1.3.0" `
391- * ` "~1" = ">=1.0.0 <1.1.0" `
392-
393- ### X Version Ranges
394-
395- An "x" in a version range specifies that the version number must start
396- with the supplied digits, but any digit may be used in place of the x.
397-
398- The following are equivalent:
399-
400- * ` "1.2.x" = ">=1.2.0 <1.3.0" `
401- * ` "1.x.x" = ">=1.0.0 <2.0.0" `
402- * ` "1.2" = "1.2.x" `
403- * ` "1.x" = "1.x.x" `
404- * ` "1" = "1.x.x" `
405-
406- You may not supply a comparator with a version containing an x. Any
407- digits after the first "x" are ignored.
408-
409367### URLs as Dependencies
410368
411- Starting with npm version 0.2.14, you may specify a tarball URL in place
412- of a version range.
369+ You may specify a tarball URL in place of a version range.
413370
414371This tarball will be downloaded and installed locally to your package at
415372install time.
@@ -436,11 +393,35 @@ the external test or documentation framework that you use.
436393In this case, it's best to list these additional items in a
437394` devDependencies ` hash.
438395
439- These things will be installed whenever the ` --dev ` configuration flag
440- is set. This flag is set automatically when doing ` npm link ` or when doing
441- ` npm install ` from the root of a package, and can be managed like any other npm
396+ These things will be installed when doing ` npm link ` or ` npm install `
397+ from the root of a package, and can be managed like any other npm
442398configuration param. See ` npm-config(7) ` for more on the topic.
443399
400+ For build steps that are not platform-specific, such as compiling
401+ CoffeeScript or other languages to JavaScript, use the ` prepublish `
402+ script to do this, and make the required package a devDependency.
403+
404+ For example:
405+
406+ ``` json
407+ { "name" : " ethopia-waza" ,
408+ "description" : " a delightfully fruity coffee varietal" ,
409+ "version" : " 1.2.3" ,
410+ "devDependencies" : {
411+ "coffee-script" : " ~1.6.3"
412+ },
413+ "scripts" : {
414+ "prepublish" : " coffee -o lib/ -c src/waza.coffee"
415+ },
416+ "main" : " lib/waza.js"
417+ }
418+ ```
419+
420+ The ` prepublish ` script will be run before publishing, so that users
421+ can consume the functionality without requiring them to compile it
422+ themselves. In dev mode (ie, locally running ` npm install ` ), it'll
423+ run this script as well, so that you can test it easily.
424+
444425## bundledDependencies
445426
446427Array of package names that will be bundled when publishing the package.
@@ -481,7 +462,7 @@ Entries in `optionalDependencies` will override entries of the same name in
481462
482463You can specify the version of node that your stuff works on:
483464
484- { "engines" : { "node" : ">=0.1.27 <0.1.30 " } }
465+ { "engines" : { "node" : ">=0.10.3 <0.12 " } }
485466
486467And, like with dependencies, if you don't specify the version (or if you
487468specify "\* " as the version), then any version of node will do.
@@ -576,7 +557,7 @@ overridden.
576557
577558## SEE ALSO
578559
579- * npm- semver(7)
560+ * semver(7)
580561* npm-init(1)
581562* npm-version(1)
582563* npm-config(1)
0 commit comments