diff options
Diffstat (limited to 'html/doc/semver.html')
-rw-r--r-- | html/doc/semver.html | 443 |
1 files changed, 443 insertions, 0 deletions
diff --git a/html/doc/semver.html b/html/doc/semver.html new file mode 100644 index 000000000..11d75b368 --- /dev/null +++ b/html/doc/semver.html @@ -0,0 +1,443 @@ +<!doctype html> +<html> + <title>npm-semver</title> +<style type="text/css"> + +/* reset */ +* { + margin:0; + padding:0; + border:none; + font-family:inherit; + font-size:inherit; + font-weight:inherit; +} +:target::before { + content:" → "; + position:absolute; + display:block; + opacity:0.5; + color:#f00; + margin:0 0 0 -1.2em; +} +abbr, acronym { + border-bottom:1px dotted #aaa; +} +kbd, code, pre { + font-family:monospace; + margin:0; + font-size:18px; + line-height:24px; + background:#eee; + outline:1px solid #ccc; +} +kbd code, kbd pre, kbd kbd, +pre code, pre pre, pre kbd, +code code, code pre, code kbd { outline: none } +.dollar::before { + content:"$ "; + display:inline; +} +p, ul, ol, dl, pre { + margin:30px 0; + line-height:30px; +} +hr { + margin:30px auto 29px; + width:66%; + height:1px; + background:#aaa; +} +pre { + display:block; +} +dd :first-child { + margin-top:0; +} + +body { + quotes:"“" "”" "‘" "’"; + width:666px; + margin:30px auto 120px; + font-family:Times New Roman, serif; + font-size:20px; + background:#fff; + line-height:30px; + color:#111; +} + +blockquote { + position:relative; + font-size:16px; + line-height:30px; + font-weight:bold; + width:85%; + margin:0 auto; +} +blockquote::before { + font-size:90px; + display:block; + position:absolute; + top:20px; + right:100%; + content:"“"; + padding-right:10px; + color:#ccc; +} +.source cite::before { + content:"— "; +} +.source { + padding-left:20%; + margin-top:30px; +} +.source cite span { + font-style:normal; +} +blockquote p { + margin-bottom:0; +} +.quote blockquote { + font-weight:normal; +} + +h1, h2, h3, h4, h5, h6, dt, #header { + font-family:serif; + font-size:20px; + font-weight:bold; +} +h2 { + background:#eee; +} +h1, h2 { + line-height:40px; +} + +i, em, cite { + font-style:italic; +} +b, strong { + font-weight:bold; +} +i, em, cite, b, strong, small { + line-height:28px; +} +small, .small, .small *, aside { + font-style:italic; + color:#669; + font-size:18px; +} +spall a, .small a { + text-decoration:underline; +} +del { + text-decoration:line-through; +} +ins { + text-decoration:underline; +} +.alignright { display:block; float:right; margin-left:1em; } +.alignleft { display:block; float:left; margin-right:1em; } + +q:before, q q q:before, q q q q q:before, q q q q q q q:before { content:"“"; } +q q:before, q q q q:before, q q q q q q:before, q q q q q q q q:before { content:"‘"; } +q:after, q q q:after, q q q q q:after, q q q q q q q:after { content:"”"; } +q q:after, q q q q:after, q q q q q q:after, q q q q q q q q:after { content:"’"; } + +a { color:#00f; text-decoration:none; } +a:visited { color:#636; } +a:hover, a:active { color:#900!important; text-decoration:underline; } + +h1 { + font-weight:bold; + background:#fff; +} + +.navigation { + display:table; + width:100%; + margin:0 0 30px 0; + position:relative; +} +#nav-above { + margin-bottom:0; +} +.navigation .nav-previous { + display:table-cell; + text-align:left; + width:50%; +} +/* hang the » and « off into the margins */ +.navigation .nav-previous a:before, .navigation .nav-next a:after { + content: "«"; + display:block; + height:30px; + margin-bottom:-30px; + text-decoration:none; + margin-left:-15px; +} +.navigation .nav-next a:after { + content: "»"; + text-align:right; + margin-left:0; + margin-top:-30px; + margin-right:-15px; +} + + +.navigation .nav-next { + display:table-cell; + text-align:right; + width:50%; +} +.navigation a { + display:block; + width:100%; + height:100%; +} + +input, button, textarea { + border:0; + line-height:30px; +} +textarea { + height:300px; +} +input { + height:30px; + line-height:30px; +} +input.submit, input#submit, input.button, button, input[type=submit] { + cursor:hand; cursor:pointer; + outline:1px solid #ccc; +} + +#wrapper { + margin-bottom:90px; + position:relative; + z-index:1; + *zoom:1; + background:#fff; +} +#wrapper:after { + display:block; + content:"."; + visibility:hidden; + width:0; + height:0; + clear:both; +} + +.sidebar .xoxo > li { + float:left; + width:50%; +} +.sidebar li { + list-style:none; +} +.sidebar #elsewhere { + margin-left:-10%; + margin-right:-10%; +} +.sidebar #rss-links, .sidebar #twitter-feeds { + float:right; + clear:right; + width:20%; +} +.sidebar #comment { + clear:both; + float:none; + width:100%; +} +.sidebar #search { + clear:both; + float:none; + width:100%; +} +.sidebar #search h2 { + margin-left:40%; +} +.sidebar #search #s { + width:90%; + float:left; +} +.sidebar #search #searchsubmit { + width:10%; + float:right; +} +.sidebar * { + font-size:15px; + line-height:30px; +} + +#footer, #footer * { + margin:300px 0 0; + text-align:right; + font-size:14px; + line-height:90px; +} + +#toc { + position:absolute; + top:0; + right:0; + padding:40px 0 40px 20px; + margin:0; + width:200px; + opacity:0.2; + z-index:-1; +} +#toc:hover { + opacity:1; + background:#fff; + z-index:999; +} +#toc ul { + padding:0; + margin:0; +} +#toc, #toc li { + list-style-type:none; + font-size:15px; + line-height:15px; +} +#toc li { + padding:0 0 0 10px; +} + + +@media print { + a[href] { + color:inherit; + } + a[href]:after { + white-space:nowrap; + content:" " attr(href); + } + a[href^=\#], .navigation { + display:none; + } +} +</style> + + <body> + <div id="wrapper"> +<h1>semver(1) -- The semantic versioner for npm</h1> + +<h2 id="Usage">Usage</h2> + +<p>As a node module:</p> + +<pre><code>$ npm install semver + +semver.valid('1.2.3') // true +semver.valid('a.b.c') // false +semver.clean(' =v1.2.3 ') // '1.2.3' +semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true +semver.gt('1.2.3', '9.8.7') // false +semver.lt('1.2.3', '9.8.7') // true</code></pre> + +<p>As a command-line utility:</p> + +<pre><code>$ npm install semver -g +$ semver -h + +Usage: semver -v <version> [-r <range>] +Test if version(s) satisfy the supplied range(s), +and sort them. + +Multiple versions or ranges may be supplied. + +Program exits successfully if any valid version satisfies +all supplied ranges, and prints all satisfying versions. + +If no versions are valid, or ranges are not satisfied, +then exits failure. + +Versions are printed in ascending order, so supplying +multiple versions to the utility will just sort them.</code></pre> + +<h2 id="Versions">Versions</h2> + +<p>A version is the following things, in this order:</p> + +<ul><li>a number (Major)</li><li>a period</li><li>a number (minor)</li><li>a period</li><li>a number (patch)</li><li>OPTIONAL: a hyphen, followed by a number (build)</li><li>OPTIONAL: a collection of pretty much any non-whitespace characters +(tag)</li></ul> + +<p>A leading <code>"="</code> or <code>"v"</code> character is stripped off and ignored.</p> + +<h2 id="Comparisons">Comparisons</h2> + +<p>The ordering of versions is done using the following algorithm, given +two versions and asked to find the greater of the two:</p> + +<ul><li>If the majors are numerically different, then take the one +with a bigger major number. <code>2.3.4 > 1.3.4</code></li><li>If the minors are numerically different, then take the one +with the bigger minor number. <code>2.3.4 > 2.2.4</code></li><li>If the patches are numerically different, then take the one with the +bigger patch number. <code>2.3.4 > 2.3.3</code></li><li>If only one of them has a build number, then take the one with the +build number. <code>2.3.4-0 > 2.3.4</code></li><li>If they both have build numbers, and the build numbers are numerically +different, then take the one with the bigger build number. +<code>2.3.4-10 > 2.3.4-9</code></li><li>If only one of them has a tag, then take the one without the tag. +<code>2.3.4 > 2.3.4-beta</code></li><li>If they both have tags, then take the one with the lexicographically +larger tag. <code>2.3.4-beta > 2.3.4-alpha</code></li><li>At this point, they're equal.</li></ul> + +<h2 id="Ranges">Ranges</h2> + +<p>The following range styles are supported:</p> + +<ul><li><code>>1.2.3</code> Greater than a specific version.</li><li><code><1.2.3</code> Less than</li><li><code>1.2.3 - 2.3.4</code> := <code>>=1.2.3 <=2.3.4</code></li><li><code>~1.2.3</code> := <code>>=1.2.3 <1.3.0</code></li><li><code>~1.2</code> := <code>>=1.2.0 <2.0.0</code></li><li><code>~1</code> := <code>>=1.0.0 <2.0.0</code></li><li><code>1.2.x</code> := <code>>=1.2.0 <1.3.0</code></li><li><code>1.x</code> := <code>>=1.0.0 <2.0.0</code></li></ul> + +<p>Ranges can be joined with either a space (which implies "and") or a +<code>||</code> (which implies "or").</p> + +<h2 id="Functions">Functions</h2> + +<ul><li>valid(v): Return the parsed version, or null if it's not valid.</li><li>inc(v, release): Return the version incremented by the release type +(major, minor, patch, or build), or null if it's not valid.</li></ul> + +<h3 id="Comparison">Comparison</h3> + +<ul><li>gt(v1, v2): <code>v1 > v2</code></li><li>gte(v1, v2): <code>v1 >= v2</code></li><li>lt(v1, v2): <code>v1 < v2</code></li><li>lte(v1, v2): <code>v1 <= v2</code></li><li>eq(v1, v2): <code>v1 == v2</code> This is true if they're logically equivalent, +even if they're not the exact same string. You already know how to +compare strings.</li><li>neq(v1, v2): <code>v1 != v2</code> The opposite of eq.</li><li>cmp(v1, comparator, v2): Pass in a comparison string, and it'll call +the corresponding function above. <code>"==="</code> and <code>"!=="</code> do simple +string comparison, but are included for completeness. Throws if an +invalid comparison string is provided.</li><li>compare(v1, v2): Return 0 if v1 == v2, or 1 if v1 is greater, or -1 if +v2 is greater. Sorts in ascending order if passed to Array.sort().</li><li>rcompare(v1, v2): The reverse of compare. Sorts an array of versions +in descending order when passed to Array.sort().</li></ul> + +<h3 id="Ranges">Ranges</h3> + +<ul><li>validRange(range): Return the valid range or null if it's not valid</li><li>satisfies(version, range): Return true if the version satisfies the +range.</li><li>maxSatisfying(versions, range): Return the highest version in the list +that satisfies the range, or null if none of them do.</li></ul> +</div> +<script> +els = Array.prototype.slice.call((wrapper = document.getElementById("wrapper")) +.getElementsByTagName("*"), 0) +.filter(function (el) { + return el.parentNode === wrapper + && el.tagName.match(/H[1-6]/) + && el.id +}) +var l = 2 +;(toc = document.createElement("ul")).innerHTML = els.map(function (el) { + var i = el.tagName.charAt(1) + , out = "" + while (i > l) { + out += "<ul>" + l ++ + } + while (i < l) { + out += "</ul>" + l -- + } + out += "<li><a href='#" + el.id + "'>" + el.innerHTML + "</a>" + return out +}).join("\n") +toc.id = "toc" +document.body.appendChild(toc) + +</script> +</body></html> +<!-- npm help semver - 2011-31-04 05:09:24 --> |