Added logging, changed some directory structure

This commit is contained in:
2018-01-13 21:33:40 -05:00
parent f079a5f067
commit 8e72ffb917
73656 changed files with 35284 additions and 53718 deletions

View File

@@ -0,0 +1,65 @@
'use strict';
var Promise = require('pinkie-promise');
var arrayUnion = require('array-union');
var objectAssign = require('object-assign');
var glob = require('glob');
var arrify = require('arrify');
var pify = require('pify');
var globP = pify(glob, Promise).bind(glob);
function isNegative(pattern) {
return pattern[0] === '!';
}
function generateGlobTasks(patterns, opts) {
var globTasks = [];
patterns = arrify(patterns);
opts = objectAssign({
cache: Object.create(null),
statCache: Object.create(null),
realpathCache: Object.create(null),
symlinks: Object.create(null),
ignore: []
}, opts);
patterns.forEach(function (pattern, i) {
if (isNegative(pattern)) {
return;
}
var ignore = patterns.slice(i).filter(isNegative).map(function (pattern) {
return pattern.slice(1);
});
globTasks.push({
pattern: pattern,
opts: objectAssign({}, opts, {
ignore: opts.ignore.concat(ignore)
})
});
});
return globTasks;
}
module.exports = function (patterns, opts) {
var globTasks = generateGlobTasks(patterns, opts);
return Promise.all(globTasks.map(function (task) {
return globP(task.pattern, task.opts);
})).then(function (paths) {
return arrayUnion.apply(null, paths);
});
};
module.exports.sync = function (patterns, opts) {
var globTasks = generateGlobTasks(patterns, opts);
return globTasks.reduce(function (matches, task) {
return arrayUnion(matches, glob.sync(task.pattern, task.opts));
}, []);
};
module.exports.generateGlobTasks = generateGlobTasks;

View 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.

View File

@@ -0,0 +1,105 @@
{
"_args": [
[
"globby@5.0.0",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "globby@5.0.0",
"_id": "globby@5.0.0",
"_inBundle": false,
"_integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=",
"_location": "/react-scripts/globby",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "globby@5.0.0",
"name": "globby",
"escapedName": "globby",
"rawSpec": "5.0.0",
"saveSpec": null,
"fetchSpec": "5.0.0"
},
"_requiredBy": [
"/react-scripts/del"
],
"_resolved": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz",
"_spec": "5.0.0",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/globby/issues"
},
"dependencies": {
"array-union": "^1.0.1",
"arrify": "^1.0.0",
"glob": "^7.0.3",
"object-assign": "^4.0.1",
"pify": "^2.0.0",
"pinkie-promise": "^2.0.0"
},
"description": "Extends `glob` with support for multiple patterns and exposes a Promise API",
"devDependencies": {
"ava": "*",
"glob-stream": "github:wearefractal/glob-stream#master",
"globby": "github:sindresorhus/globby#master",
"matcha": "^0.7.0",
"rimraf": "^2.2.8",
"xo": "*"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/sindresorhus/globby#readme",
"keywords": [
"all",
"array",
"directories",
"dirs",
"expand",
"files",
"filesystem",
"filter",
"find",
"fnmatch",
"folders",
"fs",
"glob",
"globbing",
"globs",
"gulpfriendly",
"match",
"matcher",
"minimatch",
"multi",
"multiple",
"paths",
"pattern",
"patterns",
"traverse",
"util",
"utility",
"wildcard",
"wildcards",
"promise"
],
"license": "MIT",
"name": "globby",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/globby.git"
},
"scripts": {
"bench": "npm update globby glob-stream && matcha bench.js",
"test": "xo && ava"
},
"version": "5.0.0"
}

View File

@@ -0,0 +1,82 @@
# globby [![Build Status](https://travis-ci.org/sindresorhus/globby.svg?branch=master)](https://travis-ci.org/sindresorhus/globby)
> Extends [glob](https://github.com/isaacs/node-glob) with support for multiple patterns and exposes a Promise API
## Install
```
$ npm install --save globby
```
## Usage
```
├── unicorn
├── cake
└── rainbow
```
```js
const globby = require('globby');
globby(['*', '!cake']).then(paths => {
console.log(paths);
//=> ['unicorn', 'rainbow']
});
```
## API
### globby(patterns, [options])
Returns a Promise for an array of matching paths.
### globby.sync(patterns, [options])
Returns an array of matching paths.
### globby.generateGlobTasks(patterns, [options])
Returns an array of objects in the format `{ pattern: string, opts: Object }`, which can be passed as arguments to [`node-glob`](https://github.com/isaacs/node-glob). This is useful for other globbing-related packages.
Note that you should avoid running the same tasks multiple times as they contain a file system cache. Instead, create a new tasks list to ensure that file system changes are taken in consideration.
#### patterns
Type: `string`, `Array`
See supported `minimatch` [patterns](https://github.com/isaacs/minimatch#usage).
#### options
Type: `Object`
See the `node-glob` [options](https://github.com/isaacs/node-glob#options).
## Globbing patterns
Just a quick overview.
- `*` matches any number of characters, but not `/`
- `?` matches a single character, but not `/`
- `**` matches any number of characters, including `/`, as long as it's the only thing in a path part
- `{}` allows for a comma-separated list of "or" expressions
- `!` at the beginning of a pattern will negate the match
[Various patterns and expected matches.](https://github.com/sindresorhus/multimatch/blob/master/test.js)
## Related
- [multimatch](https://github.com/sindresorhus/multimatch) - Match against a list instead of the filesystem
- [glob-stream](https://github.com/wearefractal/glob-stream) - Streaming alternative
- [matcher](https://github.com/sindresorhus/matcher) - Simple wildcard matching
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)