first commit
This commit is contained in:
38
build/node_modules/find-versions/cli.js
generated
vendored
Executable file
38
build/node_modules/find-versions/cli.js
generated
vendored
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
var getStdin = require('get-stdin');
|
||||
var meow = require('meow');
|
||||
var findVersions = require('./');
|
||||
|
||||
var cli = meow([
|
||||
'Usage',
|
||||
' $ find-versions <string> [--first] [--loose]',
|
||||
' $ echo <string> | find-versions',
|
||||
'',
|
||||
'Example',
|
||||
' $ find-versions \'unicorns v1.2.3\'',
|
||||
' 1.2.3',
|
||||
'',
|
||||
' $ curl --version | find-versions --first',
|
||||
' 7.30.0',
|
||||
'',
|
||||
'Options',
|
||||
' --first Return the first match',
|
||||
' --loose Match non-semver versions like 1.88'
|
||||
]);
|
||||
|
||||
function init(data) {
|
||||
var ret = findVersions(data, {loose: cli.flags.loose});
|
||||
console.log(cli.flags.first ? ret[0] : ret.join('\n'));
|
||||
}
|
||||
|
||||
if (process.stdin.isTTY) {
|
||||
if (!cli.input[0]) {
|
||||
console.error('Expected a string');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
init(cli.input[0]);
|
||||
} else {
|
||||
getStdin(init);
|
||||
}
|
||||
18
build/node_modules/find-versions/index.js
generated
vendored
Normal file
18
build/node_modules/find-versions/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
var semverRegex = require('semver-regex');
|
||||
var arrayUniq = require('array-uniq');
|
||||
|
||||
module.exports = function (str, opts) {
|
||||
if (typeof str !== 'string') {
|
||||
throw new TypeError('Expected a string');
|
||||
}
|
||||
|
||||
opts = opts || {};
|
||||
|
||||
var reLoose = new RegExp('(?:' + semverRegex().source + ')|(?:v?(?:\\d+\\.\\d+)(?:\\.\\d+)?)', 'g');
|
||||
var matches = str.match(opts.loose === true ? reLoose : semverRegex()) || [];
|
||||
|
||||
return arrayUniq(matches.map(function (el) {
|
||||
return el.trim().replace(/^v/, '').replace(/^\d+\.\d+$/, '$&.0');
|
||||
}));
|
||||
};
|
||||
21
build/node_modules/find-versions/license
generated
vendored
Normal file
21
build/node_modules/find-versions/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
85
build/node_modules/find-versions/package.json
generated
vendored
Normal file
85
build/node_modules/find-versions/package.json
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"find-versions@1.2.1",
|
||||
"/Users/asciidisco/Desktop/asciidisco.com/build"
|
||||
]
|
||||
],
|
||||
"_from": "find-versions@1.2.1",
|
||||
"_id": "find-versions@1.2.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-y96fEuOFdaCvG+G5osXV/Y8Ya2I=",
|
||||
"_location": "/find-versions",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "find-versions@1.2.1",
|
||||
"name": "find-versions",
|
||||
"escapedName": "find-versions",
|
||||
"rawSpec": "1.2.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.2.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/bin-version"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/find-versions/-/find-versions-1.2.1.tgz",
|
||||
"_spec": "1.2.1",
|
||||
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bin": {
|
||||
"find-versions": "cli.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/find-versions/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"array-uniq": "^1.0.0",
|
||||
"get-stdin": "^4.0.1",
|
||||
"meow": "^3.5.0",
|
||||
"semver-regex": "^1.0.0"
|
||||
},
|
||||
"description": "Find semver versions in a string: `unicorn 1.0.0` → `1.0.0`",
|
||||
"devDependencies": {
|
||||
"mocha": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"cli.js"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/find-versions#readme",
|
||||
"keywords": [
|
||||
"cli-app",
|
||||
"cli",
|
||||
"semver",
|
||||
"version",
|
||||
"versions",
|
||||
"regex",
|
||||
"regexp",
|
||||
"re",
|
||||
"match",
|
||||
"matching",
|
||||
"semantic",
|
||||
"find",
|
||||
"extract",
|
||||
"get"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "find-versions",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/find-versions.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"version": "1.2.1"
|
||||
}
|
||||
72
build/node_modules/find-versions/readme.md
generated
vendored
Normal file
72
build/node_modules/find-versions/readme.md
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
# find-versions [](https://travis-ci.org/sindresorhus/find-versions)
|
||||
|
||||
> Find semver versions in a string: `unicorn 1.0.0` → `1.0.0`
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save find-versions
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var findVersions = require('find-versions');
|
||||
|
||||
findVersions('unicorn 1.0.0 rainbow v2.3.4+build.1');
|
||||
//=> ['1.0.0', '2.3.4+build.1']
|
||||
|
||||
findVersions('cp (GNU coreutils) 8.22', {loose: true});
|
||||
//=> ['8.22.0']
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### findVersions(input, options)
|
||||
|
||||
#### input
|
||||
|
||||
*Required*
|
||||
Type: `string`
|
||||
|
||||
#### options.loose
|
||||
|
||||
Type: `boolean`
|
||||
Default: `false`
|
||||
|
||||
Also match non-semver versions like `1.88`.
|
||||
They're coerced into semver compliant versions.
|
||||
|
||||
|
||||
## CLI
|
||||
|
||||
```
|
||||
$ npm install --global find-versions
|
||||
```
|
||||
|
||||
```
|
||||
$ find-versions --help
|
||||
|
||||
Usage
|
||||
$ find-versions <string> [--first] [--loose]
|
||||
$ echo <string> | find-versions
|
||||
|
||||
Example
|
||||
$ find-versions 'unicorns v1.2.3'
|
||||
1.2.3
|
||||
|
||||
$ curl --version | find-versions --first
|
||||
7.30.0
|
||||
|
||||
Options
|
||||
--first Return the first match
|
||||
--loose Match non-semver versions like 1.88
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
Reference in New Issue
Block a user