First commit
This commit is contained in:
70
hGameTest/node_modules/del/index.js
generated
vendored
Normal file
70
hGameTest/node_modules/del/index.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const globby = require('globby');
|
||||
const isPathCwd = require('is-path-cwd');
|
||||
const isPathInCwd = require('is-path-in-cwd');
|
||||
const pify = require('pify');
|
||||
const rimraf = require('rimraf');
|
||||
const pMap = require('p-map');
|
||||
|
||||
const rimrafP = pify(rimraf);
|
||||
|
||||
function safeCheck(file) {
|
||||
if (isPathCwd(file)) {
|
||||
throw new Error('Cannot delete the current working directory. Can be overriden with the `force` option.');
|
||||
}
|
||||
|
||||
if (!isPathInCwd(file)) {
|
||||
throw new Error('Cannot delete files/folders outside the current working directory. Can be overriden with the `force` option.');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = (patterns, opts) => {
|
||||
opts = Object.assign({}, opts);
|
||||
|
||||
const force = opts.force;
|
||||
delete opts.force;
|
||||
|
||||
const dryRun = opts.dryRun;
|
||||
delete opts.dryRun;
|
||||
|
||||
const mapper = file => {
|
||||
if (!force) {
|
||||
safeCheck(file);
|
||||
}
|
||||
|
||||
file = path.resolve(opts.cwd || '', file);
|
||||
|
||||
if (dryRun) {
|
||||
return file;
|
||||
}
|
||||
|
||||
return rimrafP(file, {glob: false}).then(() => file);
|
||||
};
|
||||
|
||||
return globby(patterns, opts).then(files => pMap(files, mapper, opts));
|
||||
};
|
||||
|
||||
module.exports.sync = (patterns, opts) => {
|
||||
opts = Object.assign({}, opts);
|
||||
|
||||
const force = opts.force;
|
||||
delete opts.force;
|
||||
|
||||
const dryRun = opts.dryRun;
|
||||
delete opts.dryRun;
|
||||
|
||||
return globby.sync(patterns, opts).map(file => {
|
||||
if (!force) {
|
||||
safeCheck(file);
|
||||
}
|
||||
|
||||
file = path.resolve(opts.cwd || '', file);
|
||||
|
||||
if (!dryRun) {
|
||||
rimraf.sync(file, {glob: false});
|
||||
}
|
||||
|
||||
return file;
|
||||
});
|
||||
};
|
||||
9
hGameTest/node_modules/del/license
generated
vendored
Normal file
9
hGameTest/node_modules/del/license
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
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.
|
||||
93
hGameTest/node_modules/del/package.json
generated
vendored
Normal file
93
hGameTest/node_modules/del/package.json
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
{
|
||||
"_from": "del@^3.0.0",
|
||||
"_id": "del@3.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-U+z2mf/LyzljdpGrE7rxYIGXZuU=",
|
||||
"_location": "/del",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "del@^3.0.0",
|
||||
"name": "del",
|
||||
"escapedName": "del",
|
||||
"rawSpec": "^3.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/webpack-dev-server"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/del/-/del-3.0.0.tgz",
|
||||
"_shasum": "53ecf699ffcbcb39637691ab13baf160819766e5",
|
||||
"_spec": "del@^3.0.0",
|
||||
"_where": "/home/andreas/Documents/Projects/haxe/openfl/nigger/node_modules/webpack-dev-server",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/del/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"globby": "^6.1.0",
|
||||
"is-path-cwd": "^1.0.0",
|
||||
"is-path-in-cwd": "^1.0.0",
|
||||
"p-map": "^1.1.1",
|
||||
"pify": "^3.0.0",
|
||||
"rimraf": "^2.2.8"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Delete files and folders",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"make-dir": "^1.0.0",
|
||||
"tempy": "^0.1.0",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/del#readme",
|
||||
"keywords": [
|
||||
"delete",
|
||||
"files",
|
||||
"folders",
|
||||
"directories",
|
||||
"del",
|
||||
"remove",
|
||||
"destroy",
|
||||
"trash",
|
||||
"unlink",
|
||||
"clean",
|
||||
"cleaning",
|
||||
"cleanup",
|
||||
"rm",
|
||||
"rmrf",
|
||||
"rimraf",
|
||||
"rmdir",
|
||||
"glob",
|
||||
"gulpfriendly",
|
||||
"file",
|
||||
"folder",
|
||||
"directory",
|
||||
"dir",
|
||||
"fs",
|
||||
"filesystem"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "del",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/del.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "3.0.0"
|
||||
}
|
||||
121
hGameTest/node_modules/del/readme.md
generated
vendored
Normal file
121
hGameTest/node_modules/del/readme.md
generated
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
# del [](https://travis-ci.org/sindresorhus/del) [](https://github.com/sindresorhus/xo)
|
||||
|
||||
> Delete files and folders using [globs](https://github.com/isaacs/minimatch#usage)
|
||||
|
||||
Similar to [rimraf](https://github.com/isaacs/rimraf), but with a Promise API and support for multiple files and globbing. It also protects you against deleting the current working directory and above.
|
||||
|
||||
---
|
||||
|
||||
<p align="center">🐶</p>
|
||||
<p align="center"><b>Support this project and improve your JavaScript skills with this great <a href="https://ES6.io/friend/AWESOME">ES6 course</a> by Wes Bos.</b><br>Try his free <a href="https://javascript30.com/friend/AWESOME">JavaScript 30 course</a> for a taste of what to expect. You might also like his <a href="https://ReactForBeginners.com/friend/AWESOME">React</a> and <a href="https://SublimeTextBook.com/friend/AWESOME">Sublime</a> course.</p>
|
||||
|
||||
---
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save del
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const del = require('del');
|
||||
|
||||
del(['tmp/*.js', '!tmp/unicorn.js']).then(paths => {
|
||||
console.log('Deleted files and folders:\n', paths.join('\n'));
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## Beware
|
||||
|
||||
The glob pattern `**` matches all children and *the parent*.
|
||||
|
||||
So this won't work:
|
||||
|
||||
```js
|
||||
del.sync(['public/assets/**', '!public/assets/goat.png']);
|
||||
```
|
||||
|
||||
You have to explicitly ignore the parent directories too:
|
||||
|
||||
```js
|
||||
del.sync(['public/assets/**', '!public/assets', '!public/assets/goat.png']);
|
||||
```
|
||||
|
||||
Suggestions on how to improve this welcome!
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### del(patterns, [options])
|
||||
|
||||
Returns a promise for an array of deleted paths.
|
||||
|
||||
### del.sync(patterns, [options])
|
||||
|
||||
Returns an array of deleted paths.
|
||||
|
||||
#### patterns
|
||||
|
||||
Type: `string` `Array`
|
||||
|
||||
See supported minimatch [patterns](https://github.com/isaacs/minimatch#usage).
|
||||
|
||||
- [Pattern examples with expected matches](https://github.com/sindresorhus/multimatch/blob/master/test.js)
|
||||
- [Quick globbing pattern overview](https://github.com/sindresorhus/multimatch#globbing-patterns)
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
See the [`glob` options](https://github.com/isaacs/node-glob#options).
|
||||
|
||||
##### force
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `false`
|
||||
|
||||
Allow deleting the current working directory and outside.
|
||||
|
||||
##### dryRun
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `false`
|
||||
|
||||
See what would be deleted.
|
||||
|
||||
```js
|
||||
const del = require('del');
|
||||
|
||||
del(['tmp/*.js'], {dryRun: true}).then(paths => {
|
||||
console.log('Files and folders that would be deleted:\n', paths.join('\n'));
|
||||
});
|
||||
```
|
||||
|
||||
##### concurrency
|
||||
|
||||
Type: `number`<br>
|
||||
Default: `Infinity`<br>
|
||||
Minimum: `1`
|
||||
|
||||
Concurrency limit.
|
||||
|
||||
|
||||
## CLI
|
||||
|
||||
See [del-cli](https://github.com/sindresorhus/del-cli) for a CLI for this module and [trash-cli](https://github.com/sindresorhus/trash-cli) for a safe version that is suitable for running by hand.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [make-dir](https://github.com/sindresorhus/make-dir) - Make a directory and its parents if needed
|
||||
- [globby](https://github.com/sindresorhus/globby) - User-friendly glob matching
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
Reference in New Issue
Block a user