Add the github-linguist package
This commit only adds a single package and all of its transitive dependencies. The github-linguist package will be used for counting lines of code as a baseline for databases we are analyzing.
This commit is contained in:
parent
896b4ff181
commit
c4a84a93d4
152 changed files with 17057 additions and 24 deletions
1
node_modules/.bin/loc
generated
vendored
Symbolic link
1
node_modules/.bin/loc
generated
vendored
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../github-linguist/dist/cli.js
|
||||
62
node_modules/array-uniq/index.js
generated
vendored
Normal file
62
node_modules/array-uniq/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
'use strict';
|
||||
|
||||
// there's 3 implementations written in increasing order of efficiency
|
||||
|
||||
// 1 - no Set type is defined
|
||||
function uniqNoSet(arr) {
|
||||
var ret = [];
|
||||
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
if (ret.indexOf(arr[i]) === -1) {
|
||||
ret.push(arr[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// 2 - a simple Set type is defined
|
||||
function uniqSet(arr) {
|
||||
var seen = new Set();
|
||||
return arr.filter(function (el) {
|
||||
if (!seen.has(el)) {
|
||||
seen.add(el);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
// 3 - a standard Set type is defined and it has a forEach method
|
||||
function uniqSetWithForEach(arr) {
|
||||
var ret = [];
|
||||
|
||||
(new Set(arr)).forEach(function (el) {
|
||||
ret.push(el);
|
||||
});
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// V8 currently has a broken implementation
|
||||
// https://github.com/joyent/node/issues/8449
|
||||
function doesForEachActuallyWork() {
|
||||
var ret = false;
|
||||
|
||||
(new Set([true])).forEach(function (el) {
|
||||
ret = el;
|
||||
});
|
||||
|
||||
return ret === true;
|
||||
}
|
||||
|
||||
if ('Set' in global) {
|
||||
if (typeof Set.prototype.forEach === 'function' && doesForEachActuallyWork()) {
|
||||
module.exports = uniqSetWithForEach;
|
||||
} else {
|
||||
module.exports = uniqSet;
|
||||
}
|
||||
} else {
|
||||
module.exports = uniqNoSet;
|
||||
}
|
||||
21
node_modules/array-uniq/license
generated
vendored
Normal file
21
node_modules/array-uniq/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.
|
||||
37
node_modules/array-uniq/package.json
generated
vendored
Normal file
37
node_modules/array-uniq/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"name": "array-uniq",
|
||||
"version": "1.0.3",
|
||||
"description": "Create an array without duplicates",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/array-uniq",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"array",
|
||||
"arr",
|
||||
"set",
|
||||
"uniq",
|
||||
"unique",
|
||||
"es6",
|
||||
"duplicate",
|
||||
"remove"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"es6-set": "^0.1.0",
|
||||
"require-uncached": "^1.0.2",
|
||||
"xo": "*"
|
||||
}
|
||||
}
|
||||
30
node_modules/array-uniq/readme.md
generated
vendored
Normal file
30
node_modules/array-uniq/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# array-uniq [](https://travis-ci.org/sindresorhus/array-uniq)
|
||||
|
||||
> Create an array without duplicates
|
||||
|
||||
It's already pretty fast, but will be much faster when [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) becomes available in V8 (especially with large arrays).
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save array-uniq
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const arrayUniq = require('array-uniq');
|
||||
|
||||
arrayUniq([1, 1, 2, 3, 3]);
|
||||
//=> [1, 2, 3]
|
||||
|
||||
arrayUniq(['foo', 'foo', 'bar', 'foo']);
|
||||
//=> ['foo', 'bar']
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
796
node_modules/fs-extra/CHANGELOG.md
generated
vendored
Normal file
796
node_modules/fs-extra/CHANGELOG.md
generated
vendored
Normal file
|
|
@ -0,0 +1,796 @@
|
|||
4.0.3 / 2017-12-05
|
||||
------------------
|
||||
|
||||
- Fix wrong `chmod` values in `fs.remove()` [#501](https://github.com/jprichardson/node-fs-extra/pull/501)
|
||||
- Fix `TypeError` on systems that don't have some `fs` operations like `lchown` [#520](https://github.com/jprichardson/node-fs-extra/pull/520)
|
||||
|
||||
4.0.2 / 2017-09-12
|
||||
------------------
|
||||
|
||||
- Added `EOL` option to `writeJson*` & `outputJson*` (via upgrade to jsonfile v4)
|
||||
- Added promise support to [`fs.copyFile()`](https://nodejs.org/api/fs.html#fs_fs_copyfile_src_dest_flags_callback) in Node 8.5+
|
||||
- Added `.js` extension to `main` field in `package.json` for better tooling compatibility. [#485](https://github.com/jprichardson/node-fs-extra/pull/485)
|
||||
|
||||
4.0.1 / 2017-07-31
|
||||
------------------
|
||||
|
||||
### Fixed
|
||||
|
||||
- Previously, `ensureFile()` & `ensureFileSync()` would do nothing if the path was a directory. Now, they error out for consistency with `ensureDir()`. [#465](https://github.com/jprichardson/node-fs-extra/issues/465), [#466](https://github.com/jprichardson/node-fs-extra/pull/466), [#470](https://github.com/jprichardson/node-fs-extra/issues/470)
|
||||
|
||||
4.0.0 / 2017-07-14
|
||||
------------------
|
||||
|
||||
### Changed
|
||||
|
||||
- **BREAKING:** The promisified versions of `fs.read()` & `fs.write()` now return objects. See [the docs](docs/fs-read-write.md) for details. [#436](https://github.com/jprichardson/node-fs-extra/issues/436), [#449](https://github.com/jprichardson/node-fs-extra/pull/449)
|
||||
- `fs.move()` now errors out when destination is a subdirectory of source. [#458](https://github.com/jprichardson/node-fs-extra/pull/458)
|
||||
- Applied upstream fixes from `rimraf` to `fs.remove()` & `fs.removeSync()`. [#459](https://github.com/jprichardson/node-fs-extra/pull/459)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Got `fs.outputJSONSync()` working again; it was broken due to refactoring. [#428](https://github.com/jprichardson/node-fs-extra/pull/428)
|
||||
|
||||
Also clarified the docs in a few places.
|
||||
|
||||
3.0.1 / 2017-05-04
|
||||
------------------
|
||||
|
||||
- Fix bug in `move()` & `moveSync()` when source and destination are the same, and source does not exist. [#415](https://github.com/jprichardson/node-fs-extra/pull/415)
|
||||
|
||||
3.0.0 / 2017-04-27
|
||||
------------------
|
||||
|
||||
### Added
|
||||
|
||||
- **BREAKING:** Added Promise support. All asynchronous native fs methods and fs-extra methods now return a promise if the callback is not passed. [#403](https://github.com/jprichardson/node-fs-extra/pull/403)
|
||||
- `pathExists()`, a replacement for the deprecated `fs.exists`. `pathExists` has a normal error-first callback signature. Also added `pathExistsSync`, an alias to `fs.existsSync`, for completeness. [#406](https://github.com/jprichardson/node-fs-extra/pull/406)
|
||||
|
||||
### Removed
|
||||
|
||||
- **BREAKING:** Removed support for setting the default spaces for `writeJson()`, `writeJsonSync()`, `outputJson()`, & `outputJsonSync()`. This was undocumented. [#402](https://github.com/jprichardson/node-fs-extra/pull/402)
|
||||
|
||||
### Changed
|
||||
|
||||
- Upgraded jsonfile dependency to v3.0.0:
|
||||
- **BREAKING:** Changed behavior of `throws` option for `readJsonSync()`; now does not throw filesystem errors when `throws` is `false`.
|
||||
- **BREAKING:** `writeJson()`, `writeJsonSync()`, `outputJson()`, & `outputJsonSync()` now output minified JSON by default for consistency with `JSON.stringify()`; set the `spaces` option to `2` to override this new behavior. [#402](https://github.com/jprichardson/node-fs-extra/pull/402)
|
||||
- Use `Buffer.allocUnsafe()` instead of `new Buffer()` in environments that support it. [#394](https://github.com/jprichardson/node-fs-extra/pull/394)
|
||||
|
||||
### Fixed
|
||||
|
||||
- `removeSync()` silently failed on Windows in some cases. Now throws an `EBUSY` error. [#408](https://github.com/jprichardson/node-fs-extra/pull/408)
|
||||
|
||||
2.1.2 / 2017-03-16
|
||||
------------------
|
||||
|
||||
### Fixed
|
||||
|
||||
- Weird windows bug that resulted in `ensureDir()`'s callback being called twice in some cases. This bug may have also affected `remove()`. See [#392](https://github.com/jprichardson/node-fs-extra/issues/392), [#393](https://github.com/jprichardson/node-fs-extra/pull/393)
|
||||
|
||||
2.1.1 / 2017-03-15
|
||||
------------------
|
||||
|
||||
### Fixed
|
||||
|
||||
- Reverted [`5597bd`](https://github.com/jprichardson/node-fs-extra/commit/5597bd5b67f7d060f5f5bf26e9635be48330f5d7), this broke compatibility with Node.js versions v4+ but less than `v4.5.0`.
|
||||
- Remove `Buffer.alloc()` usage in `moveSync()`.
|
||||
|
||||
2.1.0 / 2017-03-15
|
||||
------------------
|
||||
|
||||
Thanks to [Mani Maghsoudlou (@manidlou)](https://github.com/manidlou) & [Jan Peer Stöcklmair (@JPeer264)](https://github.com/JPeer264) for their extraordinary help with this release!
|
||||
|
||||
### Added
|
||||
- `moveSync()` See [#309], [#381](https://github.com/jprichardson/node-fs-extra/pull/381). ([@manidlou](https://github.com/manidlou))
|
||||
- `copy()` and `copySync()`'s `filter` option now gets the destination path passed as the second parameter. [#366](https://github.com/jprichardson/node-fs-extra/pull/366) ([@manidlou](https://github.com/manidlou))
|
||||
|
||||
### Changed
|
||||
- Use `Buffer.alloc()` instead of deprecated `new Buffer()` in `copySync()`. [#380](https://github.com/jprichardson/node-fs-extra/pull/380) ([@manidlou](https://github.com/manidlou))
|
||||
- Refactored entire codebase to use ES6 features supported by Node.js v4+ [#355](https://github.com/jprichardson/node-fs-extra/issues/355). [(@JPeer264)](https://github.com/JPeer264)
|
||||
- Refactored docs. ([@manidlou](https://github.com/manidlou))
|
||||
|
||||
### Fixed
|
||||
|
||||
- `move()` shouldn't error out when source and dest are the same. [#377](https://github.com/jprichardson/node-fs-extra/issues/377), [#378](https://github.com/jprichardson/node-fs-extra/pull/378) ([@jdalton](https://github.com/jdalton))
|
||||
|
||||
2.0.0 / 2017-01-16
|
||||
------------------
|
||||
|
||||
### Removed
|
||||
- **BREAKING:** Removed support for Node `v0.12`. The Node foundation stopped officially supporting it
|
||||
on Jan 1st, 2017.
|
||||
- **BREAKING:** Remove `walk()` and `walkSync()`. `walkSync()` was only part of `fs-extra` for a little
|
||||
over two months. Use [klaw](https://github.com/jprichardson/node-klaw) instead of `walk()`, in fact, `walk()` was just
|
||||
an alias to klaw. For `walkSync()` use [klaw-sync](https://github.com/mawni/node-klaw-sync). See: [#338], [#339]
|
||||
|
||||
### Changed
|
||||
- **BREAKING:** Renamed `clobber` to `overwrite`. This affects `copy()`, `copySync()`, and `move()`. [#330], [#333]
|
||||
- Moved docs, to `docs/`. [#340]
|
||||
|
||||
### Fixed
|
||||
- Apply filters to directories in `copySync()` like in `copy()`. [#324]
|
||||
- A specific condition when disk is under heavy use, `copy()` can fail. [#326]
|
||||
|
||||
|
||||
1.0.0 / 2016-11-01
|
||||
------------------
|
||||
|
||||
After five years of development, we finally have reach the 1.0.0 milestone! Big thanks goes
|
||||
to [Ryan Zim](https://github.com/RyanZim) for leading the charge on this release!
|
||||
|
||||
### Added
|
||||
- `walkSync()`
|
||||
|
||||
### Changed
|
||||
- **BREAKING**: dropped Node v0.10 support.
|
||||
- disabled `rimaf` globbing, wasn't used. [#280]
|
||||
- deprecate `copy()/copySync()` option `filter` if it's a `RegExp`. `filter` should now be a function.
|
||||
- inline `rimraf`. This is temporary and was done because `rimraf` depended upon the beefy `glob` which `fs-extra` does not use. [#300]
|
||||
|
||||
### Fixed
|
||||
- bug fix proper closing of file handle on `utimesMillis()` [#271]
|
||||
- proper escaping of files with dollar signs [#291]
|
||||
- `copySync()` failed if user didn't own file. [#199], [#301]
|
||||
|
||||
|
||||
0.30.0 / 2016-04-28
|
||||
-------------------
|
||||
- Brought back Node v0.10 support. I didn't realize there was still demand. Official support will end **2016-10-01**.
|
||||
|
||||
0.29.0 / 2016-04-27
|
||||
-------------------
|
||||
- **BREAKING**: removed support for Node v0.10. If you still want to use Node v0.10, everything should work except for `ensureLink()/ensureSymlink()`. Node v0.12 is still supported but will be dropped in the near future as well.
|
||||
|
||||
0.28.0 / 2016-04-17
|
||||
-------------------
|
||||
- **BREAKING**: removed `createOutputStream()`. Use https://www.npmjs.com/package/create-output-stream. See: [#192][#192]
|
||||
- `mkdirs()/mkdirsSync()` check for invalid win32 path chars. See: [#209][#209], [#237][#237]
|
||||
- `mkdirs()/mkdirsSync()` if drive not mounted, error. See: [#93][#93]
|
||||
|
||||
0.27.0 / 2016-04-15
|
||||
-------------------
|
||||
- add `dereference` option to `copySync()`. [#235][#235]
|
||||
|
||||
0.26.7 / 2016-03-16
|
||||
-------------------
|
||||
- fixed `copy()` if source and dest are the same. [#230][#230]
|
||||
|
||||
0.26.6 / 2016-03-15
|
||||
-------------------
|
||||
- fixed if `emptyDir()` does not have a callback: [#229][#229]
|
||||
|
||||
0.26.5 / 2016-01-27
|
||||
-------------------
|
||||
- `copy()` with two arguments (w/o callback) was broken. See: [#215][#215]
|
||||
|
||||
0.26.4 / 2016-01-05
|
||||
-------------------
|
||||
- `copySync()` made `preserveTimestamps` default consistent with `copy()` which is `false`. See: [#208][#208]
|
||||
|
||||
0.26.3 / 2015-12-17
|
||||
-------------------
|
||||
- fixed `copy()` hangup in copying blockDevice / characterDevice / `/dev/null`. See: [#193][#193]
|
||||
|
||||
0.26.2 / 2015-11-02
|
||||
-------------------
|
||||
- fixed `outputJson{Sync}()` spacing adherence to `fs.spaces`
|
||||
|
||||
0.26.1 / 2015-11-02
|
||||
-------------------
|
||||
- fixed `copySync()` when `clogger=true` and the destination is read only. See: [#190][#190]
|
||||
|
||||
0.26.0 / 2015-10-25
|
||||
-------------------
|
||||
- extracted the `walk()` function into its own module [`klaw`](https://github.com/jprichardson/node-klaw).
|
||||
|
||||
0.25.0 / 2015-10-24
|
||||
-------------------
|
||||
- now has a file walker `walk()`
|
||||
|
||||
0.24.0 / 2015-08-28
|
||||
-------------------
|
||||
- removed alias `delete()` and `deleteSync()`. See: [#171][#171]
|
||||
|
||||
0.23.1 / 2015-08-07
|
||||
-------------------
|
||||
- Better handling of errors for `move()` when moving across devices. [#170][#170]
|
||||
- `ensureSymlink()` and `ensureLink()` should not throw errors if link exists. [#169][#169]
|
||||
|
||||
0.23.0 / 2015-08-06
|
||||
-------------------
|
||||
- added `ensureLink{Sync}()` and `ensureSymlink{Sync}()`. See: [#165][#165]
|
||||
|
||||
0.22.1 / 2015-07-09
|
||||
-------------------
|
||||
- Prevent calling `hasMillisResSync()` on module load. See: [#149][#149].
|
||||
Fixes regression that was introduced in `0.21.0`.
|
||||
|
||||
0.22.0 / 2015-07-09
|
||||
-------------------
|
||||
- preserve permissions / ownership in `copy()`. See: [#54][#54]
|
||||
|
||||
0.21.0 / 2015-07-04
|
||||
-------------------
|
||||
- add option to preserve timestamps in `copy()` and `copySync()`. See: [#141][#141]
|
||||
- updated `graceful-fs@3.x` to `4.x`. This brings in features from `amazing-graceful-fs` (much cleaner code / less hacks)
|
||||
|
||||
0.20.1 / 2015-06-23
|
||||
-------------------
|
||||
- fixed regression caused by latest jsonfile update: See: https://github.com/jprichardson/node-jsonfile/issues/26
|
||||
|
||||
0.20.0 / 2015-06-19
|
||||
-------------------
|
||||
- removed `jsonfile` aliases with `File` in the name, they weren't documented and probably weren't in use e.g.
|
||||
this package had both `fs.readJsonFile` and `fs.readJson` that were aliases to each other, now use `fs.readJson`.
|
||||
- preliminary walker created. Intentionally not documented. If you use it, it will almost certainly change and break your code.
|
||||
- started moving tests inline
|
||||
- upgraded to `jsonfile@2.1.0`, can now pass JSON revivers/replacers to `readJson()`, `writeJson()`, `outputJson()`
|
||||
|
||||
0.19.0 / 2015-06-08
|
||||
-------------------
|
||||
- `fs.copy()` had support for Node v0.8, dropped support
|
||||
|
||||
0.18.4 / 2015-05-22
|
||||
-------------------
|
||||
- fixed license field according to this: [#136][#136] and https://github.com/npm/npm/releases/tag/v2.10.0
|
||||
|
||||
0.18.3 / 2015-05-08
|
||||
-------------------
|
||||
- bugfix: handle `EEXIST` when clobbering on some Linux systems. [#134][#134]
|
||||
|
||||
0.18.2 / 2015-04-17
|
||||
-------------------
|
||||
- bugfix: allow `F_OK` ([#120][#120])
|
||||
|
||||
0.18.1 / 2015-04-15
|
||||
-------------------
|
||||
- improved windows support for `move()` a bit. https://github.com/jprichardson/node-fs-extra/commit/92838980f25dc2ee4ec46b43ee14d3c4a1d30c1b
|
||||
- fixed a lot of tests for Windows (appveyor)
|
||||
|
||||
0.18.0 / 2015-03-31
|
||||
-------------------
|
||||
- added `emptyDir()` and `emptyDirSync()`
|
||||
|
||||
0.17.0 / 2015-03-28
|
||||
-------------------
|
||||
- `copySync` added `clobber` option (before always would clobber, now if `clobber` is `false` it throws an error if the destination exists).
|
||||
**Only works with files at the moment.**
|
||||
- `createOutputStream()` added. See: [#118][#118]
|
||||
|
||||
0.16.5 / 2015-03-08
|
||||
-------------------
|
||||
- fixed `fs.move` when `clobber` is `true` and destination is a directory, it should clobber. [#114][#114]
|
||||
|
||||
0.16.4 / 2015-03-01
|
||||
-------------------
|
||||
- `fs.mkdirs` fix infinite loop on Windows. See: See https://github.com/substack/node-mkdirp/pull/74 and https://github.com/substack/node-mkdirp/issues/66
|
||||
|
||||
0.16.3 / 2015-01-28
|
||||
-------------------
|
||||
- reverted https://github.com/jprichardson/node-fs-extra/commit/1ee77c8a805eba5b99382a2591ff99667847c9c9
|
||||
|
||||
|
||||
0.16.2 / 2015-01-28
|
||||
-------------------
|
||||
- fixed `fs.copy` for Node v0.8 (support is temporary and will be removed in the near future)
|
||||
|
||||
0.16.1 / 2015-01-28
|
||||
-------------------
|
||||
- if `setImmediate` is not available, fall back to `process.nextTick`
|
||||
|
||||
0.16.0 / 2015-01-28
|
||||
-------------------
|
||||
- bugfix `fs.move()` into itself. Closes [#104]
|
||||
- bugfix `fs.move()` moving directory across device. Closes [#108]
|
||||
- added coveralls support
|
||||
- bugfix: nasty multiple callback `fs.copy()` bug. Closes [#98]
|
||||
- misc fs.copy code cleanups
|
||||
|
||||
0.15.0 / 2015-01-21
|
||||
-------------------
|
||||
- dropped `ncp`, imported code in
|
||||
- because of previous, now supports `io.js`
|
||||
- `graceful-fs` is now a dependency
|
||||
|
||||
0.14.0 / 2015-01-05
|
||||
-------------------
|
||||
- changed `copy`/`copySync` from `fs.copy(src, dest, [filters], callback)` to `fs.copy(src, dest, [options], callback)` [#100][#100]
|
||||
- removed mockfs tests for mkdirp (this may be temporary, but was getting in the way of other tests)
|
||||
|
||||
0.13.0 / 2014-12-10
|
||||
-------------------
|
||||
- removed `touch` and `touchSync` methods (they didn't handle permissions like UNIX touch)
|
||||
- updated `"ncp": "^0.6.0"` to `"ncp": "^1.0.1"`
|
||||
- imported `mkdirp` => `minimist` and `mkdirp` are no longer dependences, should now appease people who wanted `mkdirp` to be `--use_strict` safe. See [#59]([#59][#59])
|
||||
|
||||
0.12.0 / 2014-09-22
|
||||
-------------------
|
||||
- copy symlinks in `copySync()` [#85][#85]
|
||||
|
||||
0.11.1 / 2014-09-02
|
||||
-------------------
|
||||
- bugfix `copySync()` preserve file permissions [#80][#80]
|
||||
|
||||
0.11.0 / 2014-08-11
|
||||
-------------------
|
||||
- upgraded `"ncp": "^0.5.1"` to `"ncp": "^0.6.0"`
|
||||
- upgrade `jsonfile": "^1.2.0"` to `jsonfile": "^2.0.0"` => on write, json files now have `\n` at end. Also adds `options.throws` to `readJsonSync()`
|
||||
see https://github.com/jprichardson/node-jsonfile#readfilesyncfilename-options for more details.
|
||||
|
||||
0.10.0 / 2014-06-29
|
||||
------------------
|
||||
* bugfix: upgaded `"jsonfile": "~1.1.0"` to `"jsonfile": "^1.2.0"`, bumped minor because of `jsonfile` dep change
|
||||
from `~` to `^`. [#67]
|
||||
|
||||
0.9.1 / 2014-05-22
|
||||
------------------
|
||||
* removed Node.js `0.8.x` support, `0.9.0` was published moments ago and should have been done there
|
||||
|
||||
0.9.0 / 2014-05-22
|
||||
------------------
|
||||
* upgraded `ncp` from `~0.4.2` to `^0.5.1`, [#58]
|
||||
* upgraded `rimraf` from `~2.2.6` to `^2.2.8`
|
||||
* upgraded `mkdirp` from `0.3.x` to `^0.5.0`
|
||||
* added methods `ensureFile()`, `ensureFileSync()`
|
||||
* added methods `ensureDir()`, `ensureDirSync()` [#31]
|
||||
* added `move()` method. From: https://github.com/andrewrk/node-mv
|
||||
|
||||
|
||||
0.8.1 / 2013-10-24
|
||||
------------------
|
||||
* copy failed to return an error to the callback if a file doesn't exist (ulikoehler [#38], [#39])
|
||||
|
||||
0.8.0 / 2013-10-14
|
||||
------------------
|
||||
* `filter` implemented on `copy()` and `copySync()`. (Srirangan / [#36])
|
||||
|
||||
0.7.1 / 2013-10-12
|
||||
------------------
|
||||
* `copySync()` implemented (Srirangan / [#33])
|
||||
* updated to the latest `jsonfile` version `1.1.0` which gives `options` params for the JSON methods. Closes [#32]
|
||||
|
||||
0.7.0 / 2013-10-07
|
||||
------------------
|
||||
* update readme conventions
|
||||
* `copy()` now works if destination directory does not exist. Closes [#29]
|
||||
|
||||
0.6.4 / 2013-09-05
|
||||
------------------
|
||||
* changed `homepage` field in package.json to remove NPM warning
|
||||
|
||||
0.6.3 / 2013-06-28
|
||||
------------------
|
||||
* changed JSON spacing default from `4` to `2` to follow Node conventions
|
||||
* updated `jsonfile` dep
|
||||
* updated `rimraf` dep
|
||||
|
||||
0.6.2 / 2013-06-28
|
||||
------------------
|
||||
* added .npmignore, [#25]
|
||||
|
||||
0.6.1 / 2013-05-14
|
||||
------------------
|
||||
* modified for `strict` mode, closes [#24]
|
||||
* added `outputJson()/outputJsonSync()`, closes [#23]
|
||||
|
||||
0.6.0 / 2013-03-18
|
||||
------------------
|
||||
* removed node 0.6 support
|
||||
* added node 0.10 support
|
||||
* upgraded to latest `ncp` and `rimraf`.
|
||||
* optional `graceful-fs` support. Closes [#17]
|
||||
|
||||
|
||||
0.5.0 / 2013-02-03
|
||||
------------------
|
||||
* Removed `readTextFile`.
|
||||
* Renamed `readJSONFile` to `readJSON` and `readJson`, same with write.
|
||||
* Restructured documentation a bit. Added roadmap.
|
||||
|
||||
0.4.0 / 2013-01-28
|
||||
------------------
|
||||
* Set default spaces in `jsonfile` from 4 to 2.
|
||||
* Updated `testutil` deps for tests.
|
||||
* Renamed `touch()` to `createFile()`
|
||||
* Added `outputFile()` and `outputFileSync()`
|
||||
* Changed creation of testing diretories so the /tmp dir is not littered.
|
||||
* Added `readTextFile()` and `readTextFileSync()`.
|
||||
|
||||
0.3.2 / 2012-11-01
|
||||
------------------
|
||||
* Added `touch()` and `touchSync()` methods.
|
||||
|
||||
0.3.1 / 2012-10-11
|
||||
------------------
|
||||
* Fixed some stray globals.
|
||||
|
||||
0.3.0 / 2012-10-09
|
||||
------------------
|
||||
* Removed all CoffeeScript from tests.
|
||||
* Renamed `mkdir` to `mkdirs`/`mkdirp`.
|
||||
|
||||
0.2.1 / 2012-09-11
|
||||
------------------
|
||||
* Updated `rimraf` dep.
|
||||
|
||||
0.2.0 / 2012-09-10
|
||||
------------------
|
||||
* Rewrote module into JavaScript. (Must still rewrite tests into JavaScript)
|
||||
* Added all methods of [jsonfile](https://github.com/jprichardson/node-jsonfile)
|
||||
* Added Travis-CI.
|
||||
|
||||
0.1.3 / 2012-08-13
|
||||
------------------
|
||||
* Added method `readJSONFile`.
|
||||
|
||||
0.1.2 / 2012-06-15
|
||||
------------------
|
||||
* Bug fix: `deleteSync()` didn't exist.
|
||||
* Verified Node v0.8 compatibility.
|
||||
|
||||
0.1.1 / 2012-06-15
|
||||
------------------
|
||||
* Fixed bug in `remove()`/`delete()` that wouldn't execute the function if a callback wasn't passed.
|
||||
|
||||
0.1.0 / 2012-05-31
|
||||
------------------
|
||||
* Renamed `copyFile()` to `copy()`. `copy()` can now copy directories (recursively) too.
|
||||
* Renamed `rmrf()` to `remove()`.
|
||||
* `remove()` aliased with `delete()`.
|
||||
* Added `mkdirp` capabilities. Named: `mkdir()`. Hides Node.js native `mkdir()`.
|
||||
* Instead of exporting the native `fs` module with new functions, I now copy over the native methods to a new object and export that instead.
|
||||
|
||||
0.0.4 / 2012-03-14
|
||||
------------------
|
||||
* Removed CoffeeScript dependency
|
||||
|
||||
0.0.3 / 2012-01-11
|
||||
------------------
|
||||
* Added methods rmrf and rmrfSync
|
||||
* Moved tests from Jasmine to Mocha
|
||||
|
||||
|
||||
[#344]: https://github.com/jprichardson/node-fs-extra/issues/344 "Licence Year"
|
||||
[#343]: https://github.com/jprichardson/node-fs-extra/pull/343 "Add klaw-sync link to readme"
|
||||
[#342]: https://github.com/jprichardson/node-fs-extra/pull/342 "allow preserveTimestamps when use move"
|
||||
[#341]: https://github.com/jprichardson/node-fs-extra/issues/341 "mkdirp(path.dirname(dest) in move() logic needs cleaning up [question]"
|
||||
[#340]: https://github.com/jprichardson/node-fs-extra/pull/340 "Move docs to seperate docs folder [documentation]"
|
||||
[#339]: https://github.com/jprichardson/node-fs-extra/pull/339 "Remove walk() & walkSync() [feature-walk]"
|
||||
[#338]: https://github.com/jprichardson/node-fs-extra/issues/338 "Remove walk() and walkSync() [feature-walk]"
|
||||
[#337]: https://github.com/jprichardson/node-fs-extra/issues/337 "copy doesn't return a yieldable value"
|
||||
[#336]: https://github.com/jprichardson/node-fs-extra/pull/336 "Docs enhanced walk sync [documentation, feature-walk]"
|
||||
[#335]: https://github.com/jprichardson/node-fs-extra/pull/335 "Refactor move() tests [feature-move]"
|
||||
[#334]: https://github.com/jprichardson/node-fs-extra/pull/334 "Cleanup lib/move/index.js [feature-move]"
|
||||
[#333]: https://github.com/jprichardson/node-fs-extra/pull/333 "Rename clobber to overwrite [feature-copy, feature-move]"
|
||||
[#332]: https://github.com/jprichardson/node-fs-extra/pull/332 "BREAKING: Drop Node v0.12 & io.js support"
|
||||
[#331]: https://github.com/jprichardson/node-fs-extra/issues/331 "Add support for chmodr [enhancement, future]"
|
||||
[#330]: https://github.com/jprichardson/node-fs-extra/pull/330 "BREAKING: Do not error when copy destination exists & clobber: false [feature-copy]"
|
||||
[#329]: https://github.com/jprichardson/node-fs-extra/issues/329 "Does .walk() scale to large directories? [question]"
|
||||
[#328]: https://github.com/jprichardson/node-fs-extra/issues/328 "Copying files corrupts [feature-copy, needs-confirmed]"
|
||||
[#327]: https://github.com/jprichardson/node-fs-extra/pull/327 "Use writeStream 'finish' event instead of 'close' [bug, feature-copy]"
|
||||
[#326]: https://github.com/jprichardson/node-fs-extra/issues/326 "fs.copy fails with chmod error when disk under heavy use [bug, feature-copy]"
|
||||
[#325]: https://github.com/jprichardson/node-fs-extra/issues/325 "ensureDir is difficult to promisify [enhancement]"
|
||||
[#324]: https://github.com/jprichardson/node-fs-extra/pull/324 "copySync() should apply filter to directories like copy() [bug, feature-copy]"
|
||||
[#323]: https://github.com/jprichardson/node-fs-extra/issues/323 "Support for `dest` being a directory when using `copy*()`?"
|
||||
[#322]: https://github.com/jprichardson/node-fs-extra/pull/322 "Add fs-promise as fs-extra-promise alternative"
|
||||
[#321]: https://github.com/jprichardson/node-fs-extra/issues/321 "fs.copy() with clobber set to false return EEXIST error [feature-copy]"
|
||||
[#320]: https://github.com/jprichardson/node-fs-extra/issues/320 "fs.copySync: Error: EPERM: operation not permitted, unlink "
|
||||
[#319]: https://github.com/jprichardson/node-fs-extra/issues/319 "Create directory if not exists"
|
||||
[#318]: https://github.com/jprichardson/node-fs-extra/issues/318 "Support glob patterns [enhancement, future]"
|
||||
[#317]: https://github.com/jprichardson/node-fs-extra/pull/317 "Adding copy sync test for src file without write perms"
|
||||
[#316]: https://github.com/jprichardson/node-fs-extra/pull/316 "Remove move()'s broken limit option [feature-move]"
|
||||
[#315]: https://github.com/jprichardson/node-fs-extra/pull/315 "Fix move clobber tests to work around graceful-fs bug."
|
||||
[#314]: https://github.com/jprichardson/node-fs-extra/issues/314 "move() limit option [documentation, enhancement, feature-move]"
|
||||
[#313]: https://github.com/jprichardson/node-fs-extra/pull/313 "Test that remove() ignores glob characters."
|
||||
[#312]: https://github.com/jprichardson/node-fs-extra/pull/312 "Enhance walkSync() to return items with path and stats [feature-walk]"
|
||||
[#311]: https://github.com/jprichardson/node-fs-extra/issues/311 "move() not work when dest name not provided [feature-move]"
|
||||
[#310]: https://github.com/jprichardson/node-fs-extra/issues/310 "Edit walkSync to return items like what walk emits [documentation, enhancement, feature-walk]"
|
||||
[#309]: https://github.com/jprichardson/node-fs-extra/issues/309 "moveSync support [enhancement, feature-move]"
|
||||
[#308]: https://github.com/jprichardson/node-fs-extra/pull/308 "Fix incorrect anchor link"
|
||||
[#307]: https://github.com/jprichardson/node-fs-extra/pull/307 "Fix coverage"
|
||||
[#306]: https://github.com/jprichardson/node-fs-extra/pull/306 "Update devDeps, fix lint error"
|
||||
[#305]: https://github.com/jprichardson/node-fs-extra/pull/305 "Re-add Coveralls"
|
||||
[#304]: https://github.com/jprichardson/node-fs-extra/pull/304 "Remove path-is-absolute [enhancement]"
|
||||
[#303]: https://github.com/jprichardson/node-fs-extra/pull/303 "Document copySync filter inconsistency [documentation, feature-copy]"
|
||||
[#302]: https://github.com/jprichardson/node-fs-extra/pull/302 "fix(console): depreciated -> deprecated"
|
||||
[#301]: https://github.com/jprichardson/node-fs-extra/pull/301 "Remove chmod call from copySync [feature-copy]"
|
||||
[#300]: https://github.com/jprichardson/node-fs-extra/pull/300 "Inline Rimraf [enhancement, feature-move, feature-remove]"
|
||||
[#299]: https://github.com/jprichardson/node-fs-extra/pull/299 "Warn when filter is a RegExp [feature-copy]"
|
||||
[#298]: https://github.com/jprichardson/node-fs-extra/issues/298 "API Docs [documentation]"
|
||||
[#297]: https://github.com/jprichardson/node-fs-extra/pull/297 "Warn about using preserveTimestamps on 32-bit node"
|
||||
[#296]: https://github.com/jprichardson/node-fs-extra/pull/296 "Improve EEXIST error message for copySync [enhancement]"
|
||||
[#295]: https://github.com/jprichardson/node-fs-extra/pull/295 "Depreciate using regular expressions for copy's filter option [documentation]"
|
||||
[#294]: https://github.com/jprichardson/node-fs-extra/pull/294 "BREAKING: Refactor lib/copy/ncp.js [feature-copy]"
|
||||
[#293]: https://github.com/jprichardson/node-fs-extra/pull/293 "Update CI configs"
|
||||
[#292]: https://github.com/jprichardson/node-fs-extra/issues/292 "Rewrite lib/copy/ncp.js [enhancement, feature-copy]"
|
||||
[#291]: https://github.com/jprichardson/node-fs-extra/pull/291 "Escape '$' in replacement string for async file copying"
|
||||
[#290]: https://github.com/jprichardson/node-fs-extra/issues/290 "Exclude files pattern while copying using copy.config.js [question]"
|
||||
[#289]: https://github.com/jprichardson/node-fs-extra/pull/289 "(Closes #271) lib/util/utimes: properly close file descriptors in the event of an error"
|
||||
[#288]: https://github.com/jprichardson/node-fs-extra/pull/288 "(Closes #271) lib/util/utimes: properly close file descriptors in the event of an error"
|
||||
[#287]: https://github.com/jprichardson/node-fs-extra/issues/287 "emptyDir() callback arguments are inconsistent [enhancement, feature-remove]"
|
||||
[#286]: https://github.com/jprichardson/node-fs-extra/pull/286 "Added walkSync function"
|
||||
[#285]: https://github.com/jprichardson/node-fs-extra/issues/285 "CITGM test failing on s390"
|
||||
[#284]: https://github.com/jprichardson/node-fs-extra/issues/284 "outputFile method is missing a check to determine if existing item is a folder or not"
|
||||
[#283]: https://github.com/jprichardson/node-fs-extra/pull/283 "Apply filter also on directories and symlinks for copySync()"
|
||||
[#282]: https://github.com/jprichardson/node-fs-extra/pull/282 "Apply filter also on directories and symlinks for copySync()"
|
||||
[#281]: https://github.com/jprichardson/node-fs-extra/issues/281 "remove function executes 'successfully' but doesn't do anything?"
|
||||
[#280]: https://github.com/jprichardson/node-fs-extra/pull/280 "Disable rimraf globbing"
|
||||
[#279]: https://github.com/jprichardson/node-fs-extra/issues/279 "Some code is vendored instead of included [awaiting-reply]"
|
||||
[#278]: https://github.com/jprichardson/node-fs-extra/issues/278 "copy() does not preserve file/directory ownership"
|
||||
[#277]: https://github.com/jprichardson/node-fs-extra/pull/277 "Mention defaults for clobber and dereference options"
|
||||
[#276]: https://github.com/jprichardson/node-fs-extra/issues/276 "Cannot connect to Shared Folder [awaiting-reply]"
|
||||
[#275]: https://github.com/jprichardson/node-fs-extra/issues/275 "EMFILE, too many open files on Mac OS with JSON API"
|
||||
[#274]: https://github.com/jprichardson/node-fs-extra/issues/274 "Use with memory-fs? [enhancement, future]"
|
||||
[#273]: https://github.com/jprichardson/node-fs-extra/pull/273 "tests: rename `remote.test.js` to `remove.test.js`"
|
||||
[#272]: https://github.com/jprichardson/node-fs-extra/issues/272 "Copy clobber flag never err even when true [bug, feature-copy]"
|
||||
[#271]: https://github.com/jprichardson/node-fs-extra/issues/271 "Unclosed file handle on futimes error"
|
||||
[#270]: https://github.com/jprichardson/node-fs-extra/issues/270 "copy not working as desired on Windows [feature-copy, platform-windows]"
|
||||
[#269]: https://github.com/jprichardson/node-fs-extra/issues/269 "Copying with preserveTimeStamps: true is inaccurate using 32bit node [feature-copy]"
|
||||
[#268]: https://github.com/jprichardson/node-fs-extra/pull/268 "port fix for mkdirp issue #111"
|
||||
[#267]: https://github.com/jprichardson/node-fs-extra/issues/267 "WARN deprecated wrench@1.5.9: wrench.js is deprecated!"
|
||||
[#266]: https://github.com/jprichardson/node-fs-extra/issues/266 "fs-extra"
|
||||
[#265]: https://github.com/jprichardson/node-fs-extra/issues/265 "Link the `fs.stat fs.exists` etc. methods for replace the `fs` module forever?"
|
||||
[#264]: https://github.com/jprichardson/node-fs-extra/issues/264 "Renaming a file using move fails when a file inside is open (at least on windows) [wont-fix]"
|
||||
[#263]: https://github.com/jprichardson/node-fs-extra/issues/263 "ENOSYS: function not implemented, link [needs-confirmed]"
|
||||
[#262]: https://github.com/jprichardson/node-fs-extra/issues/262 "Add .exists() and .existsSync()"
|
||||
[#261]: https://github.com/jprichardson/node-fs-extra/issues/261 "Cannot read property 'prototype' of undefined"
|
||||
[#260]: https://github.com/jprichardson/node-fs-extra/pull/260 "use more specific path for method require"
|
||||
[#259]: https://github.com/jprichardson/node-fs-extra/issues/259 "Feature Request: isEmpty"
|
||||
[#258]: https://github.com/jprichardson/node-fs-extra/issues/258 "copy files does not preserve file timestamp"
|
||||
[#257]: https://github.com/jprichardson/node-fs-extra/issues/257 "Copying a file on windows fails"
|
||||
[#256]: https://github.com/jprichardson/node-fs-extra/pull/256 "Updated Readme "
|
||||
[#255]: https://github.com/jprichardson/node-fs-extra/issues/255 "Update rimraf required version"
|
||||
[#254]: https://github.com/jprichardson/node-fs-extra/issues/254 "request for readTree, readTreeSync, walkSync method"
|
||||
[#253]: https://github.com/jprichardson/node-fs-extra/issues/253 "outputFile does not touch mtime when file exists"
|
||||
[#252]: https://github.com/jprichardson/node-fs-extra/pull/252 "Fixing problem when copying file with no write permission"
|
||||
[#251]: https://github.com/jprichardson/node-fs-extra/issues/251 "Just wanted to say thank you"
|
||||
[#250]: https://github.com/jprichardson/node-fs-extra/issues/250 "`fs.remove()` not removing files (works with `rm -rf`)"
|
||||
[#249]: https://github.com/jprichardson/node-fs-extra/issues/249 "Just a Question ... Remove Servers"
|
||||
[#248]: https://github.com/jprichardson/node-fs-extra/issues/248 "Allow option to not preserve permissions for copy"
|
||||
[#247]: https://github.com/jprichardson/node-fs-extra/issues/247 "Add TypeScript typing directly in the fs-extra package"
|
||||
[#246]: https://github.com/jprichardson/node-fs-extra/issues/246 "fse.remove() && fse.removeSync() don't throw error on ENOENT file"
|
||||
[#245]: https://github.com/jprichardson/node-fs-extra/issues/245 "filter for empty dir [enhancement]"
|
||||
[#244]: https://github.com/jprichardson/node-fs-extra/issues/244 "copySync doesn't apply the filter to directories"
|
||||
[#243]: https://github.com/jprichardson/node-fs-extra/issues/243 "Can I request fs.walk() to be synchronous?"
|
||||
[#242]: https://github.com/jprichardson/node-fs-extra/issues/242 "Accidentally truncates file names ending with $$ [bug, feature-copy]"
|
||||
[#241]: https://github.com/jprichardson/node-fs-extra/pull/241 "Remove link to createOutputStream"
|
||||
[#240]: https://github.com/jprichardson/node-fs-extra/issues/240 "walkSync request"
|
||||
[#239]: https://github.com/jprichardson/node-fs-extra/issues/239 "Depreciate regular expressions for copy's filter [documentation, feature-copy]"
|
||||
[#238]: https://github.com/jprichardson/node-fs-extra/issues/238 "Can't write to files while in a worker thread."
|
||||
[#237]: https://github.com/jprichardson/node-fs-extra/issues/237 ".ensureDir(..) fails silently when passed an invalid path..."
|
||||
[#236]: https://github.com/jprichardson/node-fs-extra/issues/236 "[Removed] Filed under wrong repo"
|
||||
[#235]: https://github.com/jprichardson/node-fs-extra/pull/235 "Adds symlink dereference option to `fse.copySync` (#191)"
|
||||
[#234]: https://github.com/jprichardson/node-fs-extra/issues/234 "ensureDirSync fails silent when EACCES: permission denied on travis-ci"
|
||||
[#233]: https://github.com/jprichardson/node-fs-extra/issues/233 "please make sure the first argument in callback is error object [feature-copy]"
|
||||
[#232]: https://github.com/jprichardson/node-fs-extra/issues/232 "Copy a folder content to its child folder. "
|
||||
[#231]: https://github.com/jprichardson/node-fs-extra/issues/231 "Adding read/write/output functions for YAML"
|
||||
[#230]: https://github.com/jprichardson/node-fs-extra/pull/230 "throw error if src and dest are the same to avoid zeroing out + test"
|
||||
[#229]: https://github.com/jprichardson/node-fs-extra/pull/229 "fix 'TypeError: callback is not a function' in emptyDir"
|
||||
[#228]: https://github.com/jprichardson/node-fs-extra/pull/228 "Throw error when target is empty so file is not accidentally zeroed out"
|
||||
[#227]: https://github.com/jprichardson/node-fs-extra/issues/227 "Uncatchable errors when there are invalid arguments [feature-move]"
|
||||
[#226]: https://github.com/jprichardson/node-fs-extra/issues/226 "Moving to the current directory"
|
||||
[#225]: https://github.com/jprichardson/node-fs-extra/issues/225 "EBUSY: resource busy or locked, unlink"
|
||||
[#224]: https://github.com/jprichardson/node-fs-extra/issues/224 "fse.copy ENOENT error"
|
||||
[#223]: https://github.com/jprichardson/node-fs-extra/issues/223 "Suspicious behavior of fs.existsSync"
|
||||
[#222]: https://github.com/jprichardson/node-fs-extra/pull/222 "A clearer description of emtpyDir function"
|
||||
[#221]: https://github.com/jprichardson/node-fs-extra/pull/221 "Update README.md"
|
||||
[#220]: https://github.com/jprichardson/node-fs-extra/pull/220 "Non-breaking feature: add option 'passStats' to copy methods."
|
||||
[#219]: https://github.com/jprichardson/node-fs-extra/pull/219 "Add closing parenthesis in copySync example"
|
||||
[#218]: https://github.com/jprichardson/node-fs-extra/pull/218 "fix #187 #70 options.filter bug"
|
||||
[#217]: https://github.com/jprichardson/node-fs-extra/pull/217 "fix #187 #70 options.filter bug"
|
||||
[#216]: https://github.com/jprichardson/node-fs-extra/pull/216 "fix #187 #70 options.filter bug"
|
||||
[#215]: https://github.com/jprichardson/node-fs-extra/pull/215 "fse.copy throws error when only src and dest provided [bug, documentation, feature-copy]"
|
||||
[#214]: https://github.com/jprichardson/node-fs-extra/pull/214 "Fixing copySync anchor tag"
|
||||
[#213]: https://github.com/jprichardson/node-fs-extra/issues/213 "Merge extfs with this repo"
|
||||
[#212]: https://github.com/jprichardson/node-fs-extra/pull/212 "Update year to 2016 in README.md and LICENSE"
|
||||
[#211]: https://github.com/jprichardson/node-fs-extra/issues/211 "Not copying all files"
|
||||
[#210]: https://github.com/jprichardson/node-fs-extra/issues/210 "copy/copySync behave differently when copying a symbolic file [bug, documentation, feature-copy]"
|
||||
[#209]: https://github.com/jprichardson/node-fs-extra/issues/209 "In Windows invalid directory name causes infinite loop in ensureDir(). [bug]"
|
||||
[#208]: https://github.com/jprichardson/node-fs-extra/pull/208 "fix options.preserveTimestamps to false in copy-sync by default [feature-copy]"
|
||||
[#207]: https://github.com/jprichardson/node-fs-extra/issues/207 "Add `compare` suite of functions"
|
||||
[#206]: https://github.com/jprichardson/node-fs-extra/issues/206 "outputFileSync"
|
||||
[#205]: https://github.com/jprichardson/node-fs-extra/issues/205 "fix documents about copy/copySync [documentation, feature-copy]"
|
||||
[#204]: https://github.com/jprichardson/node-fs-extra/pull/204 "allow copy of block and character device files"
|
||||
[#203]: https://github.com/jprichardson/node-fs-extra/issues/203 "copy method's argument options couldn't be undefined [bug, feature-copy]"
|
||||
[#202]: https://github.com/jprichardson/node-fs-extra/issues/202 "why there is not a walkSync method?"
|
||||
[#201]: https://github.com/jprichardson/node-fs-extra/issues/201 "clobber for directories [feature-copy, future]"
|
||||
[#200]: https://github.com/jprichardson/node-fs-extra/issues/200 "'copySync' doesn't work in sync"
|
||||
[#199]: https://github.com/jprichardson/node-fs-extra/issues/199 "fs.copySync fails if user does not own file [bug, feature-copy]"
|
||||
[#198]: https://github.com/jprichardson/node-fs-extra/issues/198 "handle copying between identical files [feature-copy]"
|
||||
[#197]: https://github.com/jprichardson/node-fs-extra/issues/197 "Missing documentation for `outputFile` `options` 3rd parameter [documentation]"
|
||||
[#196]: https://github.com/jprichardson/node-fs-extra/issues/196 "copy filter: async function and/or function called with `fs.stat` result [future]"
|
||||
[#195]: https://github.com/jprichardson/node-fs-extra/issues/195 "How to override with outputFile?"
|
||||
[#194]: https://github.com/jprichardson/node-fs-extra/pull/194 "allow ensureFile(Sync) to provide data to be written to created file"
|
||||
[#193]: https://github.com/jprichardson/node-fs-extra/issues/193 "`fs.copy` fails silently if source file is /dev/null [bug, feature-copy]"
|
||||
[#192]: https://github.com/jprichardson/node-fs-extra/issues/192 "Remove fs.createOutputStream()"
|
||||
[#191]: https://github.com/jprichardson/node-fs-extra/issues/191 "How to copy symlinks to target as normal folders [feature-copy]"
|
||||
[#190]: https://github.com/jprichardson/node-fs-extra/pull/190 "copySync to overwrite destination file if readonly and clobber true"
|
||||
[#189]: https://github.com/jprichardson/node-fs-extra/pull/189 "move.test fix to support CRLF on Windows"
|
||||
[#188]: https://github.com/jprichardson/node-fs-extra/issues/188 "move.test failing on windows platform"
|
||||
[#187]: https://github.com/jprichardson/node-fs-extra/issues/187 "Not filter each file, stops on first false [feature-copy]"
|
||||
[#186]: https://github.com/jprichardson/node-fs-extra/issues/186 "Do you need a .size() function in this module? [future]"
|
||||
[#185]: https://github.com/jprichardson/node-fs-extra/issues/185 "Doesn't work on NodeJS v4.x"
|
||||
[#184]: https://github.com/jprichardson/node-fs-extra/issues/184 "CLI equivalent for fs-extra"
|
||||
[#183]: https://github.com/jprichardson/node-fs-extra/issues/183 "with clobber true, copy and copySync behave differently if destination file is read only [bug, feature-copy]"
|
||||
[#182]: https://github.com/jprichardson/node-fs-extra/issues/182 "ensureDir(dir, callback) second callback parameter not specified"
|
||||
[#181]: https://github.com/jprichardson/node-fs-extra/issues/181 "Add ability to remove file securely [enhancement, wont-fix]"
|
||||
[#180]: https://github.com/jprichardson/node-fs-extra/issues/180 "Filter option doesn't work the same way in copy and copySync [bug, feature-copy]"
|
||||
[#179]: https://github.com/jprichardson/node-fs-extra/issues/179 "Include opendir"
|
||||
[#178]: https://github.com/jprichardson/node-fs-extra/issues/178 "ENOTEMPTY is thrown on removeSync "
|
||||
[#177]: https://github.com/jprichardson/node-fs-extra/issues/177 "fix `remove()` wildcards (introduced by rimraf) [feature-remove]"
|
||||
[#176]: https://github.com/jprichardson/node-fs-extra/issues/176 "createOutputStream doesn't emit 'end' event"
|
||||
[#175]: https://github.com/jprichardson/node-fs-extra/issues/175 "[Feature Request].moveSync support [feature-move, future]"
|
||||
[#174]: https://github.com/jprichardson/node-fs-extra/pull/174 "Fix copy formatting and document options.filter"
|
||||
[#173]: https://github.com/jprichardson/node-fs-extra/issues/173 "Feature Request: writeJson should mkdirs"
|
||||
[#172]: https://github.com/jprichardson/node-fs-extra/issues/172 "rename `clobber` flags to `overwrite`"
|
||||
[#171]: https://github.com/jprichardson/node-fs-extra/issues/171 "remove unnecessary aliases"
|
||||
[#170]: https://github.com/jprichardson/node-fs-extra/pull/170 "More robust handling of errors moving across virtual drives"
|
||||
[#169]: https://github.com/jprichardson/node-fs-extra/pull/169 "suppress ensureLink & ensureSymlink dest exists error"
|
||||
[#168]: https://github.com/jprichardson/node-fs-extra/pull/168 "suppress ensurelink dest exists error"
|
||||
[#167]: https://github.com/jprichardson/node-fs-extra/pull/167 "Adds basic (string, buffer) support for ensureFile content [future]"
|
||||
[#166]: https://github.com/jprichardson/node-fs-extra/pull/166 "Adds basic (string, buffer) support for ensureFile content"
|
||||
[#165]: https://github.com/jprichardson/node-fs-extra/pull/165 "ensure for link & symlink"
|
||||
[#164]: https://github.com/jprichardson/node-fs-extra/issues/164 "Feature Request: ensureFile to take optional argument for file content"
|
||||
[#163]: https://github.com/jprichardson/node-fs-extra/issues/163 "ouputJson not formatted out of the box [bug]"
|
||||
[#162]: https://github.com/jprichardson/node-fs-extra/pull/162 "ensure symlink & link"
|
||||
[#161]: https://github.com/jprichardson/node-fs-extra/pull/161 "ensure symlink & link"
|
||||
[#160]: https://github.com/jprichardson/node-fs-extra/pull/160 "ensure symlink & link"
|
||||
[#159]: https://github.com/jprichardson/node-fs-extra/pull/159 "ensure symlink & link"
|
||||
[#158]: https://github.com/jprichardson/node-fs-extra/issues/158 "Feature Request: ensureLink and ensureSymlink methods"
|
||||
[#157]: https://github.com/jprichardson/node-fs-extra/issues/157 "writeJson isn't formatted"
|
||||
[#156]: https://github.com/jprichardson/node-fs-extra/issues/156 "Promise.promisifyAll doesn't work for some methods"
|
||||
[#155]: https://github.com/jprichardson/node-fs-extra/issues/155 "Readme"
|
||||
[#154]: https://github.com/jprichardson/node-fs-extra/issues/154 "/tmp/millis-test-sync"
|
||||
[#153]: https://github.com/jprichardson/node-fs-extra/pull/153 "Make preserveTimes also work on read-only files. Closes #152"
|
||||
[#152]: https://github.com/jprichardson/node-fs-extra/issues/152 "fs.copy fails for read-only files with preserveTimestamp=true [feature-copy]"
|
||||
[#151]: https://github.com/jprichardson/node-fs-extra/issues/151 "TOC does not work correctly on npm [documentation]"
|
||||
[#150]: https://github.com/jprichardson/node-fs-extra/issues/150 "Remove test file fixtures, create with code."
|
||||
[#149]: https://github.com/jprichardson/node-fs-extra/issues/149 "/tmp/millis-test-sync"
|
||||
[#148]: https://github.com/jprichardson/node-fs-extra/issues/148 "split out `Sync` methods in documentation"
|
||||
[#147]: https://github.com/jprichardson/node-fs-extra/issues/147 "Adding rmdirIfEmpty"
|
||||
[#146]: https://github.com/jprichardson/node-fs-extra/pull/146 "ensure test.js works"
|
||||
[#145]: https://github.com/jprichardson/node-fs-extra/issues/145 "Add `fs.exists` and `fs.existsSync` if it doesn't exist."
|
||||
[#144]: https://github.com/jprichardson/node-fs-extra/issues/144 "tests failing"
|
||||
[#143]: https://github.com/jprichardson/node-fs-extra/issues/143 "update graceful-fs"
|
||||
[#142]: https://github.com/jprichardson/node-fs-extra/issues/142 "PrependFile Feature"
|
||||
[#141]: https://github.com/jprichardson/node-fs-extra/pull/141 "Add option to preserve timestamps"
|
||||
[#140]: https://github.com/jprichardson/node-fs-extra/issues/140 "Json file reading fails with 'utf8'"
|
||||
[#139]: https://github.com/jprichardson/node-fs-extra/pull/139 "Preserve file timestamp on copy. Closes #138"
|
||||
[#138]: https://github.com/jprichardson/node-fs-extra/issues/138 "Preserve timestamps on copying files"
|
||||
[#137]: https://github.com/jprichardson/node-fs-extra/issues/137 "outputFile/outputJson: Unexpected end of input"
|
||||
[#136]: https://github.com/jprichardson/node-fs-extra/pull/136 "Update license attribute"
|
||||
[#135]: https://github.com/jprichardson/node-fs-extra/issues/135 "emptyDir throws Error if no callback is provided"
|
||||
[#134]: https://github.com/jprichardson/node-fs-extra/pull/134 "Handle EEXIST error when clobbering dir"
|
||||
[#133]: https://github.com/jprichardson/node-fs-extra/pull/133 "Travis runs with `sudo: false`"
|
||||
[#132]: https://github.com/jprichardson/node-fs-extra/pull/132 "isDirectory method"
|
||||
[#131]: https://github.com/jprichardson/node-fs-extra/issues/131 "copySync is not working iojs 1.8.4 on linux [feature-copy]"
|
||||
[#130]: https://github.com/jprichardson/node-fs-extra/pull/130 "Please review additional features."
|
||||
[#129]: https://github.com/jprichardson/node-fs-extra/pull/129 "can you review this feature?"
|
||||
[#128]: https://github.com/jprichardson/node-fs-extra/issues/128 "fsExtra.move(filepath, newPath) broken;"
|
||||
[#127]: https://github.com/jprichardson/node-fs-extra/issues/127 "consider using fs.access to remove deprecated warnings for fs.exists"
|
||||
[#126]: https://github.com/jprichardson/node-fs-extra/issues/126 " TypeError: Object #<Object> has no method 'access'"
|
||||
[#125]: https://github.com/jprichardson/node-fs-extra/issues/125 "Question: What do the *Sync function do different from non-sync"
|
||||
[#124]: https://github.com/jprichardson/node-fs-extra/issues/124 "move with clobber option 'ENOTEMPTY'"
|
||||
[#123]: https://github.com/jprichardson/node-fs-extra/issues/123 "Only copy the content of a directory"
|
||||
[#122]: https://github.com/jprichardson/node-fs-extra/pull/122 "Update section links in README to match current section ids."
|
||||
[#121]: https://github.com/jprichardson/node-fs-extra/issues/121 "emptyDir is undefined"
|
||||
[#120]: https://github.com/jprichardson/node-fs-extra/issues/120 "usage bug caused by shallow cloning methods of 'graceful-fs'"
|
||||
[#119]: https://github.com/jprichardson/node-fs-extra/issues/119 "mkdirs and ensureDir never invoke callback and consume CPU indefinitely if provided a path with invalid characters on Windows"
|
||||
[#118]: https://github.com/jprichardson/node-fs-extra/pull/118 "createOutputStream"
|
||||
[#117]: https://github.com/jprichardson/node-fs-extra/pull/117 "Fixed issue with slash separated paths on windows"
|
||||
[#116]: https://github.com/jprichardson/node-fs-extra/issues/116 "copySync can only copy directories not files [documentation, feature-copy]"
|
||||
[#115]: https://github.com/jprichardson/node-fs-extra/issues/115 ".Copy & .CopySync [feature-copy]"
|
||||
[#114]: https://github.com/jprichardson/node-fs-extra/issues/114 "Fails to move (rename) directory to non-empty directory even with clobber: true"
|
||||
[#113]: https://github.com/jprichardson/node-fs-extra/issues/113 "fs.copy seems to callback early if the destination file already exists"
|
||||
[#112]: https://github.com/jprichardson/node-fs-extra/pull/112 "Copying a file into an existing directory"
|
||||
[#111]: https://github.com/jprichardson/node-fs-extra/pull/111 "Moving a file into an existing directory "
|
||||
[#110]: https://github.com/jprichardson/node-fs-extra/pull/110 "Moving a file into an existing directory"
|
||||
[#109]: https://github.com/jprichardson/node-fs-extra/issues/109 "fs.move across windows drives fails"
|
||||
[#108]: https://github.com/jprichardson/node-fs-extra/issues/108 "fse.move directories across multiple devices doesn't work"
|
||||
[#107]: https://github.com/jprichardson/node-fs-extra/pull/107 "Check if dest path is an existing dir and copy or move source in it"
|
||||
[#106]: https://github.com/jprichardson/node-fs-extra/issues/106 "fse.copySync crashes while copying across devices D: [feature-copy]"
|
||||
[#105]: https://github.com/jprichardson/node-fs-extra/issues/105 "fs.copy hangs on iojs"
|
||||
[#104]: https://github.com/jprichardson/node-fs-extra/issues/104 "fse.move deletes folders [bug]"
|
||||
[#103]: https://github.com/jprichardson/node-fs-extra/issues/103 "Error: EMFILE with copy"
|
||||
[#102]: https://github.com/jprichardson/node-fs-extra/issues/102 "touch / touchSync was removed ?"
|
||||
[#101]: https://github.com/jprichardson/node-fs-extra/issues/101 "fs-extra promisified"
|
||||
[#100]: https://github.com/jprichardson/node-fs-extra/pull/100 "copy: options object or filter to pass to ncp"
|
||||
[#99]: https://github.com/jprichardson/node-fs-extra/issues/99 "ensureDir() modes [future]"
|
||||
[#98]: https://github.com/jprichardson/node-fs-extra/issues/98 "fs.copy() incorrect async behavior [bug]"
|
||||
[#97]: https://github.com/jprichardson/node-fs-extra/pull/97 "use path.join; fix copySync bug"
|
||||
[#96]: https://github.com/jprichardson/node-fs-extra/issues/96 "destFolderExists in copySync is always undefined."
|
||||
[#95]: https://github.com/jprichardson/node-fs-extra/pull/95 "Using graceful-ncp instead of ncp"
|
||||
[#94]: https://github.com/jprichardson/node-fs-extra/issues/94 "Error: EEXIST, file already exists '../mkdirp/bin/cmd.js' on fs.copySync() [enhancement, feature-copy]"
|
||||
[#93]: https://github.com/jprichardson/node-fs-extra/issues/93 "Confusing error if drive not mounted [enhancement]"
|
||||
[#92]: https://github.com/jprichardson/node-fs-extra/issues/92 "Problems with Bluebird"
|
||||
[#91]: https://github.com/jprichardson/node-fs-extra/issues/91 "fs.copySync('/test', '/haha') is different with 'cp -r /test /haha' [enhancement]"
|
||||
[#90]: https://github.com/jprichardson/node-fs-extra/issues/90 "Folder creation and file copy is Happening in 64 bit machine but not in 32 bit machine"
|
||||
[#89]: https://github.com/jprichardson/node-fs-extra/issues/89 "Error: EEXIST using fs-extra's fs.copy to copy a directory on Windows"
|
||||
[#88]: https://github.com/jprichardson/node-fs-extra/issues/88 "Stacking those libraries"
|
||||
[#87]: https://github.com/jprichardson/node-fs-extra/issues/87 "createWriteStream + outputFile = ?"
|
||||
[#86]: https://github.com/jprichardson/node-fs-extra/issues/86 "no moveSync?"
|
||||
[#85]: https://github.com/jprichardson/node-fs-extra/pull/85 "Copy symlinks in copySync"
|
||||
[#84]: https://github.com/jprichardson/node-fs-extra/issues/84 "Push latest version to npm ?"
|
||||
[#83]: https://github.com/jprichardson/node-fs-extra/issues/83 "Prevent copying a directory into itself [feature-copy]"
|
||||
[#82]: https://github.com/jprichardson/node-fs-extra/pull/82 "README updates for move"
|
||||
[#81]: https://github.com/jprichardson/node-fs-extra/issues/81 "fd leak after fs.move"
|
||||
[#80]: https://github.com/jprichardson/node-fs-extra/pull/80 "Preserve file mode in copySync"
|
||||
[#79]: https://github.com/jprichardson/node-fs-extra/issues/79 "fs.copy only .html file empty"
|
||||
[#78]: https://github.com/jprichardson/node-fs-extra/pull/78 "copySync was not applying filters to directories"
|
||||
[#77]: https://github.com/jprichardson/node-fs-extra/issues/77 "Create README reference to bluebird"
|
||||
[#76]: https://github.com/jprichardson/node-fs-extra/issues/76 "Create README reference to typescript"
|
||||
[#75]: https://github.com/jprichardson/node-fs-extra/issues/75 "add glob as a dep? [question]"
|
||||
[#74]: https://github.com/jprichardson/node-fs-extra/pull/74 "including new emptydir module"
|
||||
[#73]: https://github.com/jprichardson/node-fs-extra/pull/73 "add dependency status in readme"
|
||||
[#72]: https://github.com/jprichardson/node-fs-extra/pull/72 "Use svg instead of png to get better image quality"
|
||||
[#71]: https://github.com/jprichardson/node-fs-extra/issues/71 "fse.copy not working on Windows 7 x64 OS, but, copySync does work"
|
||||
[#70]: https://github.com/jprichardson/node-fs-extra/issues/70 "Not filter each file, stops on first false [bug]"
|
||||
[#69]: https://github.com/jprichardson/node-fs-extra/issues/69 "How to check if folder exist and read the folder name"
|
||||
[#68]: https://github.com/jprichardson/node-fs-extra/issues/68 "consider flag to readJsonSync (throw false) [enhancement]"
|
||||
[#67]: https://github.com/jprichardson/node-fs-extra/issues/67 "docs for readJson incorrectly states that is accepts options"
|
||||
[#66]: https://github.com/jprichardson/node-fs-extra/issues/66 "ENAMETOOLONG"
|
||||
[#65]: https://github.com/jprichardson/node-fs-extra/issues/65 "exclude filter in fs.copy"
|
||||
[#64]: https://github.com/jprichardson/node-fs-extra/issues/64 "Announce: mfs - monitor your fs-extra calls"
|
||||
[#63]: https://github.com/jprichardson/node-fs-extra/issues/63 "Walk"
|
||||
[#62]: https://github.com/jprichardson/node-fs-extra/issues/62 "npm install fs-extra doesn't work"
|
||||
[#61]: https://github.com/jprichardson/node-fs-extra/issues/61 "No longer supports node 0.8 due to use of `^` in package.json dependencies"
|
||||
[#60]: https://github.com/jprichardson/node-fs-extra/issues/60 "chmod & chown for mkdirs"
|
||||
[#59]: https://github.com/jprichardson/node-fs-extra/issues/59 "Consider including mkdirp and making fs-extra '--use_strict' safe [question]"
|
||||
[#58]: https://github.com/jprichardson/node-fs-extra/issues/58 "Stack trace not included in fs.copy error"
|
||||
[#57]: https://github.com/jprichardson/node-fs-extra/issues/57 "Possible to include wildcards in delete?"
|
||||
[#56]: https://github.com/jprichardson/node-fs-extra/issues/56 "Crash when have no access to write to destination file in copy "
|
||||
[#55]: https://github.com/jprichardson/node-fs-extra/issues/55 "Is it possible to have any console output similar to Grunt copy module?"
|
||||
[#54]: https://github.com/jprichardson/node-fs-extra/issues/54 "`copy` does not preserve file ownership and permissons"
|
||||
[#53]: https://github.com/jprichardson/node-fs-extra/issues/53 "outputFile() - ability to write data in appending mode"
|
||||
[#52]: https://github.com/jprichardson/node-fs-extra/pull/52 "This fixes (what I think) is a bug in copySync"
|
||||
[#51]: https://github.com/jprichardson/node-fs-extra/pull/51 "Add a Bitdeli Badge to README"
|
||||
[#50]: https://github.com/jprichardson/node-fs-extra/issues/50 "Replace mechanism in createFile"
|
||||
[#49]: https://github.com/jprichardson/node-fs-extra/pull/49 "update rimraf to v2.2.6"
|
||||
[#48]: https://github.com/jprichardson/node-fs-extra/issues/48 "fs.copy issue [bug]"
|
||||
[#47]: https://github.com/jprichardson/node-fs-extra/issues/47 "Bug in copy - callback called on readStream 'close' - Fixed in ncp 0.5.0"
|
||||
[#46]: https://github.com/jprichardson/node-fs-extra/pull/46 "update copyright year"
|
||||
[#45]: https://github.com/jprichardson/node-fs-extra/pull/45 "Added note about fse.outputFile() being the one that overwrites"
|
||||
[#44]: https://github.com/jprichardson/node-fs-extra/pull/44 "Proposal: Stream support"
|
||||
[#43]: https://github.com/jprichardson/node-fs-extra/issues/43 "Better error reporting "
|
||||
[#42]: https://github.com/jprichardson/node-fs-extra/issues/42 "Performance issue?"
|
||||
[#41]: https://github.com/jprichardson/node-fs-extra/pull/41 "There does seem to be a synchronous version now"
|
||||
[#40]: https://github.com/jprichardson/node-fs-extra/issues/40 "fs.copy throw unexplained error ENOENT, utime "
|
||||
[#39]: https://github.com/jprichardson/node-fs-extra/pull/39 "Added regression test for copy() return callback on error"
|
||||
[#38]: https://github.com/jprichardson/node-fs-extra/pull/38 "Return err in copy() fstat cb, because stat could be undefined or null"
|
||||
[#37]: https://github.com/jprichardson/node-fs-extra/issues/37 "Maybe include a line reader? [enhancement, question]"
|
||||
[#36]: https://github.com/jprichardson/node-fs-extra/pull/36 "`filter` parameter `fs.copy` and `fs.copySync`"
|
||||
[#35]: https://github.com/jprichardson/node-fs-extra/pull/35 "`filter` parameter `fs.copy` and `fs.copySync` "
|
||||
[#34]: https://github.com/jprichardson/node-fs-extra/issues/34 "update docs to include options for JSON methods [enhancement]"
|
||||
[#33]: https://github.com/jprichardson/node-fs-extra/pull/33 "fs_extra.copySync"
|
||||
[#32]: https://github.com/jprichardson/node-fs-extra/issues/32 "update to latest jsonfile [enhancement]"
|
||||
[#31]: https://github.com/jprichardson/node-fs-extra/issues/31 "Add ensure methods [enhancement]"
|
||||
[#30]: https://github.com/jprichardson/node-fs-extra/issues/30 "update package.json optional dep `graceful-fs`"
|
||||
[#29]: https://github.com/jprichardson/node-fs-extra/issues/29 "Copy failing if dest directory doesn't exist. Is this intended?"
|
||||
[#28]: https://github.com/jprichardson/node-fs-extra/issues/28 "homepage field must be a string url. Deleted."
|
||||
[#27]: https://github.com/jprichardson/node-fs-extra/issues/27 "Update Readme"
|
||||
[#26]: https://github.com/jprichardson/node-fs-extra/issues/26 "Add readdir recursive method. [enhancement]"
|
||||
[#25]: https://github.com/jprichardson/node-fs-extra/pull/25 "adding an `.npmignore` file"
|
||||
[#24]: https://github.com/jprichardson/node-fs-extra/issues/24 "[bug] cannot run in strict mode [bug]"
|
||||
[#23]: https://github.com/jprichardson/node-fs-extra/issues/23 "`writeJSON()` should create parent directories"
|
||||
[#22]: https://github.com/jprichardson/node-fs-extra/pull/22 "Add a limit option to mkdirs()"
|
||||
[#21]: https://github.com/jprichardson/node-fs-extra/issues/21 "touch() in 0.10.0"
|
||||
[#20]: https://github.com/jprichardson/node-fs-extra/issues/20 "fs.remove yields callback before directory is really deleted"
|
||||
[#19]: https://github.com/jprichardson/node-fs-extra/issues/19 "fs.copy err is empty array"
|
||||
[#18]: https://github.com/jprichardson/node-fs-extra/pull/18 "Exposed copyFile Function"
|
||||
[#17]: https://github.com/jprichardson/node-fs-extra/issues/17 "Use `require('graceful-fs')` if found instead of `require('fs')`"
|
||||
[#16]: https://github.com/jprichardson/node-fs-extra/pull/16 "Update README.md"
|
||||
[#15]: https://github.com/jprichardson/node-fs-extra/issues/15 "Implement cp -r but sync aka copySync. [enhancement]"
|
||||
[#14]: https://github.com/jprichardson/node-fs-extra/issues/14 "fs.mkdirSync is broken in 0.3.1"
|
||||
[#13]: https://github.com/jprichardson/node-fs-extra/issues/13 "Thoughts on including a directory tree / file watcher? [enhancement, question]"
|
||||
[#12]: https://github.com/jprichardson/node-fs-extra/issues/12 "copyFile & copyFileSync are global"
|
||||
[#11]: https://github.com/jprichardson/node-fs-extra/issues/11 "Thoughts on including a file walker? [enhancement, question]"
|
||||
[#10]: https://github.com/jprichardson/node-fs-extra/issues/10 "move / moveFile API [enhancement]"
|
||||
[#9]: https://github.com/jprichardson/node-fs-extra/issues/9 "don't import normal fs stuff into fs-extra"
|
||||
[#8]: https://github.com/jprichardson/node-fs-extra/pull/8 "Update rimraf to latest version"
|
||||
[#6]: https://github.com/jprichardson/node-fs-extra/issues/6 "Remove CoffeeScript development dependency"
|
||||
[#5]: https://github.com/jprichardson/node-fs-extra/issues/5 "comments on naming"
|
||||
[#4]: https://github.com/jprichardson/node-fs-extra/issues/4 "version bump to 0.2"
|
||||
[#3]: https://github.com/jprichardson/node-fs-extra/pull/3 "Hi! I fixed some code for you!"
|
||||
[#2]: https://github.com/jprichardson/node-fs-extra/issues/2 "Merge with fs.extra and mkdirp"
|
||||
[#1]: https://github.com/jprichardson/node-fs-extra/issues/1 "file-extra npm !exist"
|
||||
15
node_modules/fs-extra/LICENSE
generated
vendored
Normal file
15
node_modules/fs-extra/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
(The MIT License)
|
||||
|
||||
Copyright (c) 2011-2017 JP Richardson
|
||||
|
||||
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.
|
||||
242
node_modules/fs-extra/README.md
generated
vendored
Normal file
242
node_modules/fs-extra/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,242 @@
|
|||
Node.js: fs-extra
|
||||
=================
|
||||
|
||||
`fs-extra` adds file system methods that aren't included in the native `fs` module and adds promise support to the `fs` methods. It should be a drop in replacement for `fs`.
|
||||
|
||||
[](https://www.npmjs.org/package/fs-extra)
|
||||
[](http://travis-ci.org/jprichardson/node-fs-extra)
|
||||
[](https://ci.appveyor.com/project/jprichardson/node-fs-extra/branch/master)
|
||||
[](https://www.npmjs.org/package/fs-extra)
|
||||
[](https://coveralls.io/r/jprichardson/node-fs-extra)
|
||||
|
||||
<a href="https://github.com/feross/standard"><img src="https://cdn.rawgit.com/feross/standard/master/sticker.svg" alt="Standard JavaScript" width="100"></a>
|
||||
|
||||
|
||||
Why?
|
||||
----
|
||||
|
||||
I got tired of including `mkdirp`, `rimraf`, and `ncp` in most of my projects.
|
||||
|
||||
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
npm install --save fs-extra
|
||||
|
||||
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
`fs-extra` is a drop in replacement for native `fs`. All methods in `fs` are attached to `fs-extra`. All `fs` methods return promises if the callback isn't passed.
|
||||
|
||||
You don't ever need to include the original `fs` module again:
|
||||
|
||||
```js
|
||||
const fs = require('fs') // this is no longer necessary
|
||||
```
|
||||
|
||||
you can now do this:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
```
|
||||
|
||||
or if you prefer to make it clear that you're using `fs-extra` and not `fs`, you may want
|
||||
to name your `fs` variable `fse` like so:
|
||||
|
||||
```js
|
||||
const fse = require('fs-extra')
|
||||
```
|
||||
|
||||
you can also keep both, but it's redundant:
|
||||
|
||||
```js
|
||||
const fs = require('fs')
|
||||
const fse = require('fs-extra')
|
||||
```
|
||||
|
||||
Sync vs Async
|
||||
-------------
|
||||
Most methods are async by default. All async methods will return a promise if the callback isn't passed.
|
||||
|
||||
Sync methods on the other hand will throw if an error occurs.
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
// Async with promises:
|
||||
fs.copy('/tmp/myfile', '/tmp/mynewfile')
|
||||
.then(() => console.log('success!'))
|
||||
.catch(err => console.error(err))
|
||||
|
||||
// Async with callbacks:
|
||||
fs.copy('/tmp/myfile', '/tmp/mynewfile', err => {
|
||||
if (err) return console.error(err)
|
||||
console.log('success!')
|
||||
})
|
||||
|
||||
// Sync:
|
||||
try {
|
||||
fs.copySync('/tmp/myfile', '/tmp/mynewfile')
|
||||
console.log('success!')
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Methods
|
||||
-------
|
||||
|
||||
### Async
|
||||
|
||||
- [copy](docs/copy.md)
|
||||
- [emptyDir](docs/emptyDir.md)
|
||||
- [ensureFile](docs/ensureFile.md)
|
||||
- [ensureDir](docs/ensureDir.md)
|
||||
- [ensureLink](docs/ensureLink.md)
|
||||
- [ensureSymlink](docs/ensureSymlink.md)
|
||||
- [mkdirs](docs/ensureDir.md)
|
||||
- [move](docs/move.md)
|
||||
- [outputFile](docs/outputFile.md)
|
||||
- [outputJson](docs/outputJson.md)
|
||||
- [pathExists](docs/pathExists.md)
|
||||
- [readJson](docs/readJson.md)
|
||||
- [remove](docs/remove.md)
|
||||
- [writeJson](docs/writeJson.md)
|
||||
|
||||
### Sync
|
||||
|
||||
- [copySync](docs/copy-sync.md)
|
||||
- [emptyDirSync](docs/emptyDir-sync.md)
|
||||
- [ensureFileSync](docs/ensureFile-sync.md)
|
||||
- [ensureDirSync](docs/ensureDir-sync.md)
|
||||
- [ensureLinkSync](docs/ensureLink-sync.md)
|
||||
- [ensureSymlinkSync](docs/ensureSymlink-sync.md)
|
||||
- [mkdirsSync](docs/ensureDir-sync.md)
|
||||
- [moveSync](docs/move-sync.md)
|
||||
- [outputFileSync](docs/outputFile-sync.md)
|
||||
- [outputJsonSync](docs/outputJson-sync.md)
|
||||
- [pathExistsSync](docs/pathExists-sync.md)
|
||||
- [readJsonSync](docs/readJson-sync.md)
|
||||
- [removeSync](docs/remove-sync.md)
|
||||
- [writeJsonSync](docs/writeJson-sync.md)
|
||||
|
||||
|
||||
**NOTE:** You can still use the native Node.js methods. They are promisified and copied over to `fs-extra`. See [notes on `fs.read()` & `fs.write()`](docs/fs-read-write.md)
|
||||
|
||||
### What happened to `walk()` and `walkSync()`?
|
||||
|
||||
They were removed from `fs-extra` in v2.0.0. If you need the functionality, `walk` and `walkSync` are available as separate packages, [`klaw`](https://github.com/jprichardson/node-klaw) and [`klaw-sync`](https://github.com/manidlou/node-klaw-sync).
|
||||
|
||||
|
||||
Third Party
|
||||
-----------
|
||||
|
||||
|
||||
### TypeScript
|
||||
|
||||
If you like TypeScript, you can use `fs-extra` with it: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/fs-extra
|
||||
|
||||
|
||||
### File / Directory Watching
|
||||
|
||||
If you want to watch for changes to files or directories, then you should use [chokidar](https://github.com/paulmillr/chokidar).
|
||||
|
||||
|
||||
### Misc.
|
||||
|
||||
- [mfs](https://github.com/cadorn/mfs) - Monitor your fs-extra calls.
|
||||
|
||||
|
||||
|
||||
Hacking on fs-extra
|
||||
-------------------
|
||||
|
||||
Wanna hack on `fs-extra`? Great! Your help is needed! [fs-extra is one of the most depended upon Node.js packages](http://nodei.co/npm/fs-extra.png?downloads=true&downloadRank=true&stars=true). This project
|
||||
uses [JavaScript Standard Style](https://github.com/feross/standard) - if the name or style choices bother you,
|
||||
you're gonna have to get over it :) If `standard` is good enough for `npm`, it's good enough for `fs-extra`.
|
||||
|
||||
[](https://github.com/feross/standard)
|
||||
|
||||
What's needed?
|
||||
- First, take a look at existing issues. Those are probably going to be where the priority lies.
|
||||
- More tests for edge cases. Specifically on different platforms. There can never be enough tests.
|
||||
- Improve test coverage. See coveralls output for more info.
|
||||
|
||||
Note: If you make any big changes, **you should definitely file an issue for discussion first.**
|
||||
|
||||
### Running the Test Suite
|
||||
|
||||
fs-extra contains hundreds of tests.
|
||||
|
||||
- `npm run lint`: runs the linter ([standard](http://standardjs.com/))
|
||||
- `npm run unit`: runs the unit tests
|
||||
- `npm test`: runs both the linter and the tests
|
||||
|
||||
|
||||
### Windows
|
||||
|
||||
If you run the tests on the Windows and receive a lot of symbolic link `EPERM` permission errors, it's
|
||||
because on Windows you need elevated privilege to create symbolic links. You can add this to your Windows's
|
||||
account by following the instructions here: http://superuser.com/questions/104845/permission-to-make-symbolic-links-in-windows-7
|
||||
However, I didn't have much luck doing this.
|
||||
|
||||
Since I develop on Mac OS X, I use VMWare Fusion for Windows testing. I create a shared folder that I map to a drive on Windows.
|
||||
I open the `Node.js command prompt` and run as `Administrator`. I then map the network drive running the following command:
|
||||
|
||||
net use z: "\\vmware-host\Shared Folders"
|
||||
|
||||
I can then navigate to my `fs-extra` directory and run the tests.
|
||||
|
||||
|
||||
Naming
|
||||
------
|
||||
|
||||
I put a lot of thought into the naming of these functions. Inspired by @coolaj86's request. So he deserves much of the credit for raising the issue. See discussion(s) here:
|
||||
|
||||
* https://github.com/jprichardson/node-fs-extra/issues/2
|
||||
* https://github.com/flatiron/utile/issues/11
|
||||
* https://github.com/ryanmcgrath/wrench-js/issues/29
|
||||
* https://github.com/substack/node-mkdirp/issues/17
|
||||
|
||||
First, I believe that in as many cases as possible, the [Node.js naming schemes](http://nodejs.org/api/fs.html) should be chosen. However, there are problems with the Node.js own naming schemes.
|
||||
|
||||
For example, `fs.readFile()` and `fs.readdir()`: the **F** is capitalized in *File* and the **d** is not capitalized in *dir*. Perhaps a bit pedantic, but they should still be consistent. Also, Node.js has chosen a lot of POSIX naming schemes, which I believe is great. See: `fs.mkdir()`, `fs.rmdir()`, `fs.chown()`, etc.
|
||||
|
||||
We have a dilemma though. How do you consistently name methods that perform the following POSIX commands: `cp`, `cp -r`, `mkdir -p`, and `rm -rf`?
|
||||
|
||||
My perspective: when in doubt, err on the side of simplicity. A directory is just a hierarchical grouping of directories and files. Consider that for a moment. So when you want to copy it or remove it, in most cases you'll want to copy or remove all of its contents. When you want to create a directory, if the directory that it's suppose to be contained in does not exist, then in most cases you'll want to create that too.
|
||||
|
||||
So, if you want to remove a file or a directory regardless of whether it has contents, just call `fs.remove(path)`. If you want to copy a file or a directory whether it has contents, just call `fs.copy(source, destination)`. If you want to create a directory regardless of whether its parent directories exist, just call `fs.mkdirs(path)` or `fs.mkdirp(path)`.
|
||||
|
||||
|
||||
Credit
|
||||
------
|
||||
|
||||
`fs-extra` wouldn't be possible without using the modules from the following authors:
|
||||
|
||||
- [Isaac Shlueter](https://github.com/isaacs)
|
||||
- [Charlie McConnel](https://github.com/avianflu)
|
||||
- [James Halliday](https://github.com/substack)
|
||||
- [Andrew Kelley](https://github.com/andrewrk)
|
||||
|
||||
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
Licensed under MIT
|
||||
|
||||
Copyright (c) 2011-2017 [JP Richardson](https://github.com/jprichardson)
|
||||
|
||||
[1]: http://nodejs.org/docs/latest/api/fs.html
|
||||
|
||||
|
||||
[jsonfile]: https://github.com/jprichardson/node-jsonfile
|
||||
37
node_modules/fs-extra/docs/copy-sync.md
generated
vendored
Normal file
37
node_modules/fs-extra/docs/copy-sync.md
generated
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
# copySync(src, dest, [options])
|
||||
|
||||
Copy a file or directory. The directory can have contents. Like `cp -r`.
|
||||
|
||||
- `src` `<String>`
|
||||
- `dest` `<String>`
|
||||
- `options` `<Object>`
|
||||
- `overwrite` `<boolean>`: overwrite existing file or directory, default is `true`. _Note that the copy operation will silently fail if you set this to `false` and the destination exists._ Use the `errorOnExist` option to change this behavior.
|
||||
- `errorOnExist` `<boolean>`: when `overwrite` is `false` and the destination exists, throw an error. Default is `false`.
|
||||
- `dereference` `<boolean>`: dereference symlinks, default is `false`.
|
||||
- `preserveTimestamps` `<boolean>`: will set last modification and access times to the ones of the original source files, default is `false`.
|
||||
- `filter` `<Function>`: Function to filter copied files. Return `true` to include, `false` to exclude. This can also be a RegExp, however this is deprecated (See [issue #239](https://github.com/jprichardson/node-fs-extra/issues/239) for background).
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
// copy file
|
||||
fs.copySync('/tmp/myfile', '/tmp/mynewfile')
|
||||
|
||||
// copy directory, even if it has subdirectories or files
|
||||
fs.copySync('/tmp/mydir', '/tmp/mynewdir')
|
||||
```
|
||||
|
||||
**Using filter function**
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const filterFunc = (src, dest) => {
|
||||
// your logic here
|
||||
// it will be copied if return true
|
||||
}
|
||||
|
||||
fs.copySync('/tmp/mydir', '/tmp/mynewdir', { filter: filterFunc })
|
||||
```
|
||||
57
node_modules/fs-extra/docs/copy.md
generated
vendored
Normal file
57
node_modules/fs-extra/docs/copy.md
generated
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
# copy(src, dest, [options, callback])
|
||||
|
||||
Copy a file or directory. The directory can have contents. Like `cp -r`.
|
||||
|
||||
- `src` `<String>`
|
||||
- `dest` `<String>` Note that if `src` is a file, `dest` cannot be a directory (see [issue #323](https://github.com/jprichardson/node-fs-extra/issues/323)).
|
||||
- `options` `<Object>`
|
||||
- `overwrite` `<boolean>`: overwrite existing file or directory, default is `true`. _Note that the copy operation will silently fail if you set this to `false` and the destination exists._ Use the `errorOnExist` option to change this behavior.
|
||||
- `errorOnExist` `<boolean>`: when `overwrite` is `false` and the destination exists, throw an error. Default is `false`.
|
||||
- `dereference` `<boolean>`: dereference symlinks, default is `false`.
|
||||
- `preserveTimestamps` `<boolean>`: will set last modification and access times to the ones of the original source files, default is `false`.
|
||||
- `filter` `<Function>`: Function to filter copied files. Return `true` to include, `false` to exclude. This can also be a RegExp, however this is deprecated (See [issue #239](https://github.com/jprichardson/node-fs-extra/issues/239) for background).
|
||||
- `callback` `<Function>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
fs.copy('/tmp/myfile', '/tmp/mynewfile', err => {
|
||||
if (err) return console.error(err)
|
||||
|
||||
console.log('success!')
|
||||
}) // copies file
|
||||
|
||||
fs.copy('/tmp/mydir', '/tmp/mynewdir', err => {
|
||||
if (err) return console.error(err)
|
||||
|
||||
console.log('success!')
|
||||
}) // copies directory, even if it has subdirectories or files
|
||||
|
||||
// Promise usage:
|
||||
fs.copy('/tmp/myfile', '/tmp/mynewfile')
|
||||
.then(() => {
|
||||
console.log('success!')
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
|
||||
**Using filter function**
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const filterFunc = (src, dest) => {
|
||||
// your logic here
|
||||
// it will be copied if return true
|
||||
}
|
||||
|
||||
fs.copy('/tmp/mydir', '/tmp/mynewdir', { filter: filterFunc }, err => {
|
||||
if (err) return console.error(err)
|
||||
|
||||
console.log('success!')
|
||||
})
|
||||
```
|
||||
16
node_modules/fs-extra/docs/emptyDir-sync.md
generated
vendored
Normal file
16
node_modules/fs-extra/docs/emptyDir-sync.md
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# emptyDirSync(dir)
|
||||
|
||||
Ensures that a directory is empty. Deletes directory contents if the directory is not empty. If the directory does not exist, it is created. The directory itself is not deleted.
|
||||
|
||||
**Alias:** `emptydirSync()`
|
||||
|
||||
- `dir` `<String>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
// assume this directory has a lot of files and folders
|
||||
fs.emptyDirSync('/tmp/some/dir')
|
||||
```
|
||||
30
node_modules/fs-extra/docs/emptyDir.md
generated
vendored
Normal file
30
node_modules/fs-extra/docs/emptyDir.md
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# emptyDir(dir, [callback])
|
||||
|
||||
Ensures that a directory is empty. Deletes directory contents if the directory is not empty. If the directory does not exist, it is created. The directory itself is not deleted.
|
||||
|
||||
**Alias:** `emptydir()`
|
||||
|
||||
- `dir` `<String>`
|
||||
- `callback` `<Function>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
// assume this directory has a lot of files and folders
|
||||
fs.emptyDir('/tmp/some/dir', err => {
|
||||
if (err) return console.error(err)
|
||||
|
||||
console.log('success!')
|
||||
})
|
||||
|
||||
// With promises
|
||||
fs.emptyDir('/tmp/some/dir')
|
||||
.then(() => {
|
||||
console.log('success!')
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
17
node_modules/fs-extra/docs/ensureDir-sync.md
generated
vendored
Normal file
17
node_modules/fs-extra/docs/ensureDir-sync.md
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# ensureDirSync(dir)
|
||||
|
||||
Ensures that the directory exists. If the directory structure does not exist, it is created. Like `mkdir -p`.
|
||||
|
||||
**Aliases:** `mkdirsSync()`, `mkdirpSync()`
|
||||
|
||||
- `dir` `<String>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const dir = '/tmp/this/path/does/not/exist'
|
||||
fs.ensureDirSync(dir)
|
||||
// dir has now been created, including the directory it is to be placed in
|
||||
```
|
||||
29
node_modules/fs-extra/docs/ensureDir.md
generated
vendored
Normal file
29
node_modules/fs-extra/docs/ensureDir.md
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# ensureDir(dir, [callback])
|
||||
|
||||
Ensures that the directory exists. If the directory structure does not exist, it is created. Like `mkdir -p`.
|
||||
|
||||
**Aliases:** `mkdirs()`, `mkdirp()`
|
||||
|
||||
- `dir` `<String>`
|
||||
- `callback` `<Function>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const dir = '/tmp/this/path/does/not/exist'
|
||||
fs.ensureDir(dir, err => {
|
||||
console.log(err) // => null
|
||||
// dir has now been created, including the directory it is to be placed in
|
||||
})
|
||||
|
||||
// With Promises:
|
||||
fs.ensureDir(dir)
|
||||
.then(() => {
|
||||
console.log('success!')
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
17
node_modules/fs-extra/docs/ensureFile-sync.md
generated
vendored
Normal file
17
node_modules/fs-extra/docs/ensureFile-sync.md
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# ensureFileSync(file)
|
||||
|
||||
Ensures that the file exists. If the file that is requested to be created is in directories that do not exist, these directories are created. If the file already exists, it is **NOT MODIFIED**.
|
||||
|
||||
**Alias:** `createFileSync()`
|
||||
|
||||
- `file` `<String>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const file = '/tmp/this/path/does/not/exist/file.txt'
|
||||
fs.ensureFileSync(file)
|
||||
// file has now been created, including the directory it is to be placed in
|
||||
```
|
||||
29
node_modules/fs-extra/docs/ensureFile.md
generated
vendored
Normal file
29
node_modules/fs-extra/docs/ensureFile.md
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# ensureFile(file, [callback])
|
||||
|
||||
Ensures that the file exists. If the file that is requested to be created is in directories that do not exist, these directories are created. If the file already exists, it is **NOT MODIFIED**.
|
||||
|
||||
**Alias:** `createFile()`
|
||||
|
||||
- `file` `<String>`
|
||||
- `callback` `<Function>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const file = '/tmp/this/path/does/not/exist/file.txt'
|
||||
fs.ensureFile(file, err => {
|
||||
console.log(err) // => null
|
||||
// file has now been created, including the directory it is to be placed in
|
||||
})
|
||||
|
||||
// With Promises:
|
||||
fs.ensureFile(file)
|
||||
.then(() => {
|
||||
console.log('success!')
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
17
node_modules/fs-extra/docs/ensureLink-sync.md
generated
vendored
Normal file
17
node_modules/fs-extra/docs/ensureLink-sync.md
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# ensureLinkSync(srcpath, dstpath)
|
||||
|
||||
Ensures that the link exists. If the directory structure does not exist, it is created.
|
||||
|
||||
- `srcpath` `<String>`
|
||||
- `dstpath` `<String>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const srcpath = '/tmp/file.txt'
|
||||
const dstpath = '/tmp/this/path/does/not/exist/file.txt'
|
||||
fs.ensureLinkSync(srcpath, dstpath)
|
||||
// link has now been created, including the directory it is to be placed in
|
||||
```
|
||||
29
node_modules/fs-extra/docs/ensureLink.md
generated
vendored
Normal file
29
node_modules/fs-extra/docs/ensureLink.md
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# ensureLink(srcpath, dstpath, [callback])
|
||||
|
||||
Ensures that the link exists. If the directory structure does not exist, it is created.
|
||||
|
||||
- `srcpath` `<String>`
|
||||
- `dstpath` `<String>`
|
||||
- `callback` `<Function>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const srcpath = '/tmp/file.txt'
|
||||
const dstpath = '/tmp/this/path/does/not/exist/file.txt'
|
||||
fs.ensureLink(srcpath, dstpath, err => {
|
||||
console.log(err) // => null
|
||||
// link has now been created, including the directory it is to be placed in
|
||||
})
|
||||
|
||||
// With Promises:
|
||||
fs.ensureLink(srcpath, dstpath)
|
||||
.then(() => {
|
||||
console.log('success!')
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
18
node_modules/fs-extra/docs/ensureSymlink-sync.md
generated
vendored
Normal file
18
node_modules/fs-extra/docs/ensureSymlink-sync.md
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# ensureSymlinkSync(srcpath, dstpath, [type])
|
||||
|
||||
Ensures that the symlink exists. If the directory structure does not exist, it is created.
|
||||
|
||||
- `srcpath` `<String>`
|
||||
- `dstpath` `<String>`
|
||||
- `type` `<String>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const srcpath = '/tmp/file.txt'
|
||||
const dstpath = '/tmp/this/path/does/not/exist/file.txt'
|
||||
fs.ensureSymlinkSync(srcpath, dstpath)
|
||||
// symlink has now been created, including the directory it is to be placed in
|
||||
```
|
||||
30
node_modules/fs-extra/docs/ensureSymlink.md
generated
vendored
Normal file
30
node_modules/fs-extra/docs/ensureSymlink.md
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# ensureSymlink(srcpath, dstpath, [type, callback])
|
||||
|
||||
Ensures that the symlink exists. If the directory structure does not exist, it is created.
|
||||
|
||||
- `srcpath` `<String>`
|
||||
- `dstpath` `<String>`
|
||||
- `type` `<String>`
|
||||
- `callback` `<Function>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const srcpath = '/tmp/file.txt'
|
||||
const dstpath = '/tmp/this/path/does/not/exist/file.txt'
|
||||
fs.ensureSymlink(srcpath, dstpath, err => {
|
||||
console.log(err) // => null
|
||||
// symlink has now been created, including the directory it is to be placed in
|
||||
})
|
||||
|
||||
// With Promises:
|
||||
fs.ensureSymlink(srcpath, dstpath)
|
||||
.then(() => {
|
||||
console.log('success!')
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
39
node_modules/fs-extra/docs/fs-read-write.md
generated
vendored
Normal file
39
node_modules/fs-extra/docs/fs-read-write.md
generated
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
# About `fs.read()` & `fs.write()`
|
||||
|
||||
[`fs.read()`](https://nodejs.org/api/fs.html#fs_fs_read_fd_buffer_offset_length_position_callback) & [`fs.write()`](https://nodejs.org/api/fs.html#fs_fs_write_fd_buffer_offset_length_position_callback) are different from other `fs` methods in that their callbacks are called with 3 arguments instead of the usual 2 arguments.
|
||||
|
||||
If you're using them with callbacks, they will behave as usual. However, their promise usage is a little different. `fs-extra` promisifies these methods like [`util.promisify()`](https://nodejs.org/api/util.html#util_util_promisify_original) (only available in Node 8+) does.
|
||||
|
||||
Here's the example promise usage:
|
||||
|
||||
## `fs.read()`
|
||||
|
||||
```js
|
||||
// Basic promises
|
||||
fs.read(fd, buffer, offset, length, position)
|
||||
.then(results => {
|
||||
console.log(results)
|
||||
// { bytesRead: 20, buffer: <Buffer 0f 34 5d ...> }
|
||||
})
|
||||
|
||||
// Async/await usage:
|
||||
async function example () {
|
||||
const { bytesRead, buffer } = await fs.read(fd, Buffer.alloc(length), offset, length, position)
|
||||
}
|
||||
```
|
||||
|
||||
## `fs.write()`
|
||||
|
||||
```js
|
||||
// Basic promises
|
||||
fs.write(fd, buffer, offset, length, position)
|
||||
.then(results => {
|
||||
console.log(results)
|
||||
// { bytesWritten: 20, buffer: <Buffer 0f 34 5d ...> }
|
||||
})
|
||||
|
||||
// Async/await usage:
|
||||
async function example () {
|
||||
const { bytesWritten, buffer } = await fs.write(fd, Buffer.alloc(length), offset, length, position)
|
||||
}
|
||||
```
|
||||
24
node_modules/fs-extra/docs/move-sync.md
generated
vendored
Normal file
24
node_modules/fs-extra/docs/move-sync.md
generated
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# moveSync(src, dest, [options])
|
||||
|
||||
Moves a file or directory, even across devices.
|
||||
|
||||
- `src` `<String>`
|
||||
- `dest` `<String>`
|
||||
- `options` `<Object>`
|
||||
- `overwrite` `<boolean>`: overwrite existing file or directory, default is `false`.
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
fs.moveSync('/tmp/somefile', '/tmp/does/not/exist/yet/somefile')
|
||||
```
|
||||
|
||||
**Using `overwrite` option**
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
fs.moveSync('/tmp/somedir', '/tmp/may/already/existed/somedir', { overwrite: true })
|
||||
```
|
||||
41
node_modules/fs-extra/docs/move.md
generated
vendored
Normal file
41
node_modules/fs-extra/docs/move.md
generated
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
# move(src, dest, [options, callback])
|
||||
|
||||
Moves a file or directory, even across devices.
|
||||
|
||||
- `src` `<String>`
|
||||
- `dest` `<String>`
|
||||
- `options` `<Object>`
|
||||
- `overwrite` `<boolean>`: overwrite existing file or directory, default is `false`.
|
||||
- `callback` `<Function>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
fs.move('/tmp/somefile', '/tmp/does/not/exist/yet/somefile', err => {
|
||||
if (err) return console.error(err)
|
||||
|
||||
console.log('success!')
|
||||
})
|
||||
|
||||
fs.move('/tmp/somefile', '/tmp/does/not/exist/yet/somefile')
|
||||
.then(() => {
|
||||
console.log('success!')
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
|
||||
**Using `overwrite` option**
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
fs.move('/tmp/somedir', '/tmp/may/already/existed/somedir', { overwrite: true }, err => {
|
||||
if (err) return console.error(err)
|
||||
|
||||
console.log('success!')
|
||||
})
|
||||
```
|
||||
19
node_modules/fs-extra/docs/outputFile-sync.md
generated
vendored
Normal file
19
node_modules/fs-extra/docs/outputFile-sync.md
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# outputFileSync(file, data, [options])
|
||||
|
||||
Almost the same as `writeFileSync` (i.e. it [overwrites](http://pages.citebite.com/v2o5n8l2f5reb)), except that if the parent directory does not exist, it's created. `file` must be a file path (a buffer or a file descriptor is not allowed). `options` are what you'd pass to [`fs.writeFileSync()`](https://nodejs.org/api/fs.html#fs_fs_writefilesync_file_data_options).
|
||||
|
||||
- `file` `<String>`
|
||||
- `data` `<String> | <Buffer> | <Uint8Array>`
|
||||
- `options` `<Object> | <String>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const file = '/tmp/this/path/does/not/exist/file.txt'
|
||||
fs.outputFileSync(file, 'hello!')
|
||||
|
||||
const data = fs.readFileSync(file, 'utf8')
|
||||
console.log(data) // => hello!
|
||||
```
|
||||
34
node_modules/fs-extra/docs/outputFile.md
generated
vendored
Normal file
34
node_modules/fs-extra/docs/outputFile.md
generated
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
# outputFile(file, data, [options, callback])
|
||||
|
||||
Almost the same as `writeFile` (i.e. it [overwrites](http://pages.citebite.com/v2o5n8l2f5reb)), except that if the parent directory does not exist, it's created. `file` must be a file path (a buffer or a file descriptor is not allowed). `options` are what you'd pass to [`fs.writeFile()`](https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback).
|
||||
|
||||
- `file` `<String>`
|
||||
- `data` `<String> | <Buffer> | <Uint8Array>`
|
||||
- `options` `<Object> | <String>`
|
||||
- `callback` `<Function>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const file = '/tmp/this/path/does/not/exist/file.txt'
|
||||
fs.outputFile(file, 'hello!', err => {
|
||||
console.log(err) // => null
|
||||
|
||||
fs.readFile(file, 'utf8', (err, data) => {
|
||||
if (err) return console.error(err)
|
||||
console.log(data) // => hello!
|
||||
})
|
||||
})
|
||||
|
||||
// With Promises:
|
||||
fs.outputFile(file, 'hello!')
|
||||
.then(() => fs.readFile(file, 'utf8'))
|
||||
.then(data => {
|
||||
console.log(data) // => hello!
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
25
node_modules/fs-extra/docs/outputJson-sync.md
generated
vendored
Normal file
25
node_modules/fs-extra/docs/outputJson-sync.md
generated
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# outputJsonSync(file, object, [options])
|
||||
|
||||
Almost the same as [`writeJsonSync`](writeJson-sync.md), except that if the directory does not exist, it's created.
|
||||
|
||||
**Alias:** `outputJSONSync()`
|
||||
|
||||
- `file` `<String>`
|
||||
- `object` `<Object>`
|
||||
- `options` `<Object>`
|
||||
- `spaces` `<Number|String>` Number of spaces to indent; or a string to use for indentation (i.e. pass `'\t'` for tab indentation). See [the docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_space_argument) for more info.
|
||||
- `EOL` `<String>` Set EOL character. Default is `\n`.
|
||||
- `replacer` [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_replacer_parameter)
|
||||
- Also accepts [`fs.writeFileSync` options](https://nodejs.org/api/fs.html#fs_fs_writefilesync_file_data_options)
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const file = '/tmp/this/path/does/not/exist/file.json'
|
||||
fs.outputJsonSync(file, {name: 'JP'})
|
||||
|
||||
const data = fs.readJsonSync(file)
|
||||
console.log(data.name) // => JP
|
||||
```
|
||||
40
node_modules/fs-extra/docs/outputJson.md
generated
vendored
Normal file
40
node_modules/fs-extra/docs/outputJson.md
generated
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
# outputJson(file, object, [options, callback])
|
||||
|
||||
Almost the same as [`writeJson`](writeJson.md), except that if the directory does not exist, it's created.
|
||||
|
||||
**Alias:** `outputJSON()`
|
||||
|
||||
- `file` `<String>`
|
||||
- `object` `<Object>`
|
||||
- `options` `<Object>`
|
||||
- `spaces` `<Number|String>` Number of spaces to indent; or a string to use for indentation (i.e. pass `'\t'` for tab indentation). See [the docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_space_argument) for more info.
|
||||
- `EOL` `<String>` Set EOL character. Default is `\n`.
|
||||
- `replacer` [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_replacer_parameter)
|
||||
- Also accepts [`fs.writeFile` options](https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback)
|
||||
- `callback` `<Function>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const file = '/tmp/this/path/does/not/exist/file.json'
|
||||
fs.outputJson(file, {name: 'JP'}, err => {
|
||||
console.log(err) // => null
|
||||
|
||||
fs.readJson(file, (err, data) => {
|
||||
if (err) return console.error(err)
|
||||
console.log(data.name) // => JP
|
||||
})
|
||||
})
|
||||
|
||||
// With Promises:
|
||||
fs.outputJson(file, {name: 'JP'})
|
||||
.then(() => fs.readJson(file))
|
||||
.then(data => {
|
||||
console.log(data.name) // => JP
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
3
node_modules/fs-extra/docs/pathExists-sync.md
generated
vendored
Normal file
3
node_modules/fs-extra/docs/pathExists-sync.md
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# pathExistsSync(file)
|
||||
|
||||
An alias for [`fs.existsSync()`](https://nodejs.org/api/fs.html#fs_fs_existssync_path), created for consistency with [`pathExists()`](pathExists.md).
|
||||
22
node_modules/fs-extra/docs/pathExists.md
generated
vendored
Normal file
22
node_modules/fs-extra/docs/pathExists.md
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# pathExists(file[, callback])
|
||||
|
||||
Test whether or not the given path exists by checking with the file system. Like [`fs.exists`](https://nodejs.org/api/fs.html#fs_fs_exists_path_callback), but with a normal callback signature (err, exists). Uses `fs.access` under the hood.
|
||||
|
||||
- `file` `<String>`
|
||||
- `callback` `<Function>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const file = '/tmp/this/path/does/not/exist/file.txt'
|
||||
// Promise usage:
|
||||
fs.pathExists(file)
|
||||
.then(exists => console.log(exists)) // => false
|
||||
// Callback usage:
|
||||
fs.pathExists(file, (err, exists) => {
|
||||
console.log(err) // => null
|
||||
console.log(exists) // => false
|
||||
})
|
||||
```
|
||||
33
node_modules/fs-extra/docs/readJson-sync.md
generated
vendored
Normal file
33
node_modules/fs-extra/docs/readJson-sync.md
generated
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# readJsonSync(file, [options])
|
||||
|
||||
Reads a JSON file and then parses it into an object. `options` are the same
|
||||
that you'd pass to [`jsonFile.readFileSync`](https://github.com/jprichardson/node-jsonfile#readfilesyncfilename-options).
|
||||
|
||||
**Alias:** `readJSONSync()`
|
||||
|
||||
- `file` `<String>`
|
||||
- `options` `<Object>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const packageObj = fs.readJsonSync('./package.json')
|
||||
console.log(packageObj.version) // => 2.0.0
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
`readJsonSync()` can take a `throws` option set to `false` and it won't throw if the JSON is invalid. Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const file = '/tmp/some-invalid.json'
|
||||
const data = '{not valid JSON'
|
||||
fs.writeFileSync(file, data)
|
||||
|
||||
const obj = fs.readJsonSync(file, { throws: false })
|
||||
console.log(obj) // => null
|
||||
```
|
||||
58
node_modules/fs-extra/docs/readJson.md
generated
vendored
Normal file
58
node_modules/fs-extra/docs/readJson.md
generated
vendored
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
# readJson(file, [options, callback])
|
||||
|
||||
Reads a JSON file and then parses it into an object. `options` are the same
|
||||
that you'd pass to [`jsonFile.readFile`](https://github.com/jprichardson/node-jsonfile#readfilefilename-options-callback).
|
||||
|
||||
**Alias:** `readJSON()`
|
||||
|
||||
- `file` `<String>`
|
||||
- `options` `<Object>`
|
||||
- `callback` `<Function>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
fs.readJson('./package.json', (err, packageObj) => {
|
||||
if (err) console.error(err)
|
||||
|
||||
console.log(packageObj.version) // => 0.1.3
|
||||
})
|
||||
|
||||
// Promise Usage
|
||||
fs.readJson('./package.json')
|
||||
.then(packageObj => {
|
||||
console.log(packageObj.version) // => 0.1.3
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
`readJson()` can take a `throws` option set to `false` and it won't throw if the JSON is invalid. Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const file = '/tmp/some-invalid.json'
|
||||
const data = '{not valid JSON'
|
||||
fs.writeFileSync(file, data)
|
||||
|
||||
fs.readJson(file, { throws: false }, (err, obj) => {
|
||||
if (err) console.error(err)
|
||||
|
||||
console.log(obj) // => null
|
||||
})
|
||||
|
||||
// Promise Usage
|
||||
fs.readJson(file, { throws: false })
|
||||
.then(obj => {
|
||||
console.log(obj) // => null
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err) // Not called
|
||||
})
|
||||
```
|
||||
16
node_modules/fs-extra/docs/remove-sync.md
generated
vendored
Normal file
16
node_modules/fs-extra/docs/remove-sync.md
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# removeSync(path)
|
||||
|
||||
Removes a file or directory. The directory can have contents. Like `rm -rf`.
|
||||
|
||||
- `path` `<String>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
// remove file
|
||||
fs.removeSync('/tmp/myfile')
|
||||
|
||||
fs.removeSync('/home/jprichardson') // I just deleted my entire HOME directory.
|
||||
```
|
||||
34
node_modules/fs-extra/docs/remove.md
generated
vendored
Normal file
34
node_modules/fs-extra/docs/remove.md
generated
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
# remove(path, [callback])
|
||||
|
||||
Removes a file or directory. The directory can have contents. Like `rm -rf`.
|
||||
|
||||
- `path` `<String>`
|
||||
- `callback` `<Function>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
// remove file
|
||||
fs.remove('/tmp/myfile', err => {
|
||||
if (err) return console.error(err)
|
||||
|
||||
console.log('success!')
|
||||
})
|
||||
|
||||
fs.remove('/home/jprichardson', err => {
|
||||
if (err) return console.error(err)
|
||||
|
||||
console.log('success!') // I just deleted my entire HOME directory.
|
||||
})
|
||||
|
||||
// Promise Usage
|
||||
fs.remove('/tmp/myfile')
|
||||
.then(() => {
|
||||
console.log('success!')
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
24
node_modules/fs-extra/docs/writeJson-sync.md
generated
vendored
Normal file
24
node_modules/fs-extra/docs/writeJson-sync.md
generated
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# writeJsonSync(file, object, [options])
|
||||
|
||||
Writes an object to a JSON file.
|
||||
|
||||
**Alias:** `writeJSONSync()`
|
||||
|
||||
- `file` `<String>`
|
||||
- `object` `<Object>`
|
||||
- `options` `<Object>`
|
||||
- `spaces` `<Number|String>` Number of spaces to indent; or a string to use for indentation (i.e. pass `'\t'` for tab indentation). See [the docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_space_argument) for more info.
|
||||
- `EOL` `<String>` Set EOL character. Default is `\n`.
|
||||
- `replacer` [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_replacer_parameter)
|
||||
- Also accepts [`fs.writeFileSync` options](https://nodejs.org/api/fs.html#fs_fs_writefilesync_file_data_options)
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
fs.writeJsonSync('./package.json', {name: 'fs-extra'})
|
||||
```
|
||||
---
|
||||
|
||||
**See also:** [`outputJsonSync()`](outputJson-sync.md)
|
||||
39
node_modules/fs-extra/docs/writeJson.md
generated
vendored
Normal file
39
node_modules/fs-extra/docs/writeJson.md
generated
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
# writeJson(file, object, [options, callback])
|
||||
|
||||
Writes an object to a JSON file.
|
||||
|
||||
**Alias:** `writeJSON()`
|
||||
|
||||
- `file` `<String>`
|
||||
- `object` `<Object>`
|
||||
- `options` `<Object>`
|
||||
- `spaces` `<Number|String>` Number of spaces to indent; or a string to use for indentation (i.e. pass `'\t'` for tab indentation). See [the docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_space_argument) for more info.
|
||||
- `EOL` `<String>` Set EOL character. Default is `\n`.
|
||||
- `replacer` [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_replacer_parameter)
|
||||
- Also accepts [`fs.writeFile` options](https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback)
|
||||
- `callback` `<Function>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
fs.writeJson('./package.json', {name: 'fs-extra'}, err => {
|
||||
if (err) return console.error(err)
|
||||
|
||||
console.log('success!')
|
||||
})
|
||||
|
||||
// With Promises
|
||||
fs.writeJson('./package.json', {name: 'fs-extra'})
|
||||
.then(() => {
|
||||
console.log('success!')
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**See also:** [`outputJson()`](outputJson.md)
|
||||
41
node_modules/fs-extra/lib/copy-sync/copy-file-sync.js
generated
vendored
Normal file
41
node_modules/fs-extra/lib/copy-sync/copy-file-sync.js
generated
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
'use strict'
|
||||
|
||||
const fs = require('graceful-fs')
|
||||
|
||||
const BUF_LENGTH = 64 * 1024
|
||||
const _buff = require('../util/buffer')(BUF_LENGTH)
|
||||
|
||||
function copyFileSync (srcFile, destFile, options) {
|
||||
const overwrite = options.overwrite
|
||||
const errorOnExist = options.errorOnExist
|
||||
const preserveTimestamps = options.preserveTimestamps
|
||||
|
||||
if (fs.existsSync(destFile)) {
|
||||
if (overwrite) {
|
||||
fs.unlinkSync(destFile)
|
||||
} else if (errorOnExist) {
|
||||
throw new Error(`${destFile} already exists`)
|
||||
} else return
|
||||
}
|
||||
|
||||
const fdr = fs.openSync(srcFile, 'r')
|
||||
const stat = fs.fstatSync(fdr)
|
||||
const fdw = fs.openSync(destFile, 'w', stat.mode)
|
||||
let bytesRead = 1
|
||||
let pos = 0
|
||||
|
||||
while (bytesRead > 0) {
|
||||
bytesRead = fs.readSync(fdr, _buff, 0, BUF_LENGTH, pos)
|
||||
fs.writeSync(fdw, _buff, 0, bytesRead)
|
||||
pos += bytesRead
|
||||
}
|
||||
|
||||
if (preserveTimestamps) {
|
||||
fs.futimesSync(fdw, stat.atime, stat.mtime)
|
||||
}
|
||||
|
||||
fs.closeSync(fdr)
|
||||
fs.closeSync(fdw)
|
||||
}
|
||||
|
||||
module.exports = copyFileSync
|
||||
62
node_modules/fs-extra/lib/copy-sync/copy-sync.js
generated
vendored
Normal file
62
node_modules/fs-extra/lib/copy-sync/copy-sync.js
generated
vendored
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
'use strict'
|
||||
|
||||
const fs = require('graceful-fs')
|
||||
const path = require('path')
|
||||
const copyFileSync = require('./copy-file-sync')
|
||||
const mkdir = require('../mkdirs')
|
||||
|
||||
function copySync (src, dest, options) {
|
||||
if (typeof options === 'function' || options instanceof RegExp) {
|
||||
options = {filter: options}
|
||||
}
|
||||
|
||||
options = options || {}
|
||||
options.recursive = !!options.recursive
|
||||
|
||||
// default to true for now
|
||||
options.clobber = 'clobber' in options ? !!options.clobber : true
|
||||
// overwrite falls back to clobber
|
||||
options.overwrite = 'overwrite' in options ? !!options.overwrite : options.clobber
|
||||
options.dereference = 'dereference' in options ? !!options.dereference : false
|
||||
options.preserveTimestamps = 'preserveTimestamps' in options ? !!options.preserveTimestamps : false
|
||||
|
||||
options.filter = options.filter || function () { return true }
|
||||
|
||||
// Warn about using preserveTimestamps on 32-bit node:
|
||||
if (options.preserveTimestamps && process.arch === 'ia32') {
|
||||
console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n
|
||||
see https://github.com/jprichardson/node-fs-extra/issues/269`)
|
||||
}
|
||||
|
||||
const stats = (options.recursive && !options.dereference) ? fs.lstatSync(src) : fs.statSync(src)
|
||||
const destFolder = path.dirname(dest)
|
||||
const destFolderExists = fs.existsSync(destFolder)
|
||||
let performCopy = false
|
||||
|
||||
if (options.filter instanceof RegExp) {
|
||||
console.warn('Warning: fs-extra: Passing a RegExp filter is deprecated, use a function')
|
||||
performCopy = options.filter.test(src)
|
||||
} else if (typeof options.filter === 'function') performCopy = options.filter(src, dest)
|
||||
|
||||
if (stats.isFile() && performCopy) {
|
||||
if (!destFolderExists) mkdir.mkdirsSync(destFolder)
|
||||
copyFileSync(src, dest, {
|
||||
overwrite: options.overwrite,
|
||||
errorOnExist: options.errorOnExist,
|
||||
preserveTimestamps: options.preserveTimestamps
|
||||
})
|
||||
} else if (stats.isDirectory() && performCopy) {
|
||||
if (!fs.existsSync(dest)) mkdir.mkdirsSync(dest)
|
||||
const contents = fs.readdirSync(src)
|
||||
contents.forEach(content => {
|
||||
const opts = options
|
||||
opts.recursive = true
|
||||
copySync(path.join(src, content), path.join(dest, content), opts)
|
||||
})
|
||||
} else if (options.recursive && stats.isSymbolicLink() && performCopy) {
|
||||
const srcPath = fs.readlinkSync(src)
|
||||
fs.symlinkSync(srcPath, dest)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = copySync
|
||||
3
node_modules/fs-extra/lib/copy-sync/index.js
generated
vendored
Normal file
3
node_modules/fs-extra/lib/copy-sync/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
copySync: require('./copy-sync')
|
||||
}
|
||||
54
node_modules/fs-extra/lib/copy/copy.js
generated
vendored
Normal file
54
node_modules/fs-extra/lib/copy/copy.js
generated
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
'use strict'
|
||||
|
||||
const fs = require('graceful-fs')
|
||||
const path = require('path')
|
||||
const ncp = require('./ncp')
|
||||
const mkdir = require('../mkdirs')
|
||||
const pathExists = require('../path-exists').pathExists
|
||||
|
||||
function copy (src, dest, options, callback) {
|
||||
if (typeof options === 'function' && !callback) {
|
||||
callback = options
|
||||
options = {}
|
||||
} else if (typeof options === 'function' || options instanceof RegExp) {
|
||||
options = {filter: options}
|
||||
}
|
||||
callback = callback || function () {}
|
||||
options = options || {}
|
||||
|
||||
// Warn about using preserveTimestamps on 32-bit node:
|
||||
if (options.preserveTimestamps && process.arch === 'ia32') {
|
||||
console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n
|
||||
see https://github.com/jprichardson/node-fs-extra/issues/269`)
|
||||
}
|
||||
|
||||
// don't allow src and dest to be the same
|
||||
const basePath = process.cwd()
|
||||
const currentPath = path.resolve(basePath, src)
|
||||
const targetPath = path.resolve(basePath, dest)
|
||||
if (currentPath === targetPath) return callback(new Error('Source and destination must not be the same.'))
|
||||
|
||||
fs.lstat(src, (err, stats) => {
|
||||
if (err) return callback(err)
|
||||
|
||||
let dir = null
|
||||
if (stats.isDirectory()) {
|
||||
const parts = dest.split(path.sep)
|
||||
parts.pop()
|
||||
dir = parts.join(path.sep)
|
||||
} else {
|
||||
dir = path.dirname(dest)
|
||||
}
|
||||
|
||||
pathExists(dir, (err, dirExists) => {
|
||||
if (err) return callback(err)
|
||||
if (dirExists) return ncp(src, dest, options, callback)
|
||||
mkdir.mkdirs(dir, err => {
|
||||
if (err) return callback(err)
|
||||
ncp(src, dest, options, callback)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = copy
|
||||
4
node_modules/fs-extra/lib/copy/index.js
generated
vendored
Normal file
4
node_modules/fs-extra/lib/copy/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
const u = require('universalify').fromCallback
|
||||
module.exports = {
|
||||
copy: u(require('./copy'))
|
||||
}
|
||||
234
node_modules/fs-extra/lib/copy/ncp.js
generated
vendored
Normal file
234
node_modules/fs-extra/lib/copy/ncp.js
generated
vendored
Normal file
|
|
@ -0,0 +1,234 @@
|
|||
// imported from ncp (this is temporary, will rewrite)
|
||||
|
||||
var fs = require('graceful-fs')
|
||||
var path = require('path')
|
||||
var utimes = require('../util/utimes')
|
||||
|
||||
function ncp (source, dest, options, callback) {
|
||||
if (!callback) {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
|
||||
var basePath = process.cwd()
|
||||
var currentPath = path.resolve(basePath, source)
|
||||
var targetPath = path.resolve(basePath, dest)
|
||||
|
||||
var filter = options.filter
|
||||
var transform = options.transform
|
||||
var overwrite = options.overwrite
|
||||
// If overwrite is undefined, use clobber, otherwise default to true:
|
||||
if (overwrite === undefined) overwrite = options.clobber
|
||||
if (overwrite === undefined) overwrite = true
|
||||
var errorOnExist = options.errorOnExist
|
||||
var dereference = options.dereference
|
||||
var preserveTimestamps = options.preserveTimestamps === true
|
||||
|
||||
var started = 0
|
||||
var finished = 0
|
||||
var running = 0
|
||||
|
||||
var errored = false
|
||||
|
||||
startCopy(currentPath)
|
||||
|
||||
function startCopy (source) {
|
||||
started++
|
||||
if (filter) {
|
||||
if (filter instanceof RegExp) {
|
||||
console.warn('Warning: fs-extra: Passing a RegExp filter is deprecated, use a function')
|
||||
if (!filter.test(source)) {
|
||||
return doneOne(true)
|
||||
}
|
||||
} else if (typeof filter === 'function') {
|
||||
if (!filter(source, dest)) {
|
||||
return doneOne(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
return getStats(source)
|
||||
}
|
||||
|
||||
function getStats (source) {
|
||||
var stat = dereference ? fs.stat : fs.lstat
|
||||
running++
|
||||
stat(source, function (err, stats) {
|
||||
if (err) return onError(err)
|
||||
|
||||
// We need to get the mode from the stats object and preserve it.
|
||||
var item = {
|
||||
name: source,
|
||||
mode: stats.mode,
|
||||
mtime: stats.mtime, // modified time
|
||||
atime: stats.atime, // access time
|
||||
stats: stats // temporary
|
||||
}
|
||||
|
||||
if (stats.isDirectory()) {
|
||||
return onDir(item)
|
||||
} else if (stats.isFile() || stats.isCharacterDevice() || stats.isBlockDevice()) {
|
||||
return onFile(item)
|
||||
} else if (stats.isSymbolicLink()) {
|
||||
// Symlinks don't really need to know about the mode.
|
||||
return onLink(source)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function onFile (file) {
|
||||
var target = file.name.replace(currentPath, targetPath.replace('$', '$$$$')) // escapes '$' with '$$'
|
||||
isWritable(target, function (writable) {
|
||||
if (writable) {
|
||||
copyFile(file, target)
|
||||
} else {
|
||||
if (overwrite) {
|
||||
rmFile(target, function () {
|
||||
copyFile(file, target)
|
||||
})
|
||||
} else if (errorOnExist) {
|
||||
onError(new Error(target + ' already exists'))
|
||||
} else {
|
||||
doneOne()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function copyFile (file, target) {
|
||||
var readStream = fs.createReadStream(file.name)
|
||||
var writeStream = fs.createWriteStream(target, { mode: file.mode })
|
||||
|
||||
readStream.on('error', onError)
|
||||
writeStream.on('error', onError)
|
||||
|
||||
if (transform) {
|
||||
transform(readStream, writeStream, file)
|
||||
} else {
|
||||
writeStream.on('open', function () {
|
||||
readStream.pipe(writeStream)
|
||||
})
|
||||
}
|
||||
|
||||
writeStream.once('close', function () {
|
||||
fs.chmod(target, file.mode, function (err) {
|
||||
if (err) return onError(err)
|
||||
if (preserveTimestamps) {
|
||||
utimes.utimesMillis(target, file.atime, file.mtime, function (err) {
|
||||
if (err) return onError(err)
|
||||
return doneOne()
|
||||
})
|
||||
} else {
|
||||
doneOne()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function rmFile (file, done) {
|
||||
fs.unlink(file, function (err) {
|
||||
if (err) return onError(err)
|
||||
return done()
|
||||
})
|
||||
}
|
||||
|
||||
function onDir (dir) {
|
||||
var target = dir.name.replace(currentPath, targetPath.replace('$', '$$$$')) // escapes '$' with '$$'
|
||||
isWritable(target, function (writable) {
|
||||
if (writable) {
|
||||
return mkDir(dir, target)
|
||||
}
|
||||
copyDir(dir.name)
|
||||
})
|
||||
}
|
||||
|
||||
function mkDir (dir, target) {
|
||||
fs.mkdir(target, dir.mode, function (err) {
|
||||
if (err) return onError(err)
|
||||
// despite setting mode in fs.mkdir, doesn't seem to work
|
||||
// so we set it here.
|
||||
fs.chmod(target, dir.mode, function (err) {
|
||||
if (err) return onError(err)
|
||||
copyDir(dir.name)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function copyDir (dir) {
|
||||
fs.readdir(dir, function (err, items) {
|
||||
if (err) return onError(err)
|
||||
items.forEach(function (item) {
|
||||
startCopy(path.join(dir, item))
|
||||
})
|
||||
return doneOne()
|
||||
})
|
||||
}
|
||||
|
||||
function onLink (link) {
|
||||
var target = link.replace(currentPath, targetPath)
|
||||
fs.readlink(link, function (err, resolvedPath) {
|
||||
if (err) return onError(err)
|
||||
checkLink(resolvedPath, target)
|
||||
})
|
||||
}
|
||||
|
||||
function checkLink (resolvedPath, target) {
|
||||
if (dereference) {
|
||||
resolvedPath = path.resolve(basePath, resolvedPath)
|
||||
}
|
||||
isWritable(target, function (writable) {
|
||||
if (writable) {
|
||||
return makeLink(resolvedPath, target)
|
||||
}
|
||||
fs.readlink(target, function (err, targetDest) {
|
||||
if (err) return onError(err)
|
||||
|
||||
if (dereference) {
|
||||
targetDest = path.resolve(basePath, targetDest)
|
||||
}
|
||||
if (targetDest === resolvedPath) {
|
||||
return doneOne()
|
||||
}
|
||||
return rmFile(target, function () {
|
||||
makeLink(resolvedPath, target)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function makeLink (linkPath, target) {
|
||||
fs.symlink(linkPath, target, function (err) {
|
||||
if (err) return onError(err)
|
||||
return doneOne()
|
||||
})
|
||||
}
|
||||
|
||||
function isWritable (path, done) {
|
||||
fs.lstat(path, function (err) {
|
||||
if (err) {
|
||||
if (err.code === 'ENOENT') return done(true)
|
||||
return done(false)
|
||||
}
|
||||
return done(false)
|
||||
})
|
||||
}
|
||||
|
||||
function onError (err) {
|
||||
// ensure callback is defined & called only once:
|
||||
if (!errored && callback !== undefined) {
|
||||
errored = true
|
||||
return callback(err)
|
||||
}
|
||||
}
|
||||
|
||||
function doneOne (skipped) {
|
||||
if (!skipped) running--
|
||||
finished++
|
||||
if ((started === finished) && (running === 0)) {
|
||||
if (callback !== undefined) {
|
||||
return callback(null)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ncp
|
||||
48
node_modules/fs-extra/lib/empty/index.js
generated
vendored
Normal file
48
node_modules/fs-extra/lib/empty/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
'use strict'
|
||||
|
||||
const u = require('universalify').fromCallback
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const mkdir = require('../mkdirs')
|
||||
const remove = require('../remove')
|
||||
|
||||
const emptyDir = u(function emptyDir (dir, callback) {
|
||||
callback = callback || function () {}
|
||||
fs.readdir(dir, (err, items) => {
|
||||
if (err) return mkdir.mkdirs(dir, callback)
|
||||
|
||||
items = items.map(item => path.join(dir, item))
|
||||
|
||||
deleteItem()
|
||||
|
||||
function deleteItem () {
|
||||
const item = items.pop()
|
||||
if (!item) return callback()
|
||||
remove.remove(item, err => {
|
||||
if (err) return callback(err)
|
||||
deleteItem()
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
function emptyDirSync (dir) {
|
||||
let items
|
||||
try {
|
||||
items = fs.readdirSync(dir)
|
||||
} catch (err) {
|
||||
return mkdir.mkdirsSync(dir)
|
||||
}
|
||||
|
||||
items.forEach(item => {
|
||||
item = path.join(dir, item)
|
||||
remove.removeSync(item)
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
emptyDirSync,
|
||||
emptydirSync: emptyDirSync,
|
||||
emptyDir,
|
||||
emptydir: emptyDir
|
||||
}
|
||||
49
node_modules/fs-extra/lib/ensure/file.js
generated
vendored
Normal file
49
node_modules/fs-extra/lib/ensure/file.js
generated
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
'use strict'
|
||||
|
||||
const u = require('universalify').fromCallback
|
||||
const path = require('path')
|
||||
const fs = require('graceful-fs')
|
||||
const mkdir = require('../mkdirs')
|
||||
const pathExists = require('../path-exists').pathExists
|
||||
|
||||
function createFile (file, callback) {
|
||||
function makeFile () {
|
||||
fs.writeFile(file, '', err => {
|
||||
if (err) return callback(err)
|
||||
callback()
|
||||
})
|
||||
}
|
||||
|
||||
fs.stat(file, (err, stats) => { // eslint-disable-line handle-callback-err
|
||||
if (!err && stats.isFile()) return callback()
|
||||
const dir = path.dirname(file)
|
||||
pathExists(dir, (err, dirExists) => {
|
||||
if (err) return callback(err)
|
||||
if (dirExists) return makeFile()
|
||||
mkdir.mkdirs(dir, err => {
|
||||
if (err) return callback(err)
|
||||
makeFile()
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function createFileSync (file) {
|
||||
let stats
|
||||
try {
|
||||
stats = fs.statSync(file)
|
||||
} catch (e) {}
|
||||
if (stats && stats.isFile()) return
|
||||
|
||||
const dir = path.dirname(file)
|
||||
if (!fs.existsSync(dir)) {
|
||||
mkdir.mkdirsSync(dir)
|
||||
}
|
||||
|
||||
fs.writeFileSync(file, '')
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
createFile: u(createFile),
|
||||
createFileSync
|
||||
}
|
||||
23
node_modules/fs-extra/lib/ensure/index.js
generated
vendored
Normal file
23
node_modules/fs-extra/lib/ensure/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
'use strict'
|
||||
|
||||
const file = require('./file')
|
||||
const link = require('./link')
|
||||
const symlink = require('./symlink')
|
||||
|
||||
module.exports = {
|
||||
// file
|
||||
createFile: file.createFile,
|
||||
createFileSync: file.createFileSync,
|
||||
ensureFile: file.createFile,
|
||||
ensureFileSync: file.createFileSync,
|
||||
// link
|
||||
createLink: link.createLink,
|
||||
createLinkSync: link.createLinkSync,
|
||||
ensureLink: link.createLink,
|
||||
ensureLinkSync: link.createLinkSync,
|
||||
// symlink
|
||||
createSymlink: symlink.createSymlink,
|
||||
createSymlinkSync: symlink.createSymlinkSync,
|
||||
ensureSymlink: symlink.createSymlink,
|
||||
ensureSymlinkSync: symlink.createSymlinkSync
|
||||
}
|
||||
61
node_modules/fs-extra/lib/ensure/link.js
generated
vendored
Normal file
61
node_modules/fs-extra/lib/ensure/link.js
generated
vendored
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
'use strict'
|
||||
|
||||
const u = require('universalify').fromCallback
|
||||
const path = require('path')
|
||||
const fs = require('graceful-fs')
|
||||
const mkdir = require('../mkdirs')
|
||||
const pathExists = require('../path-exists').pathExists
|
||||
|
||||
function createLink (srcpath, dstpath, callback) {
|
||||
function makeLink (srcpath, dstpath) {
|
||||
fs.link(srcpath, dstpath, err => {
|
||||
if (err) return callback(err)
|
||||
callback(null)
|
||||
})
|
||||
}
|
||||
|
||||
pathExists(dstpath, (err, destinationExists) => {
|
||||
if (err) return callback(err)
|
||||
if (destinationExists) return callback(null)
|
||||
fs.lstat(srcpath, (err, stat) => {
|
||||
if (err) {
|
||||
err.message = err.message.replace('lstat', 'ensureLink')
|
||||
return callback(err)
|
||||
}
|
||||
|
||||
const dir = path.dirname(dstpath)
|
||||
pathExists(dir, (err, dirExists) => {
|
||||
if (err) return callback(err)
|
||||
if (dirExists) return makeLink(srcpath, dstpath)
|
||||
mkdir.mkdirs(dir, err => {
|
||||
if (err) return callback(err)
|
||||
makeLink(srcpath, dstpath)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function createLinkSync (srcpath, dstpath, callback) {
|
||||
const destinationExists = fs.existsSync(dstpath)
|
||||
if (destinationExists) return undefined
|
||||
|
||||
try {
|
||||
fs.lstatSync(srcpath)
|
||||
} catch (err) {
|
||||
err.message = err.message.replace('lstat', 'ensureLink')
|
||||
throw err
|
||||
}
|
||||
|
||||
const dir = path.dirname(dstpath)
|
||||
const dirExists = fs.existsSync(dir)
|
||||
if (dirExists) return fs.linkSync(srcpath, dstpath)
|
||||
mkdir.mkdirsSync(dir)
|
||||
|
||||
return fs.linkSync(srcpath, dstpath)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
createLink: u(createLink),
|
||||
createLinkSync
|
||||
}
|
||||
99
node_modules/fs-extra/lib/ensure/symlink-paths.js
generated
vendored
Normal file
99
node_modules/fs-extra/lib/ensure/symlink-paths.js
generated
vendored
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
'use strict'
|
||||
|
||||
const path = require('path')
|
||||
const fs = require('graceful-fs')
|
||||
const pathExists = require('../path-exists').pathExists
|
||||
|
||||
/**
|
||||
* Function that returns two types of paths, one relative to symlink, and one
|
||||
* relative to the current working directory. Checks if path is absolute or
|
||||
* relative. If the path is relative, this function checks if the path is
|
||||
* relative to symlink or relative to current working directory. This is an
|
||||
* initiative to find a smarter `srcpath` to supply when building symlinks.
|
||||
* This allows you to determine which path to use out of one of three possible
|
||||
* types of source paths. The first is an absolute path. This is detected by
|
||||
* `path.isAbsolute()`. When an absolute path is provided, it is checked to
|
||||
* see if it exists. If it does it's used, if not an error is returned
|
||||
* (callback)/ thrown (sync). The other two options for `srcpath` are a
|
||||
* relative url. By default Node's `fs.symlink` works by creating a symlink
|
||||
* using `dstpath` and expects the `srcpath` to be relative to the newly
|
||||
* created symlink. If you provide a `srcpath` that does not exist on the file
|
||||
* system it results in a broken symlink. To minimize this, the function
|
||||
* checks to see if the 'relative to symlink' source file exists, and if it
|
||||
* does it will use it. If it does not, it checks if there's a file that
|
||||
* exists that is relative to the current working directory, if does its used.
|
||||
* This preserves the expectations of the original fs.symlink spec and adds
|
||||
* the ability to pass in `relative to current working direcotry` paths.
|
||||
*/
|
||||
|
||||
function symlinkPaths (srcpath, dstpath, callback) {
|
||||
if (path.isAbsolute(srcpath)) {
|
||||
return fs.lstat(srcpath, (err, stat) => {
|
||||
if (err) {
|
||||
err.message = err.message.replace('lstat', 'ensureSymlink')
|
||||
return callback(err)
|
||||
}
|
||||
return callback(null, {
|
||||
'toCwd': srcpath,
|
||||
'toDst': srcpath
|
||||
})
|
||||
})
|
||||
} else {
|
||||
const dstdir = path.dirname(dstpath)
|
||||
const relativeToDst = path.join(dstdir, srcpath)
|
||||
return pathExists(relativeToDst, (err, exists) => {
|
||||
if (err) return callback(err)
|
||||
if (exists) {
|
||||
return callback(null, {
|
||||
'toCwd': relativeToDst,
|
||||
'toDst': srcpath
|
||||
})
|
||||
} else {
|
||||
return fs.lstat(srcpath, (err, stat) => {
|
||||
if (err) {
|
||||
err.message = err.message.replace('lstat', 'ensureSymlink')
|
||||
return callback(err)
|
||||
}
|
||||
return callback(null, {
|
||||
'toCwd': srcpath,
|
||||
'toDst': path.relative(dstdir, srcpath)
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function symlinkPathsSync (srcpath, dstpath) {
|
||||
let exists
|
||||
if (path.isAbsolute(srcpath)) {
|
||||
exists = fs.existsSync(srcpath)
|
||||
if (!exists) throw new Error('absolute srcpath does not exist')
|
||||
return {
|
||||
'toCwd': srcpath,
|
||||
'toDst': srcpath
|
||||
}
|
||||
} else {
|
||||
const dstdir = path.dirname(dstpath)
|
||||
const relativeToDst = path.join(dstdir, srcpath)
|
||||
exists = fs.existsSync(relativeToDst)
|
||||
if (exists) {
|
||||
return {
|
||||
'toCwd': relativeToDst,
|
||||
'toDst': srcpath
|
||||
}
|
||||
} else {
|
||||
exists = fs.existsSync(srcpath)
|
||||
if (!exists) throw new Error('relative srcpath does not exist')
|
||||
return {
|
||||
'toCwd': srcpath,
|
||||
'toDst': path.relative(dstdir, srcpath)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
symlinkPaths,
|
||||
symlinkPathsSync
|
||||
}
|
||||
31
node_modules/fs-extra/lib/ensure/symlink-type.js
generated
vendored
Normal file
31
node_modules/fs-extra/lib/ensure/symlink-type.js
generated
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
'use strict'
|
||||
|
||||
const fs = require('graceful-fs')
|
||||
|
||||
function symlinkType (srcpath, type, callback) {
|
||||
callback = (typeof type === 'function') ? type : callback
|
||||
type = (typeof type === 'function') ? false : type
|
||||
if (type) return callback(null, type)
|
||||
fs.lstat(srcpath, (err, stats) => {
|
||||
if (err) return callback(null, 'file')
|
||||
type = (stats && stats.isDirectory()) ? 'dir' : 'file'
|
||||
callback(null, type)
|
||||
})
|
||||
}
|
||||
|
||||
function symlinkTypeSync (srcpath, type) {
|
||||
let stats
|
||||
|
||||
if (type) return type
|
||||
try {
|
||||
stats = fs.lstatSync(srcpath)
|
||||
} catch (e) {
|
||||
return 'file'
|
||||
}
|
||||
return (stats && stats.isDirectory()) ? 'dir' : 'file'
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
symlinkType,
|
||||
symlinkTypeSync
|
||||
}
|
||||
66
node_modules/fs-extra/lib/ensure/symlink.js
generated
vendored
Normal file
66
node_modules/fs-extra/lib/ensure/symlink.js
generated
vendored
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
'use strict'
|
||||
|
||||
const u = require('universalify').fromCallback
|
||||
const path = require('path')
|
||||
const fs = require('graceful-fs')
|
||||
const _mkdirs = require('../mkdirs')
|
||||
const mkdirs = _mkdirs.mkdirs
|
||||
const mkdirsSync = _mkdirs.mkdirsSync
|
||||
|
||||
const _symlinkPaths = require('./symlink-paths')
|
||||
const symlinkPaths = _symlinkPaths.symlinkPaths
|
||||
const symlinkPathsSync = _symlinkPaths.symlinkPathsSync
|
||||
|
||||
const _symlinkType = require('./symlink-type')
|
||||
const symlinkType = _symlinkType.symlinkType
|
||||
const symlinkTypeSync = _symlinkType.symlinkTypeSync
|
||||
|
||||
const pathExists = require('../path-exists').pathExists
|
||||
|
||||
function createSymlink (srcpath, dstpath, type, callback) {
|
||||
callback = (typeof type === 'function') ? type : callback
|
||||
type = (typeof type === 'function') ? false : type
|
||||
|
||||
pathExists(dstpath, (err, destinationExists) => {
|
||||
if (err) return callback(err)
|
||||
if (destinationExists) return callback(null)
|
||||
symlinkPaths(srcpath, dstpath, (err, relative) => {
|
||||
if (err) return callback(err)
|
||||
srcpath = relative.toDst
|
||||
symlinkType(relative.toCwd, type, (err, type) => {
|
||||
if (err) return callback(err)
|
||||
const dir = path.dirname(dstpath)
|
||||
pathExists(dir, (err, dirExists) => {
|
||||
if (err) return callback(err)
|
||||
if (dirExists) return fs.symlink(srcpath, dstpath, type, callback)
|
||||
mkdirs(dir, err => {
|
||||
if (err) return callback(err)
|
||||
fs.symlink(srcpath, dstpath, type, callback)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function createSymlinkSync (srcpath, dstpath, type, callback) {
|
||||
callback = (typeof type === 'function') ? type : callback
|
||||
type = (typeof type === 'function') ? false : type
|
||||
|
||||
const destinationExists = fs.existsSync(dstpath)
|
||||
if (destinationExists) return undefined
|
||||
|
||||
const relative = symlinkPathsSync(srcpath, dstpath)
|
||||
srcpath = relative.toDst
|
||||
type = symlinkTypeSync(relative.toCwd, type)
|
||||
const dir = path.dirname(dstpath)
|
||||
const exists = fs.existsSync(dir)
|
||||
if (exists) return fs.symlinkSync(srcpath, dstpath, type)
|
||||
mkdirsSync(dir)
|
||||
return fs.symlinkSync(srcpath, dstpath, type)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
createSymlink: u(createSymlink),
|
||||
createSymlinkSync
|
||||
}
|
||||
107
node_modules/fs-extra/lib/fs/index.js
generated
vendored
Normal file
107
node_modules/fs-extra/lib/fs/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
// This is adapted from https://github.com/normalize/mz
|
||||
// Copyright (c) 2014-2016 Jonathan Ong me@jongleberry.com and Contributors
|
||||
const u = require('universalify').fromCallback
|
||||
const fs = require('graceful-fs')
|
||||
|
||||
const api = [
|
||||
'access',
|
||||
'appendFile',
|
||||
'chmod',
|
||||
'chown',
|
||||
'close',
|
||||
'copyFile',
|
||||
'fchmod',
|
||||
'fchown',
|
||||
'fdatasync',
|
||||
'fstat',
|
||||
'fsync',
|
||||
'ftruncate',
|
||||
'futimes',
|
||||
'lchown',
|
||||
'link',
|
||||
'lstat',
|
||||
'mkdir',
|
||||
'mkdtemp',
|
||||
'open',
|
||||
'readFile',
|
||||
'readdir',
|
||||
'readlink',
|
||||
'realpath',
|
||||
'rename',
|
||||
'rmdir',
|
||||
'stat',
|
||||
'symlink',
|
||||
'truncate',
|
||||
'unlink',
|
||||
'utimes',
|
||||
'writeFile'
|
||||
].filter(key => {
|
||||
// Some commands are not available on some systems. Ex:
|
||||
// fs.copyFile was added in Node.js v8.5.0
|
||||
// fs.mkdtemp was added in Node.js v5.10.0
|
||||
// fs.lchown is not available on at least some Linux
|
||||
return typeof fs[key] === 'function'
|
||||
})
|
||||
|
||||
// Export all keys:
|
||||
Object.keys(fs).forEach(key => {
|
||||
exports[key] = fs[key]
|
||||
})
|
||||
|
||||
// Universalify async methods:
|
||||
api.forEach(method => {
|
||||
exports[method] = u(fs[method])
|
||||
})
|
||||
|
||||
// We differ from mz/fs in that we still ship the old, broken, fs.exists()
|
||||
// since we are a drop-in replacement for the native module
|
||||
exports.exists = function (filename, callback) {
|
||||
if (typeof callback === 'function') {
|
||||
return fs.exists(filename, callback)
|
||||
}
|
||||
return new Promise(resolve => {
|
||||
return fs.exists(filename, resolve)
|
||||
})
|
||||
}
|
||||
|
||||
// fs.read() & fs.write need special treatment due to multiple callback args
|
||||
|
||||
exports.read = function (fd, buffer, offset, length, position, callback) {
|
||||
if (typeof callback === 'function') {
|
||||
return fs.read(fd, buffer, offset, length, position, callback)
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer) => {
|
||||
if (err) return reject(err)
|
||||
resolve({ bytesRead, buffer })
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// Function signature can be
|
||||
// fs.write(fd, buffer[, offset[, length[, position]]], callback)
|
||||
// OR
|
||||
// fs.write(fd, string[, position[, encoding]], callback)
|
||||
// so we need to handle both cases
|
||||
exports.write = function (fd, buffer, a, b, c, callback) {
|
||||
if (typeof arguments[arguments.length - 1] === 'function') {
|
||||
return fs.write(fd, buffer, a, b, c, callback)
|
||||
}
|
||||
|
||||
// Check for old, depricated fs.write(fd, string[, position[, encoding]], callback)
|
||||
if (typeof buffer === 'string') {
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.write(fd, buffer, a, b, (err, bytesWritten, buffer) => {
|
||||
if (err) return reject(err)
|
||||
resolve({ bytesWritten, buffer })
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.write(fd, buffer, a, b, c, (err, bytesWritten, buffer) => {
|
||||
if (err) return reject(err)
|
||||
resolve({ bytesWritten, buffer })
|
||||
})
|
||||
})
|
||||
}
|
||||
22
node_modules/fs-extra/lib/index.js
generated
vendored
Normal file
22
node_modules/fs-extra/lib/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
'use strict'
|
||||
|
||||
const assign = require('./util/assign')
|
||||
|
||||
const fs = {}
|
||||
|
||||
// Export graceful-fs:
|
||||
assign(fs, require('./fs'))
|
||||
// Export extra methods:
|
||||
assign(fs, require('./copy'))
|
||||
assign(fs, require('./copy-sync'))
|
||||
assign(fs, require('./mkdirs'))
|
||||
assign(fs, require('./remove'))
|
||||
assign(fs, require('./json'))
|
||||
assign(fs, require('./move'))
|
||||
assign(fs, require('./move-sync'))
|
||||
assign(fs, require('./empty'))
|
||||
assign(fs, require('./ensure'))
|
||||
assign(fs, require('./output'))
|
||||
assign(fs, require('./path-exists'))
|
||||
|
||||
module.exports = fs
|
||||
16
node_modules/fs-extra/lib/json/index.js
generated
vendored
Normal file
16
node_modules/fs-extra/lib/json/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
'use strict'
|
||||
|
||||
const u = require('universalify').fromCallback
|
||||
const jsonFile = require('./jsonfile')
|
||||
|
||||
jsonFile.outputJson = u(require('./output-json'))
|
||||
jsonFile.outputJsonSync = require('./output-json-sync')
|
||||
// aliases
|
||||
jsonFile.outputJSON = jsonFile.outputJson
|
||||
jsonFile.outputJSONSync = jsonFile.outputJsonSync
|
||||
jsonFile.writeJSON = jsonFile.writeJson
|
||||
jsonFile.writeJSONSync = jsonFile.writeJsonSync
|
||||
jsonFile.readJSON = jsonFile.readJson
|
||||
jsonFile.readJSONSync = jsonFile.readJsonSync
|
||||
|
||||
module.exports = jsonFile
|
||||
12
node_modules/fs-extra/lib/json/jsonfile.js
generated
vendored
Normal file
12
node_modules/fs-extra/lib/json/jsonfile.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
'use strict'
|
||||
|
||||
const u = require('universalify').fromCallback
|
||||
const jsonFile = require('jsonfile')
|
||||
|
||||
module.exports = {
|
||||
// jsonfile exports
|
||||
readJson: u(jsonFile.readFile),
|
||||
readJsonSync: jsonFile.readFileSync,
|
||||
writeJson: u(jsonFile.writeFile),
|
||||
writeJsonSync: jsonFile.writeFileSync
|
||||
}
|
||||
18
node_modules/fs-extra/lib/json/output-json-sync.js
generated
vendored
Normal file
18
node_modules/fs-extra/lib/json/output-json-sync.js
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
'use strict'
|
||||
|
||||
const fs = require('graceful-fs')
|
||||
const path = require('path')
|
||||
const mkdir = require('../mkdirs')
|
||||
const jsonFile = require('./jsonfile')
|
||||
|
||||
function outputJsonSync (file, data, options) {
|
||||
const dir = path.dirname(file)
|
||||
|
||||
if (!fs.existsSync(dir)) {
|
||||
mkdir.mkdirsSync(dir)
|
||||
}
|
||||
|
||||
jsonFile.writeJsonSync(file, data, options)
|
||||
}
|
||||
|
||||
module.exports = outputJsonSync
|
||||
27
node_modules/fs-extra/lib/json/output-json.js
generated
vendored
Normal file
27
node_modules/fs-extra/lib/json/output-json.js
generated
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
'use strict'
|
||||
|
||||
const path = require('path')
|
||||
const mkdir = require('../mkdirs')
|
||||
const pathExists = require('../path-exists').pathExists
|
||||
const jsonFile = require('./jsonfile')
|
||||
|
||||
function outputJson (file, data, options, callback) {
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
|
||||
const dir = path.dirname(file)
|
||||
|
||||
pathExists(dir, (err, itDoes) => {
|
||||
if (err) return callback(err)
|
||||
if (itDoes) return jsonFile.writeJson(file, data, options, callback)
|
||||
|
||||
mkdir.mkdirs(dir, err => {
|
||||
if (err) return callback(err)
|
||||
jsonFile.writeJson(file, data, options, callback)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = outputJson
|
||||
14
node_modules/fs-extra/lib/mkdirs/index.js
generated
vendored
Normal file
14
node_modules/fs-extra/lib/mkdirs/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
'use strict'
|
||||
const u = require('universalify').fromCallback
|
||||
const mkdirs = u(require('./mkdirs'))
|
||||
const mkdirsSync = require('./mkdirs-sync')
|
||||
|
||||
module.exports = {
|
||||
mkdirs: mkdirs,
|
||||
mkdirsSync: mkdirsSync,
|
||||
// alias
|
||||
mkdirp: mkdirs,
|
||||
mkdirpSync: mkdirsSync,
|
||||
ensureDir: mkdirs,
|
||||
ensureDirSync: mkdirsSync
|
||||
}
|
||||
59
node_modules/fs-extra/lib/mkdirs/mkdirs-sync.js
generated
vendored
Normal file
59
node_modules/fs-extra/lib/mkdirs/mkdirs-sync.js
generated
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
'use strict'
|
||||
|
||||
const fs = require('graceful-fs')
|
||||
const path = require('path')
|
||||
const invalidWin32Path = require('./win32').invalidWin32Path
|
||||
|
||||
const o777 = parseInt('0777', 8)
|
||||
|
||||
function mkdirsSync (p, opts, made) {
|
||||
if (!opts || typeof opts !== 'object') {
|
||||
opts = { mode: opts }
|
||||
}
|
||||
|
||||
let mode = opts.mode
|
||||
const xfs = opts.fs || fs
|
||||
|
||||
if (process.platform === 'win32' && invalidWin32Path(p)) {
|
||||
const errInval = new Error(p + ' contains invalid WIN32 path characters.')
|
||||
errInval.code = 'EINVAL'
|
||||
throw errInval
|
||||
}
|
||||
|
||||
if (mode === undefined) {
|
||||
mode = o777 & (~process.umask())
|
||||
}
|
||||
if (!made) made = null
|
||||
|
||||
p = path.resolve(p)
|
||||
|
||||
try {
|
||||
xfs.mkdirSync(p, mode)
|
||||
made = made || p
|
||||
} catch (err0) {
|
||||
switch (err0.code) {
|
||||
case 'ENOENT':
|
||||
if (path.dirname(p) === p) throw err0
|
||||
made = mkdirsSync(path.dirname(p), opts, made)
|
||||
mkdirsSync(p, opts, made)
|
||||
break
|
||||
|
||||
// In the case of any other error, just see if there's a dir
|
||||
// there already. If so, then hooray! If not, then something
|
||||
// is borked.
|
||||
default:
|
||||
let stat
|
||||
try {
|
||||
stat = xfs.statSync(p)
|
||||
} catch (err1) {
|
||||
throw err0
|
||||
}
|
||||
if (!stat.isDirectory()) throw err0
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return made
|
||||
}
|
||||
|
||||
module.exports = mkdirsSync
|
||||
63
node_modules/fs-extra/lib/mkdirs/mkdirs.js
generated
vendored
Normal file
63
node_modules/fs-extra/lib/mkdirs/mkdirs.js
generated
vendored
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
'use strict'
|
||||
|
||||
const fs = require('graceful-fs')
|
||||
const path = require('path')
|
||||
const invalidWin32Path = require('./win32').invalidWin32Path
|
||||
|
||||
const o777 = parseInt('0777', 8)
|
||||
|
||||
function mkdirs (p, opts, callback, made) {
|
||||
if (typeof opts === 'function') {
|
||||
callback = opts
|
||||
opts = {}
|
||||
} else if (!opts || typeof opts !== 'object') {
|
||||
opts = { mode: opts }
|
||||
}
|
||||
|
||||
if (process.platform === 'win32' && invalidWin32Path(p)) {
|
||||
const errInval = new Error(p + ' contains invalid WIN32 path characters.')
|
||||
errInval.code = 'EINVAL'
|
||||
return callback(errInval)
|
||||
}
|
||||
|
||||
let mode = opts.mode
|
||||
const xfs = opts.fs || fs
|
||||
|
||||
if (mode === undefined) {
|
||||
mode = o777 & (~process.umask())
|
||||
}
|
||||
if (!made) made = null
|
||||
|
||||
callback = callback || function () {}
|
||||
p = path.resolve(p)
|
||||
|
||||
xfs.mkdir(p, mode, er => {
|
||||
if (!er) {
|
||||
made = made || p
|
||||
return callback(null, made)
|
||||
}
|
||||
switch (er.code) {
|
||||
case 'ENOENT':
|
||||
if (path.dirname(p) === p) return callback(er)
|
||||
mkdirs(path.dirname(p), opts, (er, made) => {
|
||||
if (er) callback(er, made)
|
||||
else mkdirs(p, opts, callback, made)
|
||||
})
|
||||
break
|
||||
|
||||
// In the case of any other error, just see if there's a dir
|
||||
// there already. If so, then hooray! If not, then something
|
||||
// is borked.
|
||||
default:
|
||||
xfs.stat(p, (er2, stat) => {
|
||||
// if the stat fails, then that's super weird.
|
||||
// let the original error be the failure reason.
|
||||
if (er2 || !stat.isDirectory()) callback(er, made)
|
||||
else callback(null, made)
|
||||
})
|
||||
break
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = mkdirs
|
||||
25
node_modules/fs-extra/lib/mkdirs/win32.js
generated
vendored
Normal file
25
node_modules/fs-extra/lib/mkdirs/win32.js
generated
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
'use strict'
|
||||
|
||||
const path = require('path')
|
||||
|
||||
// get drive on windows
|
||||
function getRootPath (p) {
|
||||
p = path.normalize(path.resolve(p)).split(path.sep)
|
||||
if (p.length > 0) return p[0]
|
||||
return null
|
||||
}
|
||||
|
||||
// http://stackoverflow.com/a/62888/10333 contains more accurate
|
||||
// TODO: expand to include the rest
|
||||
const INVALID_PATH_CHARS = /[<>:"|?*]/
|
||||
|
||||
function invalidWin32Path (p) {
|
||||
const rp = getRootPath(p)
|
||||
p = p.replace(rp, '')
|
||||
return INVALID_PATH_CHARS.test(p)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getRootPath,
|
||||
invalidWin32Path
|
||||
}
|
||||
118
node_modules/fs-extra/lib/move-sync/index.js
generated
vendored
Normal file
118
node_modules/fs-extra/lib/move-sync/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
'use strict'
|
||||
|
||||
const fs = require('graceful-fs')
|
||||
const path = require('path')
|
||||
const copySync = require('../copy-sync').copySync
|
||||
const removeSync = require('../remove').removeSync
|
||||
const mkdirpSync = require('../mkdirs').mkdirsSync
|
||||
const buffer = require('../util/buffer')
|
||||
|
||||
function moveSync (src, dest, options) {
|
||||
options = options || {}
|
||||
const overwrite = options.overwrite || options.clobber || false
|
||||
|
||||
src = path.resolve(src)
|
||||
dest = path.resolve(dest)
|
||||
|
||||
if (src === dest) return fs.accessSync(src)
|
||||
|
||||
if (isSrcSubdir(src, dest)) throw new Error(`Cannot move '${src}' into itself '${dest}'.`)
|
||||
|
||||
mkdirpSync(path.dirname(dest))
|
||||
tryRenameSync()
|
||||
|
||||
function tryRenameSync () {
|
||||
if (overwrite) {
|
||||
try {
|
||||
return fs.renameSync(src, dest)
|
||||
} catch (err) {
|
||||
if (err.code === 'ENOTEMPTY' || err.code === 'EEXIST' || err.code === 'EPERM') {
|
||||
removeSync(dest)
|
||||
options.overwrite = false // just overwriteed it, no need to do it again
|
||||
return moveSync(src, dest, options)
|
||||
}
|
||||
|
||||
if (err.code !== 'EXDEV') throw err
|
||||
return moveSyncAcrossDevice(src, dest, overwrite)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
fs.linkSync(src, dest)
|
||||
return fs.unlinkSync(src)
|
||||
} catch (err) {
|
||||
if (err.code === 'EXDEV' || err.code === 'EISDIR' || err.code === 'EPERM' || err.code === 'ENOTSUP') {
|
||||
return moveSyncAcrossDevice(src, dest, overwrite)
|
||||
}
|
||||
throw err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function moveSyncAcrossDevice (src, dest, overwrite) {
|
||||
const stat = fs.statSync(src)
|
||||
|
||||
if (stat.isDirectory()) {
|
||||
return moveDirSyncAcrossDevice(src, dest, overwrite)
|
||||
} else {
|
||||
return moveFileSyncAcrossDevice(src, dest, overwrite)
|
||||
}
|
||||
}
|
||||
|
||||
function moveFileSyncAcrossDevice (src, dest, overwrite) {
|
||||
const BUF_LENGTH = 64 * 1024
|
||||
const _buff = buffer(BUF_LENGTH)
|
||||
|
||||
const flags = overwrite ? 'w' : 'wx'
|
||||
|
||||
const fdr = fs.openSync(src, 'r')
|
||||
const stat = fs.fstatSync(fdr)
|
||||
const fdw = fs.openSync(dest, flags, stat.mode)
|
||||
let bytesRead = 1
|
||||
let pos = 0
|
||||
|
||||
while (bytesRead > 0) {
|
||||
bytesRead = fs.readSync(fdr, _buff, 0, BUF_LENGTH, pos)
|
||||
fs.writeSync(fdw, _buff, 0, bytesRead)
|
||||
pos += bytesRead
|
||||
}
|
||||
|
||||
fs.closeSync(fdr)
|
||||
fs.closeSync(fdw)
|
||||
return fs.unlinkSync(src)
|
||||
}
|
||||
|
||||
function moveDirSyncAcrossDevice (src, dest, overwrite) {
|
||||
const options = {
|
||||
overwrite: false
|
||||
}
|
||||
|
||||
if (overwrite) {
|
||||
removeSync(dest)
|
||||
tryCopySync()
|
||||
} else {
|
||||
tryCopySync()
|
||||
}
|
||||
|
||||
function tryCopySync () {
|
||||
copySync(src, dest, options)
|
||||
return removeSync(src)
|
||||
}
|
||||
}
|
||||
|
||||
// return true if dest is a subdir of src, otherwise false.
|
||||
// extract dest base dir and check if that is the same as src basename
|
||||
function isSrcSubdir (src, dest) {
|
||||
try {
|
||||
return fs.statSync(src).isDirectory() &&
|
||||
src !== dest &&
|
||||
dest.indexOf(src) > -1 &&
|
||||
dest.split(path.dirname(src) + path.sep)[1].split(path.sep)[0] === path.basename(src)
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
moveSync
|
||||
}
|
||||
170
node_modules/fs-extra/lib/move/index.js
generated
vendored
Normal file
170
node_modules/fs-extra/lib/move/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
'use strict'
|
||||
|
||||
// most of this code was written by Andrew Kelley
|
||||
// licensed under the BSD license: see
|
||||
// https://github.com/andrewrk/node-mv/blob/master/package.json
|
||||
|
||||
// this needs a cleanup
|
||||
|
||||
const u = require('universalify').fromCallback
|
||||
const fs = require('graceful-fs')
|
||||
const ncp = require('../copy/ncp')
|
||||
const path = require('path')
|
||||
const remove = require('../remove').remove
|
||||
const mkdirp = require('../mkdirs').mkdirs
|
||||
|
||||
function move (src, dest, options, callback) {
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
|
||||
const overwrite = options.overwrite || options.clobber || false
|
||||
|
||||
isSrcSubdir(src, dest, (err, itIs) => {
|
||||
if (err) return callback(err)
|
||||
if (itIs) return callback(new Error(`Cannot move '${src}' to a subdirectory of itself, '${dest}'.`))
|
||||
mkdirp(path.dirname(dest), err => {
|
||||
if (err) return callback(err)
|
||||
doRename()
|
||||
})
|
||||
})
|
||||
|
||||
function doRename () {
|
||||
if (path.resolve(src) === path.resolve(dest)) {
|
||||
fs.access(src, callback)
|
||||
} else if (overwrite) {
|
||||
fs.rename(src, dest, err => {
|
||||
if (!err) return callback()
|
||||
|
||||
if (err.code === 'ENOTEMPTY' || err.code === 'EEXIST') {
|
||||
remove(dest, err => {
|
||||
if (err) return callback(err)
|
||||
options.overwrite = false // just overwriteed it, no need to do it again
|
||||
move(src, dest, options, callback)
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// weird Windows shit
|
||||
if (err.code === 'EPERM') {
|
||||
setTimeout(() => {
|
||||
remove(dest, err => {
|
||||
if (err) return callback(err)
|
||||
options.overwrite = false
|
||||
move(src, dest, options, callback)
|
||||
})
|
||||
}, 200)
|
||||
return
|
||||
}
|
||||
|
||||
if (err.code !== 'EXDEV') return callback(err)
|
||||
moveAcrossDevice(src, dest, overwrite, callback)
|
||||
})
|
||||
} else {
|
||||
fs.link(src, dest, err => {
|
||||
if (err) {
|
||||
if (err.code === 'EXDEV' || err.code === 'EISDIR' || err.code === 'EPERM' || err.code === 'ENOTSUP') {
|
||||
return moveAcrossDevice(src, dest, overwrite, callback)
|
||||
}
|
||||
return callback(err)
|
||||
}
|
||||
return fs.unlink(src, callback)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function moveAcrossDevice (src, dest, overwrite, callback) {
|
||||
fs.stat(src, (err, stat) => {
|
||||
if (err) return callback(err)
|
||||
|
||||
if (stat.isDirectory()) {
|
||||
moveDirAcrossDevice(src, dest, overwrite, callback)
|
||||
} else {
|
||||
moveFileAcrossDevice(src, dest, overwrite, callback)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function moveFileAcrossDevice (src, dest, overwrite, callback) {
|
||||
const flags = overwrite ? 'w' : 'wx'
|
||||
const ins = fs.createReadStream(src)
|
||||
const outs = fs.createWriteStream(dest, { flags })
|
||||
|
||||
ins.on('error', err => {
|
||||
ins.destroy()
|
||||
outs.destroy()
|
||||
outs.removeListener('close', onClose)
|
||||
|
||||
// may want to create a directory but `out` line above
|
||||
// creates an empty file for us: See #108
|
||||
// don't care about error here
|
||||
fs.unlink(dest, () => {
|
||||
// note: `err` here is from the input stream errror
|
||||
if (err.code === 'EISDIR' || err.code === 'EPERM') {
|
||||
moveDirAcrossDevice(src, dest, overwrite, callback)
|
||||
} else {
|
||||
callback(err)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
outs.on('error', err => {
|
||||
ins.destroy()
|
||||
outs.destroy()
|
||||
outs.removeListener('close', onClose)
|
||||
callback(err)
|
||||
})
|
||||
|
||||
outs.once('close', onClose)
|
||||
ins.pipe(outs)
|
||||
|
||||
function onClose () {
|
||||
fs.unlink(src, callback)
|
||||
}
|
||||
}
|
||||
|
||||
function moveDirAcrossDevice (src, dest, overwrite, callback) {
|
||||
const options = {
|
||||
overwrite: false
|
||||
}
|
||||
|
||||
if (overwrite) {
|
||||
remove(dest, err => {
|
||||
if (err) return callback(err)
|
||||
startNcp()
|
||||
})
|
||||
} else {
|
||||
startNcp()
|
||||
}
|
||||
|
||||
function startNcp () {
|
||||
ncp(src, dest, options, err => {
|
||||
if (err) return callback(err)
|
||||
remove(src, callback)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// return true if dest is a subdir of src, otherwise false.
|
||||
// extract dest base dir and check if that is the same as src basename
|
||||
function isSrcSubdir (src, dest, cb) {
|
||||
fs.stat(src, (err, st) => {
|
||||
if (err) return cb(err)
|
||||
if (st.isDirectory()) {
|
||||
const baseDir = dest.split(path.dirname(src) + path.sep)[1]
|
||||
if (baseDir) {
|
||||
const destBasename = baseDir.split(path.sep)[0]
|
||||
if (destBasename) return cb(null, src !== dest && dest.indexOf(src) > -1 && destBasename === path.basename(src))
|
||||
return cb(null, false)
|
||||
}
|
||||
return cb(null, false)
|
||||
}
|
||||
return cb(null, false)
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
move: u(move)
|
||||
}
|
||||
40
node_modules/fs-extra/lib/output/index.js
generated
vendored
Normal file
40
node_modules/fs-extra/lib/output/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
'use strict'
|
||||
|
||||
const u = require('universalify').fromCallback
|
||||
const fs = require('graceful-fs')
|
||||
const path = require('path')
|
||||
const mkdir = require('../mkdirs')
|
||||
const pathExists = require('../path-exists').pathExists
|
||||
|
||||
function outputFile (file, data, encoding, callback) {
|
||||
if (typeof encoding === 'function') {
|
||||
callback = encoding
|
||||
encoding = 'utf8'
|
||||
}
|
||||
|
||||
const dir = path.dirname(file)
|
||||
pathExists(dir, (err, itDoes) => {
|
||||
if (err) return callback(err)
|
||||
if (itDoes) return fs.writeFile(file, data, encoding, callback)
|
||||
|
||||
mkdir.mkdirs(dir, err => {
|
||||
if (err) return callback(err)
|
||||
|
||||
fs.writeFile(file, data, encoding, callback)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function outputFileSync (file, data, encoding) {
|
||||
const dir = path.dirname(file)
|
||||
if (fs.existsSync(dir)) {
|
||||
return fs.writeFileSync.apply(fs, arguments)
|
||||
}
|
||||
mkdir.mkdirsSync(dir)
|
||||
fs.writeFileSync.apply(fs, arguments)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
outputFile: u(outputFile),
|
||||
outputFileSync
|
||||
}
|
||||
12
node_modules/fs-extra/lib/path-exists/index.js
generated
vendored
Normal file
12
node_modules/fs-extra/lib/path-exists/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
'use strict'
|
||||
const u = require('universalify').fromPromise
|
||||
const fs = require('../fs')
|
||||
|
||||
function pathExists (path) {
|
||||
return fs.access(path).then(() => true).catch(() => false)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
pathExists: u(pathExists),
|
||||
pathExistsSync: fs.existsSync
|
||||
}
|
||||
9
node_modules/fs-extra/lib/remove/index.js
generated
vendored
Normal file
9
node_modules/fs-extra/lib/remove/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
'use strict'
|
||||
|
||||
const u = require('universalify').fromCallback
|
||||
const rimraf = require('./rimraf')
|
||||
|
||||
module.exports = {
|
||||
remove: u(rimraf),
|
||||
removeSync: rimraf.sync
|
||||
}
|
||||
314
node_modules/fs-extra/lib/remove/rimraf.js
generated
vendored
Normal file
314
node_modules/fs-extra/lib/remove/rimraf.js
generated
vendored
Normal file
|
|
@ -0,0 +1,314 @@
|
|||
'use strict'
|
||||
|
||||
const fs = require('graceful-fs')
|
||||
const path = require('path')
|
||||
const assert = require('assert')
|
||||
|
||||
const isWindows = (process.platform === 'win32')
|
||||
|
||||
function defaults (options) {
|
||||
const methods = [
|
||||
'unlink',
|
||||
'chmod',
|
||||
'stat',
|
||||
'lstat',
|
||||
'rmdir',
|
||||
'readdir'
|
||||
]
|
||||
methods.forEach(m => {
|
||||
options[m] = options[m] || fs[m]
|
||||
m = m + 'Sync'
|
||||
options[m] = options[m] || fs[m]
|
||||
})
|
||||
|
||||
options.maxBusyTries = options.maxBusyTries || 3
|
||||
}
|
||||
|
||||
function rimraf (p, options, cb) {
|
||||
let busyTries = 0
|
||||
|
||||
if (typeof options === 'function') {
|
||||
cb = options
|
||||
options = {}
|
||||
}
|
||||
|
||||
assert(p, 'rimraf: missing path')
|
||||
assert.equal(typeof p, 'string', 'rimraf: path should be a string')
|
||||
assert.equal(typeof cb, 'function', 'rimraf: callback function required')
|
||||
assert(options, 'rimraf: invalid options argument provided')
|
||||
assert.equal(typeof options, 'object', 'rimraf: options should be object')
|
||||
|
||||
defaults(options)
|
||||
|
||||
rimraf_(p, options, function CB (er) {
|
||||
if (er) {
|
||||
if ((er.code === 'EBUSY' || er.code === 'ENOTEMPTY' || er.code === 'EPERM') &&
|
||||
busyTries < options.maxBusyTries) {
|
||||
busyTries++
|
||||
let time = busyTries * 100
|
||||
// try again, with the same exact callback as this one.
|
||||
return setTimeout(() => rimraf_(p, options, CB), time)
|
||||
}
|
||||
|
||||
// already gone
|
||||
if (er.code === 'ENOENT') er = null
|
||||
}
|
||||
|
||||
cb(er)
|
||||
})
|
||||
}
|
||||
|
||||
// Two possible strategies.
|
||||
// 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR
|
||||
// 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR
|
||||
//
|
||||
// Both result in an extra syscall when you guess wrong. However, there
|
||||
// are likely far more normal files in the world than directories. This
|
||||
// is based on the assumption that a the average number of files per
|
||||
// directory is >= 1.
|
||||
//
|
||||
// If anyone ever complains about this, then I guess the strategy could
|
||||
// be made configurable somehow. But until then, YAGNI.
|
||||
function rimraf_ (p, options, cb) {
|
||||
assert(p)
|
||||
assert(options)
|
||||
assert(typeof cb === 'function')
|
||||
|
||||
// sunos lets the root user unlink directories, which is... weird.
|
||||
// so we have to lstat here and make sure it's not a dir.
|
||||
options.lstat(p, (er, st) => {
|
||||
if (er && er.code === 'ENOENT') {
|
||||
return cb(null)
|
||||
}
|
||||
|
||||
// Windows can EPERM on stat. Life is suffering.
|
||||
if (er && er.code === 'EPERM' && isWindows) {
|
||||
return fixWinEPERM(p, options, er, cb)
|
||||
}
|
||||
|
||||
if (st && st.isDirectory()) {
|
||||
return rmdir(p, options, er, cb)
|
||||
}
|
||||
|
||||
options.unlink(p, er => {
|
||||
if (er) {
|
||||
if (er.code === 'ENOENT') {
|
||||
return cb(null)
|
||||
}
|
||||
if (er.code === 'EPERM') {
|
||||
return (isWindows)
|
||||
? fixWinEPERM(p, options, er, cb)
|
||||
: rmdir(p, options, er, cb)
|
||||
}
|
||||
if (er.code === 'EISDIR') {
|
||||
return rmdir(p, options, er, cb)
|
||||
}
|
||||
}
|
||||
return cb(er)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function fixWinEPERM (p, options, er, cb) {
|
||||
assert(p)
|
||||
assert(options)
|
||||
assert(typeof cb === 'function')
|
||||
if (er) {
|
||||
assert(er instanceof Error)
|
||||
}
|
||||
|
||||
options.chmod(p, 0o666, er2 => {
|
||||
if (er2) {
|
||||
cb(er2.code === 'ENOENT' ? null : er)
|
||||
} else {
|
||||
options.stat(p, (er3, stats) => {
|
||||
if (er3) {
|
||||
cb(er3.code === 'ENOENT' ? null : er)
|
||||
} else if (stats.isDirectory()) {
|
||||
rmdir(p, options, er, cb)
|
||||
} else {
|
||||
options.unlink(p, cb)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function fixWinEPERMSync (p, options, er) {
|
||||
let stats
|
||||
|
||||
assert(p)
|
||||
assert(options)
|
||||
if (er) {
|
||||
assert(er instanceof Error)
|
||||
}
|
||||
|
||||
try {
|
||||
options.chmodSync(p, 0o666)
|
||||
} catch (er2) {
|
||||
if (er2.code === 'ENOENT') {
|
||||
return
|
||||
} else {
|
||||
throw er
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
stats = options.statSync(p)
|
||||
} catch (er3) {
|
||||
if (er3.code === 'ENOENT') {
|
||||
return
|
||||
} else {
|
||||
throw er
|
||||
}
|
||||
}
|
||||
|
||||
if (stats.isDirectory()) {
|
||||
rmdirSync(p, options, er)
|
||||
} else {
|
||||
options.unlinkSync(p)
|
||||
}
|
||||
}
|
||||
|
||||
function rmdir (p, options, originalEr, cb) {
|
||||
assert(p)
|
||||
assert(options)
|
||||
if (originalEr) {
|
||||
assert(originalEr instanceof Error)
|
||||
}
|
||||
assert(typeof cb === 'function')
|
||||
|
||||
// try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS)
|
||||
// if we guessed wrong, and it's not a directory, then
|
||||
// raise the original error.
|
||||
options.rmdir(p, er => {
|
||||
if (er && (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM')) {
|
||||
rmkids(p, options, cb)
|
||||
} else if (er && er.code === 'ENOTDIR') {
|
||||
cb(originalEr)
|
||||
} else {
|
||||
cb(er)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function rmkids (p, options, cb) {
|
||||
assert(p)
|
||||
assert(options)
|
||||
assert(typeof cb === 'function')
|
||||
|
||||
options.readdir(p, (er, files) => {
|
||||
if (er) return cb(er)
|
||||
|
||||
let n = files.length
|
||||
let errState
|
||||
|
||||
if (n === 0) return options.rmdir(p, cb)
|
||||
|
||||
files.forEach(f => {
|
||||
rimraf(path.join(p, f), options, er => {
|
||||
if (errState) {
|
||||
return
|
||||
}
|
||||
if (er) return cb(errState = er)
|
||||
if (--n === 0) {
|
||||
options.rmdir(p, cb)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// this looks simpler, and is strictly *faster*, but will
|
||||
// tie up the JavaScript thread and fail on excessively
|
||||
// deep directory trees.
|
||||
function rimrafSync (p, options) {
|
||||
let st
|
||||
|
||||
options = options || {}
|
||||
defaults(options)
|
||||
|
||||
assert(p, 'rimraf: missing path')
|
||||
assert.equal(typeof p, 'string', 'rimraf: path should be a string')
|
||||
assert(options, 'rimraf: missing options')
|
||||
assert.equal(typeof options, 'object', 'rimraf: options should be object')
|
||||
|
||||
try {
|
||||
st = options.lstatSync(p)
|
||||
} catch (er) {
|
||||
if (er.code === 'ENOENT') {
|
||||
return
|
||||
}
|
||||
|
||||
// Windows can EPERM on stat. Life is suffering.
|
||||
if (er.code === 'EPERM' && isWindows) {
|
||||
fixWinEPERMSync(p, options, er)
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
// sunos lets the root user unlink directories, which is... weird.
|
||||
if (st && st.isDirectory()) {
|
||||
rmdirSync(p, options, null)
|
||||
} else {
|
||||
options.unlinkSync(p)
|
||||
}
|
||||
} catch (er) {
|
||||
if (er.code === 'ENOENT') {
|
||||
return
|
||||
} else if (er.code === 'EPERM') {
|
||||
return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er)
|
||||
} else if (er.code !== 'EISDIR') {
|
||||
throw er
|
||||
}
|
||||
rmdirSync(p, options, er)
|
||||
}
|
||||
}
|
||||
|
||||
function rmdirSync (p, options, originalEr) {
|
||||
assert(p)
|
||||
assert(options)
|
||||
if (originalEr) {
|
||||
assert(originalEr instanceof Error)
|
||||
}
|
||||
|
||||
try {
|
||||
options.rmdirSync(p)
|
||||
} catch (er) {
|
||||
if (er.code === 'ENOTDIR') {
|
||||
throw originalEr
|
||||
} else if (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM') {
|
||||
rmkidsSync(p, options)
|
||||
} else if (er.code !== 'ENOENT') {
|
||||
throw er
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function rmkidsSync (p, options) {
|
||||
assert(p)
|
||||
assert(options)
|
||||
options.readdirSync(p).forEach(f => rimrafSync(path.join(p, f), options))
|
||||
|
||||
// We only end up here once we got ENOTEMPTY at least once, and
|
||||
// at this point, we are guaranteed to have removed all the kids.
|
||||
// So, we know that it won't be ENOENT or ENOTDIR or anything else.
|
||||
// try really hard to delete stuff on windows, because it has a
|
||||
// PROFOUNDLY annoying habit of not closing handles promptly when
|
||||
// files are deleted, resulting in spurious ENOTEMPTY errors.
|
||||
const retries = isWindows ? 100 : 1
|
||||
let i = 0
|
||||
do {
|
||||
let threw = true
|
||||
try {
|
||||
const ret = options.rmdirSync(p, options)
|
||||
threw = false
|
||||
return ret
|
||||
} finally {
|
||||
if (++i < retries && threw) continue // eslint-disable-line
|
||||
}
|
||||
} while (true)
|
||||
}
|
||||
|
||||
module.exports = rimraf
|
||||
rimraf.sync = rimrafSync
|
||||
16
node_modules/fs-extra/lib/util/assign.js
generated
vendored
Normal file
16
node_modules/fs-extra/lib/util/assign.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
'use strict'
|
||||
|
||||
// simple mutable assign
|
||||
function assign () {
|
||||
const args = [].slice.call(arguments).filter(i => i)
|
||||
const dest = args.shift()
|
||||
args.forEach(src => {
|
||||
Object.keys(src).forEach(key => {
|
||||
dest[key] = src[key]
|
||||
})
|
||||
})
|
||||
|
||||
return dest
|
||||
}
|
||||
|
||||
module.exports = assign
|
||||
11
node_modules/fs-extra/lib/util/buffer.js
generated
vendored
Normal file
11
node_modules/fs-extra/lib/util/buffer.js
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/* eslint-disable node/no-deprecated-api */
|
||||
module.exports = function (size) {
|
||||
if (typeof Buffer.allocUnsafe === 'function') {
|
||||
try {
|
||||
return Buffer.allocUnsafe(size)
|
||||
} catch (e) {
|
||||
return new Buffer(size)
|
||||
}
|
||||
}
|
||||
return new Buffer(size)
|
||||
}
|
||||
72
node_modules/fs-extra/lib/util/utimes.js
generated
vendored
Normal file
72
node_modules/fs-extra/lib/util/utimes.js
generated
vendored
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
'use strict'
|
||||
|
||||
const fs = require('graceful-fs')
|
||||
const os = require('os')
|
||||
const path = require('path')
|
||||
|
||||
// HFS, ext{2,3}, FAT do not, Node.js v0.10 does not
|
||||
function hasMillisResSync () {
|
||||
let tmpfile = path.join('millis-test-sync' + Date.now().toString() + Math.random().toString().slice(2))
|
||||
tmpfile = path.join(os.tmpdir(), tmpfile)
|
||||
|
||||
// 550 millis past UNIX epoch
|
||||
const d = new Date(1435410243862)
|
||||
fs.writeFileSync(tmpfile, 'https://github.com/jprichardson/node-fs-extra/pull/141')
|
||||
const fd = fs.openSync(tmpfile, 'r+')
|
||||
fs.futimesSync(fd, d, d)
|
||||
fs.closeSync(fd)
|
||||
return fs.statSync(tmpfile).mtime > 1435410243000
|
||||
}
|
||||
|
||||
function hasMillisRes (callback) {
|
||||
let tmpfile = path.join('millis-test' + Date.now().toString() + Math.random().toString().slice(2))
|
||||
tmpfile = path.join(os.tmpdir(), tmpfile)
|
||||
|
||||
// 550 millis past UNIX epoch
|
||||
const d = new Date(1435410243862)
|
||||
fs.writeFile(tmpfile, 'https://github.com/jprichardson/node-fs-extra/pull/141', err => {
|
||||
if (err) return callback(err)
|
||||
fs.open(tmpfile, 'r+', (err, fd) => {
|
||||
if (err) return callback(err)
|
||||
fs.futimes(fd, d, d, err => {
|
||||
if (err) return callback(err)
|
||||
fs.close(fd, err => {
|
||||
if (err) return callback(err)
|
||||
fs.stat(tmpfile, (err, stats) => {
|
||||
if (err) return callback(err)
|
||||
callback(null, stats.mtime > 1435410243000)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function timeRemoveMillis (timestamp) {
|
||||
if (typeof timestamp === 'number') {
|
||||
return Math.floor(timestamp / 1000) * 1000
|
||||
} else if (timestamp instanceof Date) {
|
||||
return new Date(Math.floor(timestamp.getTime() / 1000) * 1000)
|
||||
} else {
|
||||
throw new Error('fs-extra: timeRemoveMillis() unknown parameter type')
|
||||
}
|
||||
}
|
||||
|
||||
function utimesMillis (path, atime, mtime, callback) {
|
||||
// if (!HAS_MILLIS_RES) return fs.utimes(path, atime, mtime, callback)
|
||||
fs.open(path, 'r+', (err, fd) => {
|
||||
if (err) return callback(err)
|
||||
fs.futimes(fd, atime, mtime, futimesErr => {
|
||||
fs.close(fd, closeErr => {
|
||||
if (callback) callback(futimesErr || closeErr)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
hasMillisRes,
|
||||
hasMillisResSync,
|
||||
timeRemoveMillis,
|
||||
utimesMillis
|
||||
}
|
||||
64
node_modules/fs-extra/package.json
generated
vendored
Normal file
64
node_modules/fs-extra/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
{
|
||||
"name": "fs-extra",
|
||||
"version": "4.0.3",
|
||||
"description": "fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as mkdir -p, cp -r, and rm -rf.",
|
||||
"homepage": "https://github.com/jprichardson/node-fs-extra",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jprichardson/node-fs-extra"
|
||||
},
|
||||
"keywords": [
|
||||
"fs",
|
||||
"file",
|
||||
"file system",
|
||||
"copy",
|
||||
"directory",
|
||||
"extra",
|
||||
"mkdirp",
|
||||
"mkdir",
|
||||
"mkdirs",
|
||||
"recursive",
|
||||
"json",
|
||||
"read",
|
||||
"write",
|
||||
"extra",
|
||||
"delete",
|
||||
"remove",
|
||||
"touch",
|
||||
"create",
|
||||
"text",
|
||||
"output",
|
||||
"move"
|
||||
],
|
||||
"author": "JP Richardson <jprichardson@gmail.com>",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"graceful-fs": "^4.1.2",
|
||||
"jsonfile": "^4.0.0",
|
||||
"universalify": "^0.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"coveralls": "^2.11.2",
|
||||
"istanbul": "^0.4.5",
|
||||
"klaw": "^1.0.0",
|
||||
"klaw-sync": "^1.1.2",
|
||||
"minimist": "^1.1.1",
|
||||
"mocha": "^3.1.2",
|
||||
"proxyquire": "^1.7.10",
|
||||
"read-dir-files": "^0.1.1",
|
||||
"rimraf": "^2.2.8",
|
||||
"secure-random": "^1.1.1",
|
||||
"semver": "^5.3.0",
|
||||
"standard": "^10.0.2",
|
||||
"standard-markdown": "^4.0.1"
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"scripts": {
|
||||
"coverage": "istanbul cover -i 'lib/**' -x '**/__tests__/**' test.js",
|
||||
"coveralls": "coveralls < coverage/lcov.info",
|
||||
"lint": "standard && standard-markdown",
|
||||
"test-find": "find ./lib/**/__tests__ -name *.test.js | xargs mocha",
|
||||
"test": "npm run lint && npm run unit",
|
||||
"unit": "node test.js"
|
||||
}
|
||||
}
|
||||
5
node_modules/github-linguist/.eslintignore
generated
vendored
Normal file
5
node_modules/github-linguist/.eslintignore
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/lambda/
|
||||
/scripts
|
||||
/config
|
||||
.history
|
||||
/test/**
|
||||
3
node_modules/github-linguist/.eslintrc.js
generated
vendored
Normal file
3
node_modules/github-linguist/.eslintrc.js
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
extends: [require.resolve('@umijs/fabric/dist/eslint')],
|
||||
};
|
||||
26
node_modules/github-linguist/.github/workflows/ci.yml
generated
vendored
Normal file
26
node_modules/github-linguist/.github/workflows/ci.yml
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
name: Node CI
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
node_version: [10.x, 12.x]
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ matrix.node_version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node_version }}
|
||||
- run: echo ${{github.ref}}
|
||||
- run: yarn
|
||||
- run: yarn run lint
|
||||
- run: yarn run test
|
||||
env:
|
||||
CI: true
|
||||
PROGRESS: none
|
||||
NODE_ENV: test
|
||||
NODE_OPTIONS: --max_old_space_size=4096
|
||||
5
node_modules/github-linguist/.prettierrc.js
generated
vendored
Normal file
5
node_modules/github-linguist/.prettierrc.js
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
const fabric = require('@umijs/fabric');
|
||||
|
||||
module.exports = {
|
||||
...fabric.prettier,
|
||||
};
|
||||
71
node_modules/github-linguist/README.md
generated
vendored
Normal file
71
node_modules/github-linguist/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
# github-linguist
|
||||
|
||||
💻 Counts the number of lines of code, written in TypeScript.
|
||||
|
||||
**Warning:** This package uses regular expressions to approximate the lines of code in a project. The
|
||||
results are not 100% precise because the regular expressions can return mistakes in edge
|
||||
cases, for example if comment tokens are present inside of multiline strings.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Node.js 6+
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm install github-linguist
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```bash
|
||||
yarn add github-linguist
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
You can use `loc` in you ternimal, or as a npm package in your projects.
|
||||
|
||||
### Command line mode
|
||||
|
||||
Supports counting lines of code of a file or directory.
|
||||
|
||||
#### 1. Lines of code in a single file
|
||||
|
||||
```bash
|
||||
# loc file <path>
|
||||
loc file src/index.ts
|
||||
```
|
||||
|
||||

|
||||
|
||||
#### 2. Lines of code in a directory
|
||||
|
||||
```bash
|
||||
# loc <pattern>
|
||||
loc dir **/*.ts
|
||||
```
|
||||
|
||||

|
||||
|
||||
### Third-party mode
|
||||
|
||||
```ts
|
||||
import { LocFile, LocDir } from 'github-linguist';
|
||||
|
||||
// for a file.
|
||||
const file = new LocFile(filePath);
|
||||
const { info } = file.getInfo();
|
||||
|
||||
// for a directory.
|
||||
const dir = new LocDir({
|
||||
cwd: // root directory, or leave blank to use process.cwd()
|
||||
include: // string or string[] containing path patterns to include (default include all)
|
||||
exclude: // string or string[] containing path patterns to exclude (default exclude none)
|
||||
});
|
||||
const { info } = dir.getInfo();
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT License.
|
||||
2
node_modules/github-linguist/dist/cli.d.ts
generated
vendored
Normal file
2
node_modules/github-linguist/dist/cli.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/env node
|
||||
export {};
|
||||
57
node_modules/github-linguist/dist/cli.js
generated
vendored
Executable file
57
node_modules/github-linguist/dist/cli.js
generated
vendored
Executable file
|
|
@ -0,0 +1,57 @@
|
|||
#!/usr/bin/env node
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const chalk_1 = __importDefault(require("chalk"));
|
||||
const commander_1 = __importDefault(require("commander"));
|
||||
const directory_1 = require("./directory");
|
||||
const file_1 = require("./file");
|
||||
const utils_1 = require("./utils");
|
||||
commander_1.default
|
||||
.version(utils_1.getVersion(), '-v')
|
||||
.command('file <path>')
|
||||
.description('count lines of code in a file')
|
||||
.action(async (pathPattern) => {
|
||||
try {
|
||||
const info = await (new file_1.LocFile(pathPattern).getFileInfo());
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(chalk_1.default.cyan(`
|
||||
path: \t\t${pathPattern}
|
||||
language: \t${info.languages}
|
||||
total lines: \t${String(info.lines.total)}
|
||||
code lines: \t${String(info.lines.code)}
|
||||
comment lines: \t${String(info.lines.comment)}
|
||||
`));
|
||||
}
|
||||
catch (e) {
|
||||
console.error(e);
|
||||
console.error(e.stacl);
|
||||
}
|
||||
});
|
||||
const formatInfo = (info, languages) => `
|
||||
\ttotal lines: \t${String(info.total)}
|
||||
\tcode lines: \t${String(info.code)}
|
||||
\tcomment lines: \t${String(info.comment)}
|
||||
\t--------------------${Object.keys(languages)
|
||||
.map((key) => {
|
||||
const languageInfo = languages[key];
|
||||
return `\n\t${key.padEnd(10)} \t file count:${String(languageInfo.sum)} \ttotal:${String(languageInfo.total)} \tcomment:${String(languageInfo.comment)} \tcode:${String(languageInfo.code)}`;
|
||||
})
|
||||
.join('')}`;
|
||||
commander_1.default.arguments('<cmd> [env]').action(async (cmd) => {
|
||||
try {
|
||||
const { info, languages } = await (new directory_1.LocDir({
|
||||
include: cmd
|
||||
}).loadInfo());
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(chalk_1.default.cyan(formatInfo(info, languages)));
|
||||
}
|
||||
catch (e) {
|
||||
console.error(e);
|
||||
console.error(e.stacl);
|
||||
}
|
||||
});
|
||||
commander_1.default.parse(process.argv);
|
||||
//# sourceMappingURL=cli.js.map
|
||||
1
node_modules/github-linguist/dist/cli.js.map
generated
vendored
Normal file
1
node_modules/github-linguist/dist/cli.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;AAEA,kDAA0B;AAC1B,0DAAgC;AAKhC,2CAAqC;AACrC,iCAA2C;AAC3C,mCAAqC;AAErC,mBAAO;KACJ,OAAO,CAAC,kBAAU,EAAE,EAAE,IAAI,CAAC;KAC3B,OAAO,CAAC,aAAa,CAAC;KACtB,WAAW,CAAC,+BAA+B,CAAC;KAC5C,MAAM,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE;IAC5B,IAAI;QACF,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,cAAO,CAAC,WAAW,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;QAC5D,sCAAsC;QACtC,OAAO,CAAC,GAAG,CACT,eAAK,CAAC,IAAI,CAAC;oBACC,WAAW;sBACT,IAAI,CAAC,SAAS;yBACX,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;wBACzB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;2BACpB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;OAC9C,CAAC,CACD,CAAC;KACH;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;KACxB;AACH,CAAC,CAAC,CAAC;AAEL,MAAM,UAAU,GAAG,CACjB,IAAc,EACd,SAIC,EACD,EAAE,CAAC;qBACgB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;oBACnB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;uBACd,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;0BACjB,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC;KAC3C,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;IACX,MAAM,YAAY,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;IACpC,OAAO,OAAO,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,kBAAkB,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,YAAY,MAAM,CACtF,YAAY,CAAC,KAAK,CACnB,eAAe,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,YAAY,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;AACtF,CAAC,CAAC;KACD,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;AAEhB,mBAAO,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACpD,IAAI;QACF,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC,IAAI,kBAAM,CAAC;YAC5C,OAAO,EAAE,GAAG;SACb,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;QACf,sCAAsC;QACtC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;KACtD;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;KACxB;AACH,CAAC,CAAC,CAAC;AAEH,mBAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
||||
28
node_modules/github-linguist/dist/directory.d.ts
generated
vendored
Normal file
28
node_modules/github-linguist/dist/directory.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import { LineInfo } from './file';
|
||||
export interface LocDirOptions {
|
||||
cwd?: string;
|
||||
include?: string[] | string;
|
||||
exclude?: string[] | string;
|
||||
}
|
||||
export interface LocResult {
|
||||
files: string[];
|
||||
info: LineInfo;
|
||||
languages: {
|
||||
[key: string]: LineInfo & {
|
||||
sum: number;
|
||||
};
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Collect the info of a directory.
|
||||
*/
|
||||
export declare class LocDir {
|
||||
private cwd;
|
||||
private include;
|
||||
private exclude;
|
||||
constructor(options: LocDirOptions);
|
||||
/**
|
||||
* Calculate directory info.
|
||||
*/
|
||||
loadInfo(): Promise<LocResult>;
|
||||
}
|
||||
116
node_modules/github-linguist/dist/directory.js
generated
vendored
Normal file
116
node_modules/github-linguist/dist/directory.js
generated
vendored
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.LocDir = void 0;
|
||||
const globby_1 = __importDefault(require("globby"));
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
// @ts-ignore
|
||||
const slash2_1 = __importDefault(require("slash2"));
|
||||
const file_1 = require("./file");
|
||||
const defaultInfo = {
|
||||
total: 0,
|
||||
code: 0,
|
||||
comment: 0,
|
||||
};
|
||||
const defaultExclude = [
|
||||
// javascript
|
||||
'**/*.map',
|
||||
'**/yarn**',
|
||||
'**/.github',
|
||||
'**/node_modules/**',
|
||||
'**/dist/**',
|
||||
'**/*.snap',
|
||||
// java
|
||||
'**/target'
|
||||
];
|
||||
/**
|
||||
* Collect the info of a directory.
|
||||
*/
|
||||
class LocDir {
|
||||
constructor(options) {
|
||||
Object.defineProperty(this, "cwd", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: void 0
|
||||
});
|
||||
Object.defineProperty(this, "include", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: void 0
|
||||
});
|
||||
Object.defineProperty(this, "exclude", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: void 0
|
||||
});
|
||||
// ensure all excludes are globstar. Note that '**/*.ts/**' matches files
|
||||
// that end in .ts because the globstar indicates 0 or more directory paths.
|
||||
this.exclude = ensureArray(options.exclude)
|
||||
.concat(defaultExclude)
|
||||
.map(item => item.endsWith('**') ? item : `${item}/**`);
|
||||
// remove all leading './' since this messes up globstar matches in the
|
||||
// excludes.
|
||||
this.include = ensureArray(options.include, '**')
|
||||
.map(item => item.startsWith('./') ? item.substring(2) : item)
|
||||
.map(item => item.endsWith('**') ? item : `${item}/**`);
|
||||
this.cwd = options.cwd || process.cwd();
|
||||
}
|
||||
/**
|
||||
* Calculate directory info.
|
||||
*/
|
||||
async loadInfo() {
|
||||
const paths = await globby_1.default(this.include, {
|
||||
cwd: this.cwd,
|
||||
ignore: this.exclude,
|
||||
nodir: true
|
||||
});
|
||||
const files = [];
|
||||
const info = { ...defaultInfo };
|
||||
let languages = {};
|
||||
await Promise.all(paths.map(async (pathItem) => {
|
||||
const fullPath = slash2_1.default(path_1.default.join(this.cwd, pathItem));
|
||||
if (!pathItem ||
|
||||
!(await fs_extra_1.default.pathExists(fullPath)) ||
|
||||
(await fs_extra_1.default.stat(fullPath)).isDirectory()) {
|
||||
return;
|
||||
}
|
||||
const file = new file_1.LocFile(fullPath);
|
||||
const fileLineInfo = await file.getFileInfo();
|
||||
const { lines } = fileLineInfo;
|
||||
info.total += lines.total;
|
||||
info.code += lines.code;
|
||||
info.comment += lines.comment;
|
||||
const language = { ...languages[fileLineInfo.languages] };
|
||||
language.code = lines.code + (language.code || 0);
|
||||
language.sum = (language.sum || 0) + 1;
|
||||
language.comment = lines.comment + (language.comment || 0);
|
||||
language.total = lines.total + (language.total || 0);
|
||||
languages = {
|
||||
...languages,
|
||||
[fileLineInfo.languages]: language,
|
||||
};
|
||||
files.push(fullPath);
|
||||
}));
|
||||
return {
|
||||
files,
|
||||
info,
|
||||
languages,
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.LocDir = LocDir;
|
||||
function ensureArray(arr, dfault) {
|
||||
if (!arr) {
|
||||
return dfault ? [dfault] : [];
|
||||
}
|
||||
return Array.isArray(arr)
|
||||
? arr
|
||||
: [arr];
|
||||
}
|
||||
//# sourceMappingURL=directory.js.map
|
||||
1
node_modules/github-linguist/dist/directory.js.map
generated
vendored
Normal file
1
node_modules/github-linguist/dist/directory.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"directory.js","sourceRoot":"","sources":["../src/directory.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAC5B,wDAA0B;AAC1B,gDAAwB;AACxB,aAAa;AACb,oDAA2B;AAE3B,iCAA2C;AAE3C,MAAM,WAAW,GAAa;IAC5B,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,OAAO,EAAE,CAAC;CACX,CAAC;AAkBF,MAAM,cAAc,GAAG;IACrB,aAAa;IACb,UAAU;IACV,WAAW;IACX,YAAY;IACZ,oBAAoB;IACpB,YAAY;IACZ,WAAW;IAEX,OAAO;IACP,WAAW;CACZ,CAAC;AAEF;;GAEG;AACH,MAAa,MAAM;IAKjB,YAAY,OAAsB;QAJlC;;;;;WAAoB;QACpB;;;;;WAA0B;QAC1B;;;;;WAA0B;QAIxB,yEAAyE;QACzE,4EAA4E;QAC5E,IAAI,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC;aACxC,MAAM,CAAC,cAAc,CAAC;aACtB,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,CAAC,CAAC;QAE1D,uEAAuE;QACvE,YAAY;QACZ,IAAI,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC;aAC9C,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;aAC7D,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,CAAC,CAAC;QAC1D,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1C,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,QAAQ;QACZ,MAAM,KAAK,GAAG,MAAM,gBAAM,CAAC,IAAI,CAAC,OAAO,EAAE;YACvC,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,MAAM,EAAE,IAAI,CAAC,OAAO;YACpB,KAAK,EAAE,IAAI;SACZ,CAAC,CAAC;QACH,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,MAAM,IAAI,GAAa,EAAE,GAAG,WAAW,EAAE,CAAC;QAC1C,IAAI,SAAS,GAIT,EAAE,CAAC;QAEP,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;YAC7C,MAAM,QAAQ,GAAG,gBAAK,CAAC,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;YACtD,IACE,CAAC,QAAQ;gBACT,CAAC,CAAC,MAAM,kBAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;gBAChC,CAAC,MAAM,kBAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,EAAE,EACvC;gBACA,OAAO;aACR;YACD,MAAM,IAAI,GAAG,IAAI,cAAO,CAAC,QAAQ,CAAC,CAAC;YACnC,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;YAC9C,MAAM,EAAE,KAAK,EAAE,GAAG,YAAY,CAAC;YAC/B,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC;YAC1B,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC;YACxB,IAAI,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC;YAC9B,MAAM,QAAQ,GAAG,EAAE,GAAG,SAAS,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,CAAC;YAC1D,QAAQ,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC;YAClD,QAAQ,CAAC,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;YACvC,QAAQ,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,GAAG,CAAC,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC;YAC3D,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,GAAG,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC;YACrD,SAAS,GAAG;gBACV,GAAG,SAAS;gBACZ,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,QAAQ;aACnC,CAAC;YACF,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC,CAAC;QAEJ,OAAO;YACL,KAAK;YACL,IAAI;YACJ,SAAS;SACV,CAAC;IACJ,CAAC;CACF;AAvED,wBAuEC;AAED,SAAS,WAAW,CAAC,GAAuB,EAAE,MAAe;IAC3D,IAAI,CAAC,GAAG,EAAE;QACR,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KAC/B;IACD,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QACvB,CAAC,CAAC,GAAG;QACL,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AACZ,CAAC"}
|
||||
37
node_modules/github-linguist/dist/file.d.ts
generated
vendored
Normal file
37
node_modules/github-linguist/dist/file.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
* detect file info
|
||||
*/
|
||||
export interface LineInfo {
|
||||
total: number;
|
||||
code: number;
|
||||
comment: number;
|
||||
}
|
||||
export interface FileInfo {
|
||||
name: string;
|
||||
languages: string;
|
||||
size: number;
|
||||
lines: LineInfo;
|
||||
}
|
||||
/**
|
||||
* Collect language info for a single file
|
||||
*/
|
||||
export declare class LocFile {
|
||||
private debug;
|
||||
path: string;
|
||||
private rawPath;
|
||||
private language;
|
||||
/**
|
||||
* Creates an instance of LocFile.
|
||||
*/
|
||||
constructor(rawPath: string, debug?: boolean);
|
||||
/**
|
||||
* get file type through a path
|
||||
*/
|
||||
private getType;
|
||||
private filterData;
|
||||
/**
|
||||
* Get file info when LocFile init
|
||||
*/
|
||||
getFileInfo(data?: string): Promise<FileInfo>;
|
||||
getFileInfoByContent(name: string, data: string): FileInfo;
|
||||
}
|
||||
198
node_modules/github-linguist/dist/file.js
generated
vendored
Normal file
198
node_modules/github-linguist/dist/file.js
generated
vendored
Normal file
|
|
@ -0,0 +1,198 @@
|
|||
"use strict";
|
||||
/**
|
||||
* detect file info
|
||||
*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.LocFile = void 0;
|
||||
const fs = __importStar(require("fs-extra"));
|
||||
const Path = __importStar(require("path"));
|
||||
// @ts-ignore
|
||||
const slash2_1 = __importDefault(require("slash2"));
|
||||
const languages_1 = require("./languages");
|
||||
const DefaultLine = {
|
||||
total: 0,
|
||||
code: 0,
|
||||
comment: 0,
|
||||
};
|
||||
const DefaultFileInfo = {
|
||||
name: '',
|
||||
languages: '',
|
||||
size: 0,
|
||||
lines: DefaultLine,
|
||||
};
|
||||
/**
|
||||
* Collect language info for a single file
|
||||
*/
|
||||
class LocFile {
|
||||
/**
|
||||
* Creates an instance of LocFile.
|
||||
*/
|
||||
constructor(rawPath, debug = false) {
|
||||
Object.defineProperty(this, "debug", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: debug
|
||||
});
|
||||
Object.defineProperty(this, "path", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: void 0
|
||||
});
|
||||
Object.defineProperty(this, "rawPath", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: void 0
|
||||
});
|
||||
Object.defineProperty(this, "language", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: new languages_1.Languages()
|
||||
});
|
||||
Object.defineProperty(this, "filterData", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: (data, regexes) => {
|
||||
const lines = data.split(/\n/);
|
||||
let commentLength = 0;
|
||||
let codeLength = lines.length;
|
||||
const total = codeLength;
|
||||
let inMultiLineComment = false;
|
||||
lines.forEach((line) => {
|
||||
let lineType = 'code';
|
||||
line = line.trim();
|
||||
if (inMultiLineComment) {
|
||||
let noCode = true;
|
||||
if (regexes.multiLineCommentClose.test(line)) {
|
||||
// line contains the end of a multi-line comment
|
||||
inMultiLineComment = false;
|
||||
if (!regexes.multiLineCommentCloseEnd.test(line)) {
|
||||
// the multiline comment does not end this line.
|
||||
// there is real code on it.
|
||||
noCode = false;
|
||||
}
|
||||
}
|
||||
if (noCode) {
|
||||
lineType = 'comm';
|
||||
commentLength += 1;
|
||||
codeLength -= 1;
|
||||
}
|
||||
}
|
||||
else if (line) {
|
||||
// non-empty line
|
||||
if (regexes.multiLineCommentOpen.test(line)) {
|
||||
// line contains the start of a multi-line comment
|
||||
// might contain some real code, but we'll let that slide
|
||||
if (!regexes.multiLineCommentOpenAndClose.test(line)) {
|
||||
// comment is not also closed on this line
|
||||
inMultiLineComment = true;
|
||||
}
|
||||
if (regexes.multiLineCommentOpenStart.test(line)) {
|
||||
// The comment starts the line. There is no other code on this line
|
||||
commentLength += 1;
|
||||
codeLength -= 1;
|
||||
lineType = 'comm';
|
||||
}
|
||||
}
|
||||
else if (regexes.singleLineComment.test(line)) {
|
||||
// line contains only a single line comment
|
||||
commentLength += 1;
|
||||
codeLength -= 1;
|
||||
lineType = 'comm';
|
||||
}
|
||||
}
|
||||
else {
|
||||
// empty line
|
||||
codeLength -= 1;
|
||||
lineType = 'empt';
|
||||
}
|
||||
if (this.debug) {
|
||||
console.log(lineType, line);
|
||||
}
|
||||
});
|
||||
return {
|
||||
...DefaultLine,
|
||||
total,
|
||||
code: codeLength,
|
||||
comment: commentLength,
|
||||
};
|
||||
}
|
||||
});
|
||||
this.path = slash2_1.default(rawPath);
|
||||
this.rawPath = rawPath;
|
||||
}
|
||||
/**
|
||||
* get file type through a path
|
||||
*/
|
||||
getType(path) {
|
||||
const fileExtension = `.${path.split('.').pop()}`;
|
||||
return this.language.extensionMap[fileExtension] || '';
|
||||
}
|
||||
/**
|
||||
* Get file info when LocFile init
|
||||
*/
|
||||
async getFileInfo(data) {
|
||||
if (!(await fs.pathExists(this.rawPath))) {
|
||||
throw new Error(`Error: file ${this.rawPath} does not exist.`);
|
||||
}
|
||||
let newData = data;
|
||||
const info = Object.assign({}, DefaultFileInfo);
|
||||
const name = this.path.split(Path.sep).pop() || '';
|
||||
try {
|
||||
const stat = await fs.stat(this.path);
|
||||
if (!stat.isFile()) {
|
||||
return info;
|
||||
}
|
||||
newData = data || await fs.readFile(this.path, 'utf-8');
|
||||
info.name = name;
|
||||
info.size = (stat && stat.size) || 0;
|
||||
info.languages = this.getType(this.path);
|
||||
if (!info.languages) {
|
||||
return info;
|
||||
}
|
||||
if (newData) {
|
||||
const regexes = this.language.getRegexes(info.languages);
|
||||
info.lines = this.filterData(newData, regexes);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
throw new Error('read file failed.');
|
||||
}
|
||||
return info;
|
||||
}
|
||||
getFileInfoByContent(name, data) {
|
||||
const info = Object.assign({}, DefaultFileInfo);
|
||||
info.name = name;
|
||||
info.languages = this.getType(name);
|
||||
info.lines = this.filterData(data, this.language.getRegexes(info.languages));
|
||||
return info;
|
||||
}
|
||||
}
|
||||
exports.LocFile = LocFile;
|
||||
//# sourceMappingURL=file.js.map
|
||||
1
node_modules/github-linguist/dist/file.js.map
generated
vendored
Normal file
1
node_modules/github-linguist/dist/file.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"file.js","sourceRoot":"","sources":["../src/file.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,2CAA6B;AAC7B,aAAa;AACb,oDAA2B;AAE3B,2CAAiD;AAejD,MAAM,WAAW,GAAa;IAC5B,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,OAAO,EAAE,CAAC;CACX,CAAC;AAEF,MAAM,eAAe,GAAa;IAChC,IAAI,EAAE,EAAE;IACR,SAAS,EAAE,EAAE;IACb,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,WAAW;CACnB,CAAC;AAEF;;GAEG;AACH,MAAa,OAAO;IAMlB;;OAEG;IACH,YAAY,OAAe,EAAU,QAAQ,KAAK;;;;;mBAAb;;QARrC;;;;;WAAoB;QACpB;;;;;WAAwB;QAExB;;;;mBAAmB,IAAI,qBAAS,EAAE;WAAC;QAkBnC;;;;mBAAqB,CAAC,IAAY,EAAE,OAAgB,EAAY,EAAE;gBAChE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAC/B,IAAI,aAAa,GAAG,CAAC,CAAC;gBACtB,IAAI,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC;gBAC9B,MAAM,KAAK,GAAG,UAAU,CAAC;gBAEzB,IAAI,kBAAkB,GAAG,KAAK,CAAC;gBAC/B,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;oBAErB,IAAI,QAAQ,GAAG,MAAM,CAAC;oBACtB,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;oBAEnB,IAAI,kBAAkB,EAAE;wBAEtB,IAAI,MAAM,GAAG,IAAI,CAAC;wBAClB,IAAI,OAAO,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;4BAC5C,gDAAgD;4BAChD,kBAAkB,GAAG,KAAK,CAAC;4BAC3B,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;gCAChD,gDAAgD;gCAChD,4BAA4B;gCAC5B,MAAM,GAAG,KAAK,CAAC;6BAChB;yBACF;wBAED,IAAI,MAAM,EAAE;4BACV,QAAQ,GAAG,MAAM,CAAC;4BAClB,aAAa,IAAI,CAAC,CAAC;4BACnB,UAAU,IAAI,CAAC,CAAC;yBACjB;qBAEF;yBAAM,IAAI,IAAI,EAAE;wBAEf,iBAAiB;wBACjB,IAAI,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;4BAC3C,kDAAkD;4BAClD,yDAAyD;4BAEzD,IAAI,CAAC,OAAO,CAAC,4BAA4B,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;gCACpD,0CAA0C;gCAC1C,kBAAkB,GAAG,IAAI,CAAC;6BAC3B;4BAED,IAAI,OAAO,CAAC,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;gCAChD,mEAAmE;gCACnE,aAAa,IAAI,CAAC,CAAC;gCACnB,UAAU,IAAI,CAAC,CAAC;gCAChB,QAAQ,GAAG,MAAM,CAAC;6BACnB;yBAEF;6BAAM,IAAI,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;4BAC/C,2CAA2C;4BAC3C,aAAa,IAAI,CAAC,CAAC;4BACnB,UAAU,IAAI,CAAC,CAAC;4BAChB,QAAQ,GAAG,MAAM,CAAC;yBACnB;qBAEF;yBAAM;wBACL,aAAa;wBACb,UAAU,IAAI,CAAC,CAAC;wBAChB,QAAQ,GAAG,MAAM,CAAC;qBACnB;oBAED,IAAI,IAAI,CAAC,KAAK,EAAE;wBACd,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;qBAC5B;gBACH,CAAC,CAAC,CAAC;gBAEH,OAAO;oBACL,GAAG,WAAW;oBACd,KAAK;oBACL,IAAI,EAAE,UAAU;oBAChB,OAAO,EAAE,aAAa;iBACvB,CAAC;YACJ,CAAC;WAAC;QAtFA,IAAI,CAAC,IAAI,GAAG,gBAAK,CAAC,OAAO,CAAC,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED;;OAEG;IACK,OAAO,CAAC,IAAY;QAC1B,MAAM,aAAa,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC;QAClD,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;IACzD,CAAC;IA8ED;;OAEG;IACI,KAAK,CAAC,WAAW,CAAC,IAAa;QACpC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE;YACxC,MAAM,IAAI,KAAK,CAAC,eAAe,IAAI,CAAC,OAAO,kBAAkB,CAAC,CAAC;SAChE;QAED,IAAI,OAAO,GAAG,IAAI,CAAC;QACnB,MAAM,IAAI,GAAa,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,eAAe,CAAC,CAAC;QAC1D,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;QACnD,IAAI;YACF,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACtC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE;gBAClB,OAAO,IAAI,CAAC;aACb;YACD,OAAO,GAAG,IAAI,IAAI,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACxD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YACjB,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACrC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACzC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;gBACnB,OAAO,IAAI,CAAC;aACb;YACD,IAAI,OAAO,EAAE;gBACX,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;gBACzD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;aAChD;SACF;QAAC,OAAO,GAAG,EAAE;YACZ,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;SACtC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,oBAAoB,CAAC,IAAY,EAAE,IAAY;QACpD,MAAM,IAAI,GAAa,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,eAAe,CAAC,CAAC;QAC1D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;QAC7E,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA1ID,0BA0IC"}
|
||||
5
node_modules/github-linguist/dist/index.d.ts
generated
vendored
Normal file
5
node_modules/github-linguist/dist/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import { LocResult } from './directory';
|
||||
export { LocDir, LocDirOptions } from './directory';
|
||||
export { LocFile, LineInfo } from './file';
|
||||
declare const loc: (fileOrDir: string) => Promise<LocResult>;
|
||||
export default loc;
|
||||
31
node_modules/github-linguist/dist/index.js
generated
vendored
Normal file
31
node_modules/github-linguist/dist/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
// @ts-ignore
|
||||
const slash2_1 = __importDefault(require("slash2"));
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
const directory_1 = require("./directory");
|
||||
const file_1 = require("./file");
|
||||
var directory_2 = require("./directory");
|
||||
Object.defineProperty(exports, "LocDir", { enumerable: true, get: function () { return directory_2.LocDir; } });
|
||||
var file_2 = require("./file");
|
||||
Object.defineProperty(exports, "LocFile", { enumerable: true, get: function () { return file_2.LocFile; } });
|
||||
const loc = async (fileOrDir) => {
|
||||
const stat = await fs_extra_1.default.stat(slash2_1.default(fileOrDir));
|
||||
if (stat.isFile()) {
|
||||
const locFile = new file_1.LocFile(slash2_1.default(fileOrDir));
|
||||
const info = await locFile.getFileInfo();
|
||||
const filePath = locFile.path;
|
||||
return {
|
||||
info: info.lines,
|
||||
files: [filePath],
|
||||
languages: { [info.languages]: { ...info.lines, sum: 1 } },
|
||||
};
|
||||
}
|
||||
const locDir = new directory_1.LocDir({ cwd: slash2_1.default(fileOrDir) });
|
||||
return locDir.loadInfo();
|
||||
};
|
||||
exports.default = loc;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/github-linguist/dist/index.js.map
generated
vendored
Normal file
1
node_modules/github-linguist/dist/index.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,aAAa;AACb,oDAA2B;AAC3B,wDAA0B;AAE1B,2CAAgD;AAChD,iCAAiC;AAEjC,yCAAoD;AAA3C,mGAAA,MAAM,OAAA;AACf,+BAA2C;AAAlC,+FAAA,OAAO,OAAA;AAEhB,MAAM,GAAG,GAAG,KAAK,EACf,SAAiB,EACG,EAAE;IACtB,MAAM,IAAI,GAAG,MAAM,kBAAE,CAAC,IAAI,CAAC,gBAAK,CAAC,SAAS,CAAC,CAAC,CAAC;IAC7C,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE;QACjB,MAAM,OAAO,GAAG,IAAI,cAAO,CAAC,gBAAK,CAAC,SAAS,CAAC,CAAC,CAAC;QAC9C,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,WAAW,EAAE,CAAC;QACzC,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;QAC9B,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,KAAK;YAChB,KAAK,EAAE,CAAC,QAAQ,CAAC;YACjB,SAAS,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE;SAC3D,CAAC;KACH;IACD,MAAM,MAAM,GAAG,IAAI,kBAAM,CAAC,EAAE,GAAG,EAAE,gBAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACrD,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;AAC3B,CAAC,CAAC;AAEF,kBAAe,GAAG,CAAC"}
|
||||
43
node_modules/github-linguist/dist/languages.d.ts
generated
vendored
Normal file
43
node_modules/github-linguist/dist/languages.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
export interface DetectorOptions {
|
||||
}
|
||||
/**
|
||||
* detecte program language through file extension
|
||||
*
|
||||
* @export
|
||||
* @class LanguageDetector
|
||||
*/
|
||||
export declare class Languages {
|
||||
extensionMap: {
|
||||
[key: string]: string;
|
||||
};
|
||||
/**
|
||||
* Creates an instance of Detector.
|
||||
*/
|
||||
constructor();
|
||||
/**
|
||||
* load language before detecting
|
||||
*/
|
||||
private loadExtensionMap;
|
||||
/**
|
||||
* Retrieve the regular expressions for a given language.
|
||||
* This is incomplete, but covers most of the languages we
|
||||
* see in the wild.
|
||||
*
|
||||
* @param language the language to retrieve regexes for
|
||||
*/
|
||||
getRegexes(language: string): Regexes;
|
||||
/**
|
||||
* return extension map
|
||||
*/
|
||||
getExtensionMap(): {
|
||||
[key: string]: string;
|
||||
};
|
||||
}
|
||||
export interface Regexes {
|
||||
singleLineComment: RegExp;
|
||||
multiLineCommentOpen: RegExp;
|
||||
multiLineCommentOpenStart: RegExp;
|
||||
multiLineCommentClose: RegExp;
|
||||
multiLineCommentCloseEnd: RegExp;
|
||||
multiLineCommentOpenAndClose: RegExp;
|
||||
}
|
||||
136
node_modules/github-linguist/dist/languages.js
generated
vendored
Normal file
136
node_modules/github-linguist/dist/languages.js
generated
vendored
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Languages = void 0;
|
||||
const utils_1 = require("./utils");
|
||||
// tslint:disable-next-line
|
||||
const languageMap = require('language-map');
|
||||
/**
|
||||
* detecte program language through file extension
|
||||
*
|
||||
* @export
|
||||
* @class LanguageDetector
|
||||
*/
|
||||
class Languages {
|
||||
/**
|
||||
* Creates an instance of Detector.
|
||||
*/
|
||||
constructor() {
|
||||
Object.defineProperty(this, "extensionMap", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: {}
|
||||
});
|
||||
/**
|
||||
* load language before detecting
|
||||
*/
|
||||
Object.defineProperty(this, "loadExtensionMap", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: () => {
|
||||
const extensions = {};
|
||||
Object.keys(languageMap).forEach((language) => {
|
||||
const languageMode = languageMap[language];
|
||||
const languageExtensions = (languageMode && languageMode.extensions) || [];
|
||||
languageExtensions.forEach((extension) => {
|
||||
extensions[extension.toLowerCase()] = language.toLowerCase();
|
||||
});
|
||||
});
|
||||
return Object.assign({}, extensions, utils_1.ExtensionJustify);
|
||||
}
|
||||
});
|
||||
this.extensionMap = this.loadExtensionMap();
|
||||
}
|
||||
/**
|
||||
* Retrieve the regular expressions for a given language.
|
||||
* This is incomplete, but covers most of the languages we
|
||||
* see in the wild.
|
||||
*
|
||||
* @param language the language to retrieve regexes for
|
||||
*/
|
||||
getRegexes(language) {
|
||||
switch (language) {
|
||||
case 'html':
|
||||
case 'xml':
|
||||
return ALL_REGEXES.html;
|
||||
case 'ruby':
|
||||
return ALL_REGEXES.ruby;
|
||||
case 'python':
|
||||
return ALL_REGEXES.python;
|
||||
default:
|
||||
// not exact, but likely the best guess for any other unspecified language.
|
||||
return ALL_REGEXES.c;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* return extension map
|
||||
*/
|
||||
getExtensionMap() {
|
||||
return this.extensionMap;
|
||||
}
|
||||
}
|
||||
exports.Languages = Languages;
|
||||
const ALL_REGEXES = {
|
||||
c: {
|
||||
// matches when // are the first two characters of a line
|
||||
singleLineComment: /^\/\//,
|
||||
// matches when /* exists in a line
|
||||
multiLineCommentOpen: /\/\*/,
|
||||
// matches when /* starts a line
|
||||
multiLineCommentOpenStart: /^\/\*/,
|
||||
// matches when */ exists a line
|
||||
multiLineCommentClose: /\*\//,
|
||||
// matches when */ ends a line
|
||||
multiLineCommentCloseEnd: /\*\/$/,
|
||||
// matches /* ... */
|
||||
multiLineCommentOpenAndClose: /\/\*.*\*\//
|
||||
},
|
||||
python: {
|
||||
// matches when # the first character of a line
|
||||
singleLineComment: /^#/,
|
||||
// matches when """ starts a line. This is not right, since
|
||||
// a multiline string is not always a comment, but for the
|
||||
// sake of simplicity, we will do that here.
|
||||
multiLineCommentOpen: /"""/,
|
||||
// matches when """ starts a line
|
||||
multiLineCommentOpenStart: /^"""/,
|
||||
// matches when """ exists in a line
|
||||
multiLineCommentClose: /"""/,
|
||||
// matches when """ ends a line
|
||||
multiLineCommentCloseEnd: /"""$/,
|
||||
// matches """ ... """
|
||||
multiLineCommentOpenAndClose: /""".*"""/
|
||||
},
|
||||
ruby: {
|
||||
// matches when # the first character of a line
|
||||
singleLineComment: /^#/,
|
||||
// For ruby multiline comments, =begin and =end must be
|
||||
// on their own lines
|
||||
// matches when =begin starts a line
|
||||
multiLineCommentOpen: /^=begin/,
|
||||
// matches when "begin starts a line
|
||||
multiLineCommentOpenStart: /^=begin/,
|
||||
// matches when "end ends a line
|
||||
multiLineCommentClose: /^=end/,
|
||||
// matches when "end ends a line
|
||||
multiLineCommentCloseEnd: /^=end$/,
|
||||
// not possible in ruby
|
||||
multiLineCommentOpenAndClose: /^\0$/
|
||||
},
|
||||
html: {
|
||||
// There is no single line comment
|
||||
singleLineComment: /^\0$/,
|
||||
// matches when =begin starts a line
|
||||
multiLineCommentOpen: /<!--/,
|
||||
// matches when "begin starts a line
|
||||
multiLineCommentOpenStart: /^<!--/,
|
||||
// matches when "end ends a line
|
||||
multiLineCommentClose: /-->/,
|
||||
// matches when "end ends a line
|
||||
multiLineCommentCloseEnd: /-->$/,
|
||||
// matches <!-- ... -->
|
||||
multiLineCommentOpenAndClose: /<!--.*-->/
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=languages.js.map
|
||||
1
node_modules/github-linguist/dist/languages.js.map
generated
vendored
Normal file
1
node_modules/github-linguist/dist/languages.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"languages.js","sourceRoot":"","sources":["../src/languages.ts"],"names":[],"mappings":";;;AAAA,mCAA2C;AAE3C,2BAA2B;AAC3B,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAU5C;;;;;GAKG;AACH,MAAa,SAAS;IAKpB;;OAEG;IACH;QAPA;;;;mBAEI,EAAE;WAAC;QASP;;WAEG;QACH;;;;mBAA2B,GAAG,EAAE;gBAC9B,MAAM,UAAU,GAAoB,EAAE,CAAC;gBAEvC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;oBAC5C,MAAM,YAAY,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;oBAC3C,MAAM,kBAAkB,GAAG,CAAC,YAAY,IAAI,YAAY,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;oBAC3E,kBAAkB,CAAC,OAAO,CAAC,CAAC,SAAiB,EAAE,EAAE;wBAC/C,UAAU,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;oBAC/D,CAAC,CAAC,CAAC;gBACL,CAAC,CAAC,CAAC;gBAEH,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,UAAU,EAAE,wBAAgB,CAAC,CAAC;YACzD,CAAC;WAAA;QAlBC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC9C,CAAC;IAmBD;;;;;;OAMG;IACI,UAAU,CAAC,QAAgB;QAChC,QAAO,QAAQ,EAAE;YACf,KAAK,MAAM,CAAC;YACZ,KAAK,KAAK;gBACR,OAAO,WAAW,CAAC,IAAI,CAAC;YAE1B,KAAK,MAAM;gBACT,OAAO,WAAW,CAAC,IAAI,CAAC;YAE1B,KAAK,QAAQ;gBACX,OAAO,WAAW,CAAC,MAAM,CAAC;YAE5B;gBACE,2EAA2E;gBAC3E,OAAO,WAAW,CAAC,CAAC,CAAC;SACxB;IACH,CAAC;IAED;;OAEG;IACI,eAAe;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;CACF;AA5DD,8BA4DC;AAWD,MAAM,WAAW,GAA4B;IAC3C,CAAC,EAAE;QACD,yDAAyD;QACzD,iBAAiB,EAAE,OAAO;QAE1B,mCAAmC;QACnC,oBAAoB,EAAE,MAAM;QAE5B,gCAAgC;QAChC,yBAAyB,EAAE,OAAO;QAElC,gCAAgC;QAChC,qBAAqB,EAAE,MAAM;QAE7B,8BAA8B;QAC9B,wBAAwB,EAAE,OAAO;QAEjC,oBAAoB;QACpB,4BAA4B,EAAE,YAAY;KAC3C;IAED,MAAM,EAAE;QACN,+CAA+C;QAC/C,iBAAiB,EAAE,IAAI;QAEvB,2DAA2D;QAC3D,0DAA0D;QAC1D,4CAA4C;QAC5C,oBAAoB,EAAE,KAAK;QAE3B,iCAAiC;QACjC,yBAAyB,EAAE,MAAM;QAEjC,oCAAoC;QACpC,qBAAqB,EAAE,KAAK;QAE5B,+BAA+B;QAC/B,wBAAwB,EAAE,MAAM;QAEhC,sBAAsB;QACtB,4BAA4B,EAAE,UAAU;KACzC;IAED,IAAI,EAAE;QACJ,+CAA+C;QAC/C,iBAAiB,EAAE,IAAI;QAEvB,uDAAuD;QACvD,qBAAqB;QAErB,oCAAoC;QACpC,oBAAoB,EAAE,SAAS;QAE/B,oCAAoC;QACpC,yBAAyB,EAAE,SAAS;QAEpC,gCAAgC;QAChC,qBAAqB,EAAE,OAAO;QAE9B,gCAAgC;QAChC,wBAAwB,EAAE,QAAQ;QAElC,uBAAuB;QACvB,4BAA4B,EAAE,MAAM;KACrC;IAED,IAAI,EAAE;QACJ,kCAAkC;QAClC,iBAAiB,EAAE,MAAM;QAEzB,oCAAoC;QACpC,oBAAoB,EAAE,MAAM;QAE5B,oCAAoC;QACpC,yBAAyB,EAAE,OAAO;QAElC,gCAAgC;QAChC,qBAAqB,EAAE,KAAK;QAE5B,gCAAgC;QAChC,wBAAwB,EAAE,MAAM;QAEhC,uBAAuB;QACvB,4BAA4B,EAAE,WAAW;KAC1C;CACF,CAAC"}
|
||||
13
node_modules/github-linguist/dist/utils.d.ts
generated
vendored
Normal file
13
node_modules/github-linguist/dist/utils.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
/**
|
||||
* Get package version.
|
||||
*
|
||||
* @export getVersion
|
||||
* @returns {string}
|
||||
*/
|
||||
export declare function getVersion(): string;
|
||||
export declare const ExtensionJustify: {
|
||||
'.ts': string;
|
||||
'.jsx': string;
|
||||
'.js': string;
|
||||
'.tsx': string;
|
||||
};
|
||||
29
node_modules/github-linguist/dist/utils.js
generated
vendored
Normal file
29
node_modules/github-linguist/dist/utils.js
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ExtensionJustify = exports.getVersion = void 0;
|
||||
const fs_1 = __importDefault(require("fs"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
// @ts-ignore
|
||||
const slash2_1 = __importDefault(require("slash2"));
|
||||
const packagePath = slash2_1.default(path_1.default.join(__dirname, '../', 'package.json'));
|
||||
/**
|
||||
* Get package version.
|
||||
*
|
||||
* @export getVersion
|
||||
* @returns {string}
|
||||
*/
|
||||
function getVersion() {
|
||||
const packageInfo = JSON.parse(fs_1.default.readFileSync(packagePath, 'utf8'));
|
||||
return (packageInfo && packageInfo.version) || 'invalid version!';
|
||||
}
|
||||
exports.getVersion = getVersion;
|
||||
exports.ExtensionJustify = {
|
||||
'.ts': 'typescript',
|
||||
'.jsx': 'javascript',
|
||||
'.js': 'javascript',
|
||||
'.tsx': 'typescript',
|
||||
};
|
||||
//# sourceMappingURL=utils.js.map
|
||||
1
node_modules/github-linguist/dist/utils.js.map
generated
vendored
Normal file
1
node_modules/github-linguist/dist/utils.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,aAAa;AACb,oDAA2B;AAE3B,MAAM,WAAW,GAAG,gBAAK,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC;AAEvE;;;;;GAKG;AACH,SAAgB,UAAU;IACxB,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAE,CAAC,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;IAErE,OAAO,CAAC,WAAW,IAAI,WAAW,CAAC,OAAO,CAAC,IAAI,kBAAkB,CAAC;AACpE,CAAC;AAJD,gCAIC;AAEY,QAAA,gBAAgB,GAAG;IAC9B,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,YAAY;IACpB,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,YAAY;CACrB,CAAC"}
|
||||
6
node_modules/github-linguist/node_modules/array-union/index.js
generated
vendored
Normal file
6
node_modules/github-linguist/node_modules/array-union/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
'use strict';
|
||||
var arrayUniq = require('array-uniq');
|
||||
|
||||
module.exports = function () {
|
||||
return arrayUniq([].concat.apply([], arguments));
|
||||
};
|
||||
21
node_modules/github-linguist/node_modules/array-union/license
generated
vendored
Normal file
21
node_modules/github-linguist/node_modules/array-union/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.
|
||||
40
node_modules/github-linguist/node_modules/array-union/package.json
generated
vendored
Normal file
40
node_modules/github-linguist/node_modules/array-union/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
"name": "array-union",
|
||||
"version": "1.0.2",
|
||||
"description": "Create an array of unique values, in order, from the input arrays",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/array-union",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"array",
|
||||
"arr",
|
||||
"set",
|
||||
"uniq",
|
||||
"unique",
|
||||
"duplicate",
|
||||
"remove",
|
||||
"union",
|
||||
"combine",
|
||||
"merge"
|
||||
],
|
||||
"dependencies": {
|
||||
"array-uniq": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
}
|
||||
}
|
||||
28
node_modules/github-linguist/node_modules/array-union/readme.md
generated
vendored
Normal file
28
node_modules/github-linguist/node_modules/array-union/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# array-union [](https://travis-ci.org/sindresorhus/array-union)
|
||||
|
||||
> Create an array of unique values, in order, from the input arrays
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save array-union
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const arrayUnion = require('array-union');
|
||||
|
||||
arrayUnion([1, 1, 2, 3], [2, 3]);
|
||||
//=> [1, 2, 3]
|
||||
|
||||
arrayUnion(['foo', 'foo', 'bar'], ['foo']);
|
||||
//=> ['foo', 'bar']
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
419
node_modules/github-linguist/node_modules/commander/CHANGELOG.md
generated
vendored
Normal file
419
node_modules/github-linguist/node_modules/commander/CHANGELOG.md
generated
vendored
Normal file
|
|
@ -0,0 +1,419 @@
|
|||
2.20.3 / 2019-10-11
|
||||
==================
|
||||
|
||||
* Support Node.js 0.10 (Revert #1059)
|
||||
* Ran "npm unpublish commander@2.20.2". There is no 2.20.2.
|
||||
|
||||
2.20.1 / 2019-09-29
|
||||
==================
|
||||
|
||||
* Improve executable subcommand tracking
|
||||
* Update dev dependencies
|
||||
|
||||
2.20.0 / 2019-04-02
|
||||
==================
|
||||
|
||||
* fix: resolve symbolic links completely when hunting for subcommands (#935)
|
||||
* Update index.d.ts (#930)
|
||||
* Update Readme.md (#924)
|
||||
* Remove --save option as it isn't required anymore (#918)
|
||||
* Add link to the license file (#900)
|
||||
* Added example of receiving args from options (#858)
|
||||
* Added missing semicolon (#882)
|
||||
* Add extension to .eslintrc (#876)
|
||||
|
||||
2.19.0 / 2018-10-02
|
||||
==================
|
||||
|
||||
* Removed newline after Options and Commands headers (#864)
|
||||
* Bugfix - Error output (#862)
|
||||
* Fix to change default value to string (#856)
|
||||
|
||||
2.18.0 / 2018-09-07
|
||||
==================
|
||||
|
||||
* Standardize help output (#853)
|
||||
* chmod 644 travis.yml (#851)
|
||||
* add support for execute typescript subcommand via ts-node (#849)
|
||||
|
||||
2.17.1 / 2018-08-07
|
||||
==================
|
||||
|
||||
* Fix bug in command emit (#844)
|
||||
|
||||
2.17.0 / 2018-08-03
|
||||
==================
|
||||
|
||||
* fixed newline output after help information (#833)
|
||||
* Fix to emit the action even without command (#778)
|
||||
* npm update (#823)
|
||||
|
||||
2.16.0 / 2018-06-29
|
||||
==================
|
||||
|
||||
* Remove Makefile and `test/run` (#821)
|
||||
* Make 'npm test' run on Windows (#820)
|
||||
* Add badge to display install size (#807)
|
||||
* chore: cache node_modules (#814)
|
||||
* chore: remove Node.js 4 (EOL), add Node.js 10 (#813)
|
||||
* fixed typo in readme (#812)
|
||||
* Fix types (#804)
|
||||
* Update eslint to resolve vulnerabilities in lodash (#799)
|
||||
* updated readme with custom event listeners. (#791)
|
||||
* fix tests (#794)
|
||||
|
||||
2.15.0 / 2018-03-07
|
||||
==================
|
||||
|
||||
* Update downloads badge to point to graph of downloads over time instead of duplicating link to npm
|
||||
* Arguments description
|
||||
|
||||
2.14.1 / 2018-02-07
|
||||
==================
|
||||
|
||||
* Fix typing of help function
|
||||
|
||||
2.14.0 / 2018-02-05
|
||||
==================
|
||||
|
||||
* only register the option:version event once
|
||||
* Fixes issue #727: Passing empty string for option on command is set to undefined
|
||||
* enable eqeqeq rule
|
||||
* resolves #754 add linter configuration to project
|
||||
* resolves #560 respect custom name for version option
|
||||
* document how to override the version flag
|
||||
* document using options per command
|
||||
|
||||
2.13.0 / 2018-01-09
|
||||
==================
|
||||
|
||||
* Do not print default for --no-
|
||||
* remove trailing spaces in command help
|
||||
* Update CI's Node.js to LTS and latest version
|
||||
* typedefs: Command and Option types added to commander namespace
|
||||
|
||||
2.12.2 / 2017-11-28
|
||||
==================
|
||||
|
||||
* fix: typings are not shipped
|
||||
|
||||
2.12.1 / 2017-11-23
|
||||
==================
|
||||
|
||||
* Move @types/node to dev dependency
|
||||
|
||||
2.12.0 / 2017-11-22
|
||||
==================
|
||||
|
||||
* add attributeName() method to Option objects
|
||||
* Documentation updated for options with --no prefix
|
||||
* typings: `outputHelp` takes a string as the first parameter
|
||||
* typings: use overloads
|
||||
* feat(typings): update to match js api
|
||||
* Print default value in option help
|
||||
* Fix translation error
|
||||
* Fail when using same command and alias (#491)
|
||||
* feat(typings): add help callback
|
||||
* fix bug when description is add after command with options (#662)
|
||||
* Format js code
|
||||
* Rename History.md to CHANGELOG.md (#668)
|
||||
* feat(typings): add typings to support TypeScript (#646)
|
||||
* use current node
|
||||
|
||||
2.11.0 / 2017-07-03
|
||||
==================
|
||||
|
||||
* Fix help section order and padding (#652)
|
||||
* feature: support for signals to subcommands (#632)
|
||||
* Fixed #37, --help should not display first (#447)
|
||||
* Fix translation errors. (#570)
|
||||
* Add package-lock.json
|
||||
* Remove engines
|
||||
* Upgrade package version
|
||||
* Prefix events to prevent conflicts between commands and options (#494)
|
||||
* Removing dependency on graceful-readlink
|
||||
* Support setting name in #name function and make it chainable
|
||||
* Add .vscode directory to .gitignore (Visual Studio Code metadata)
|
||||
* Updated link to ruby commander in readme files
|
||||
|
||||
2.10.0 / 2017-06-19
|
||||
==================
|
||||
|
||||
* Update .travis.yml. drop support for older node.js versions.
|
||||
* Fix require arguments in README.md
|
||||
* On SemVer you do not start from 0.0.1
|
||||
* Add missing semi colon in readme
|
||||
* Add save param to npm install
|
||||
* node v6 travis test
|
||||
* Update Readme_zh-CN.md
|
||||
* Allow literal '--' to be passed-through as an argument
|
||||
* Test subcommand alias help
|
||||
* link build badge to master branch
|
||||
* Support the alias of Git style sub-command
|
||||
* added keyword commander for better search result on npm
|
||||
* Fix Sub-Subcommands
|
||||
* test node.js stable
|
||||
* Fixes TypeError when a command has an option called `--description`
|
||||
* Update README.md to make it beginner friendly and elaborate on the difference between angled and square brackets.
|
||||
* Add chinese Readme file
|
||||
|
||||
2.9.0 / 2015-10-13
|
||||
==================
|
||||
|
||||
* Add option `isDefault` to set default subcommand #415 @Qix-
|
||||
* Add callback to allow filtering or post-processing of help text #434 @djulien
|
||||
* Fix `undefined` text in help information close #414 #416 @zhiyelee
|
||||
|
||||
2.8.1 / 2015-04-22
|
||||
==================
|
||||
|
||||
* Back out `support multiline description` Close #396 #397
|
||||
|
||||
2.8.0 / 2015-04-07
|
||||
==================
|
||||
|
||||
* Add `process.execArg` support, execution args like `--harmony` will be passed to sub-commands #387 @DigitalIO @zhiyelee
|
||||
* Fix bug in Git-style sub-commands #372 @zhiyelee
|
||||
* Allow commands to be hidden from help #383 @tonylukasavage
|
||||
* When git-style sub-commands are in use, yet none are called, display help #382 @claylo
|
||||
* Add ability to specify arguments syntax for top-level command #258 @rrthomas
|
||||
* Support multiline descriptions #208 @zxqfox
|
||||
|
||||
2.7.1 / 2015-03-11
|
||||
==================
|
||||
|
||||
* Revert #347 (fix collisions when option and first arg have same name) which causes a bug in #367.
|
||||
|
||||
2.7.0 / 2015-03-09
|
||||
==================
|
||||
|
||||
* Fix git-style bug when installed globally. Close #335 #349 @zhiyelee
|
||||
* Fix collisions when option and first arg have same name. Close #346 #347 @tonylukasavage
|
||||
* Add support for camelCase on `opts()`. Close #353 @nkzawa
|
||||
* Add node.js 0.12 and io.js to travis.yml
|
||||
* Allow RegEx options. #337 @palanik
|
||||
* Fixes exit code when sub-command failing. Close #260 #332 @pirelenito
|
||||
* git-style `bin` files in $PATH make sense. Close #196 #327 @zhiyelee
|
||||
|
||||
2.6.0 / 2014-12-30
|
||||
==================
|
||||
|
||||
* added `Command#allowUnknownOption` method. Close #138 #318 @doozr @zhiyelee
|
||||
* Add application description to the help msg. Close #112 @dalssoft
|
||||
|
||||
2.5.1 / 2014-12-15
|
||||
==================
|
||||
|
||||
* fixed two bugs incurred by variadic arguments. Close #291 @Quentin01 #302 @zhiyelee
|
||||
|
||||
2.5.0 / 2014-10-24
|
||||
==================
|
||||
|
||||
* add support for variadic arguments. Closes #277 @whitlockjc
|
||||
|
||||
2.4.0 / 2014-10-17
|
||||
==================
|
||||
|
||||
* fixed a bug on executing the coercion function of subcommands option. Closes #270
|
||||
* added `Command.prototype.name` to retrieve command name. Closes #264 #266 @tonylukasavage
|
||||
* added `Command.prototype.opts` to retrieve all the options as a simple object of key-value pairs. Closes #262 @tonylukasavage
|
||||
* fixed a bug on subcommand name. Closes #248 @jonathandelgado
|
||||
* fixed function normalize doesn’t honor option terminator. Closes #216 @abbr
|
||||
|
||||
2.3.0 / 2014-07-16
|
||||
==================
|
||||
|
||||
* add command alias'. Closes PR #210
|
||||
* fix: Typos. Closes #99
|
||||
* fix: Unused fs module. Closes #217
|
||||
|
||||
2.2.0 / 2014-03-29
|
||||
==================
|
||||
|
||||
* add passing of previous option value
|
||||
* fix: support subcommands on windows. Closes #142
|
||||
* Now the defaultValue passed as the second argument of the coercion function.
|
||||
|
||||
2.1.0 / 2013-11-21
|
||||
==================
|
||||
|
||||
* add: allow cflag style option params, unit test, fixes #174
|
||||
|
||||
2.0.0 / 2013-07-18
|
||||
==================
|
||||
|
||||
* remove input methods (.prompt, .confirm, etc)
|
||||
|
||||
1.3.2 / 2013-07-18
|
||||
==================
|
||||
|
||||
* add support for sub-commands to co-exist with the original command
|
||||
|
||||
1.3.1 / 2013-07-18
|
||||
==================
|
||||
|
||||
* add quick .runningCommand hack so you can opt-out of other logic when running a sub command
|
||||
|
||||
1.3.0 / 2013-07-09
|
||||
==================
|
||||
|
||||
* add EACCES error handling
|
||||
* fix sub-command --help
|
||||
|
||||
1.2.0 / 2013-06-13
|
||||
==================
|
||||
|
||||
* allow "-" hyphen as an option argument
|
||||
* support for RegExp coercion
|
||||
|
||||
1.1.1 / 2012-11-20
|
||||
==================
|
||||
|
||||
* add more sub-command padding
|
||||
* fix .usage() when args are present. Closes #106
|
||||
|
||||
1.1.0 / 2012-11-16
|
||||
==================
|
||||
|
||||
* add git-style executable subcommand support. Closes #94
|
||||
|
||||
1.0.5 / 2012-10-09
|
||||
==================
|
||||
|
||||
* fix `--name` clobbering. Closes #92
|
||||
* fix examples/help. Closes #89
|
||||
|
||||
1.0.4 / 2012-09-03
|
||||
==================
|
||||
|
||||
* add `outputHelp()` method.
|
||||
|
||||
1.0.3 / 2012-08-30
|
||||
==================
|
||||
|
||||
* remove invalid .version() defaulting
|
||||
|
||||
1.0.2 / 2012-08-24
|
||||
==================
|
||||
|
||||
* add `--foo=bar` support [arv]
|
||||
* fix password on node 0.8.8. Make backward compatible with 0.6 [focusaurus]
|
||||
|
||||
1.0.1 / 2012-08-03
|
||||
==================
|
||||
|
||||
* fix issue #56
|
||||
* fix tty.setRawMode(mode) was moved to tty.ReadStream#setRawMode() (i.e. process.stdin.setRawMode())
|
||||
|
||||
1.0.0 / 2012-07-05
|
||||
==================
|
||||
|
||||
* add support for optional option descriptions
|
||||
* add defaulting of `.version()` to package.json's version
|
||||
|
||||
0.6.1 / 2012-06-01
|
||||
==================
|
||||
|
||||
* Added: append (yes or no) on confirmation
|
||||
* Added: allow node.js v0.7.x
|
||||
|
||||
0.6.0 / 2012-04-10
|
||||
==================
|
||||
|
||||
* Added `.prompt(obj, callback)` support. Closes #49
|
||||
* Added default support to .choose(). Closes #41
|
||||
* Fixed the choice example
|
||||
|
||||
0.5.1 / 2011-12-20
|
||||
==================
|
||||
|
||||
* Fixed `password()` for recent nodes. Closes #36
|
||||
|
||||
0.5.0 / 2011-12-04
|
||||
==================
|
||||
|
||||
* Added sub-command option support [itay]
|
||||
|
||||
0.4.3 / 2011-12-04
|
||||
==================
|
||||
|
||||
* Fixed custom help ordering. Closes #32
|
||||
|
||||
0.4.2 / 2011-11-24
|
||||
==================
|
||||
|
||||
* Added travis support
|
||||
* Fixed: line-buffered input automatically trimmed. Closes #31
|
||||
|
||||
0.4.1 / 2011-11-18
|
||||
==================
|
||||
|
||||
* Removed listening for "close" on --help
|
||||
|
||||
0.4.0 / 2011-11-15
|
||||
==================
|
||||
|
||||
* Added support for `--`. Closes #24
|
||||
|
||||
0.3.3 / 2011-11-14
|
||||
==================
|
||||
|
||||
* Fixed: wait for close event when writing help info [Jerry Hamlet]
|
||||
|
||||
0.3.2 / 2011-11-01
|
||||
==================
|
||||
|
||||
* Fixed long flag definitions with values [felixge]
|
||||
|
||||
0.3.1 / 2011-10-31
|
||||
==================
|
||||
|
||||
* Changed `--version` short flag to `-V` from `-v`
|
||||
* Changed `.version()` so it's configurable [felixge]
|
||||
|
||||
0.3.0 / 2011-10-31
|
||||
==================
|
||||
|
||||
* Added support for long flags only. Closes #18
|
||||
|
||||
0.2.1 / 2011-10-24
|
||||
==================
|
||||
|
||||
* "node": ">= 0.4.x < 0.7.0". Closes #20
|
||||
|
||||
0.2.0 / 2011-09-26
|
||||
==================
|
||||
|
||||
* Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs]
|
||||
|
||||
0.1.0 / 2011-08-24
|
||||
==================
|
||||
|
||||
* Added support for custom `--help` output
|
||||
|
||||
0.0.5 / 2011-08-18
|
||||
==================
|
||||
|
||||
* Changed: when the user enters nothing prompt for password again
|
||||
* Fixed issue with passwords beginning with numbers [NuckChorris]
|
||||
|
||||
0.0.4 / 2011-08-15
|
||||
==================
|
||||
|
||||
* Fixed `Commander#args`
|
||||
|
||||
0.0.3 / 2011-08-15
|
||||
==================
|
||||
|
||||
* Added default option value support
|
||||
|
||||
0.0.2 / 2011-08-15
|
||||
==================
|
||||
|
||||
* Added mask support to `Command#password(str[, mask], fn)`
|
||||
* Added `Command#password(str, fn)`
|
||||
|
||||
0.0.1 / 2010-01-03
|
||||
==================
|
||||
|
||||
* Initial release
|
||||
22
node_modules/github-linguist/node_modules/commander/LICENSE
generated
vendored
Normal file
22
node_modules/github-linguist/node_modules/commander/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
(The MIT License)
|
||||
|
||||
Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
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.
|
||||
428
node_modules/github-linguist/node_modules/commander/Readme.md
generated
vendored
Normal file
428
node_modules/github-linguist/node_modules/commander/Readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,428 @@
|
|||
# Commander.js
|
||||
|
||||
|
||||
[](http://travis-ci.org/tj/commander.js)
|
||||
[](https://www.npmjs.org/package/commander)
|
||||
[](https://npmcharts.com/compare/commander?minimal=true)
|
||||
[](https://packagephobia.now.sh/result?p=commander)
|
||||
[](https://gitter.im/tj/commander.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/commander-rb/commander).
|
||||
[API documentation](http://tj.github.com/commander.js/)
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
$ npm install commander
|
||||
|
||||
## Option parsing
|
||||
|
||||
Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.
|
||||
|
||||
```js
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var program = require('commander');
|
||||
|
||||
program
|
||||
.version('0.1.0')
|
||||
.option('-p, --peppers', 'Add peppers')
|
||||
.option('-P, --pineapple', 'Add pineapple')
|
||||
.option('-b, --bbq-sauce', 'Add bbq sauce')
|
||||
.option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')
|
||||
.parse(process.argv);
|
||||
|
||||
console.log('you ordered a pizza with:');
|
||||
if (program.peppers) console.log(' - peppers');
|
||||
if (program.pineapple) console.log(' - pineapple');
|
||||
if (program.bbqSauce) console.log(' - bbq');
|
||||
console.log(' - %s cheese', program.cheese);
|
||||
```
|
||||
|
||||
Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc.
|
||||
|
||||
Note that multi-word options starting with `--no` prefix negate the boolean value of the following word. For example, `--no-sauce` sets the value of `program.sauce` to false.
|
||||
|
||||
```js
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var program = require('commander');
|
||||
|
||||
program
|
||||
.option('--no-sauce', 'Remove sauce')
|
||||
.parse(process.argv);
|
||||
|
||||
console.log('you ordered a pizza');
|
||||
if (program.sauce) console.log(' with sauce');
|
||||
else console.log(' without sauce');
|
||||
```
|
||||
|
||||
To get string arguments from options you will need to use angle brackets <> for required inputs or square brackets [] for optional inputs.
|
||||
|
||||
e.g. ```.option('-m --myarg [myVar]', 'my super cool description')```
|
||||
|
||||
Then to access the input if it was passed in.
|
||||
|
||||
e.g. ```var myInput = program.myarg```
|
||||
|
||||
**NOTE**: If you pass a argument without using brackets the example above will return true and not the value passed in.
|
||||
|
||||
|
||||
## Version option
|
||||
|
||||
Calling the `version` implicitly adds the `-V` and `--version` options to the command.
|
||||
When either of these options is present, the command prints the version number and exits.
|
||||
|
||||
$ ./examples/pizza -V
|
||||
0.0.1
|
||||
|
||||
If you want your program to respond to the `-v` option instead of the `-V` option, simply pass custom flags to the `version` method using the same syntax as the `option` method.
|
||||
|
||||
```js
|
||||
program
|
||||
.version('0.0.1', '-v, --version')
|
||||
```
|
||||
|
||||
The version flags can be named anything, but the long option is required.
|
||||
|
||||
## Command-specific options
|
||||
|
||||
You can attach options to a command.
|
||||
|
||||
```js
|
||||
#!/usr/bin/env node
|
||||
|
||||
var program = require('commander');
|
||||
|
||||
program
|
||||
.command('rm <dir>')
|
||||
.option('-r, --recursive', 'Remove recursively')
|
||||
.action(function (dir, cmd) {
|
||||
console.log('remove ' + dir + (cmd.recursive ? ' recursively' : ''))
|
||||
})
|
||||
|
||||
program.parse(process.argv)
|
||||
```
|
||||
|
||||
A command's options are validated when the command is used. Any unknown options will be reported as an error. However, if an action-based command does not define an action, then the options are not validated.
|
||||
|
||||
## Coercion
|
||||
|
||||
```js
|
||||
function range(val) {
|
||||
return val.split('..').map(Number);
|
||||
}
|
||||
|
||||
function list(val) {
|
||||
return val.split(',');
|
||||
}
|
||||
|
||||
function collect(val, memo) {
|
||||
memo.push(val);
|
||||
return memo;
|
||||
}
|
||||
|
||||
function increaseVerbosity(v, total) {
|
||||
return total + 1;
|
||||
}
|
||||
|
||||
program
|
||||
.version('0.1.0')
|
||||
.usage('[options] <file ...>')
|
||||
.option('-i, --integer <n>', 'An integer argument', parseInt)
|
||||
.option('-f, --float <n>', 'A float argument', parseFloat)
|
||||
.option('-r, --range <a>..<b>', 'A range', range)
|
||||
.option('-l, --list <items>', 'A list', list)
|
||||
.option('-o, --optional [value]', 'An optional value')
|
||||
.option('-c, --collect [value]', 'A repeatable value', collect, [])
|
||||
.option('-v, --verbose', 'A value that can be increased', increaseVerbosity, 0)
|
||||
.parse(process.argv);
|
||||
|
||||
console.log(' int: %j', program.integer);
|
||||
console.log(' float: %j', program.float);
|
||||
console.log(' optional: %j', program.optional);
|
||||
program.range = program.range || [];
|
||||
console.log(' range: %j..%j', program.range[0], program.range[1]);
|
||||
console.log(' list: %j', program.list);
|
||||
console.log(' collect: %j', program.collect);
|
||||
console.log(' verbosity: %j', program.verbose);
|
||||
console.log(' args: %j', program.args);
|
||||
```
|
||||
|
||||
## Regular Expression
|
||||
```js
|
||||
program
|
||||
.version('0.1.0')
|
||||
.option('-s --size <size>', 'Pizza size', /^(large|medium|small)$/i, 'medium')
|
||||
.option('-d --drink [drink]', 'Drink', /^(coke|pepsi|izze)$/i)
|
||||
.parse(process.argv);
|
||||
|
||||
console.log(' size: %j', program.size);
|
||||
console.log(' drink: %j', program.drink);
|
||||
```
|
||||
|
||||
## Variadic arguments
|
||||
|
||||
The last argument of a command can be variadic, and only the last argument. To make an argument variadic you have to
|
||||
append `...` to the argument name. Here is an example:
|
||||
|
||||
```js
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var program = require('commander');
|
||||
|
||||
program
|
||||
.version('0.1.0')
|
||||
.command('rmdir <dir> [otherDirs...]')
|
||||
.action(function (dir, otherDirs) {
|
||||
console.log('rmdir %s', dir);
|
||||
if (otherDirs) {
|
||||
otherDirs.forEach(function (oDir) {
|
||||
console.log('rmdir %s', oDir);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
```
|
||||
|
||||
An `Array` is used for the value of a variadic argument. This applies to `program.args` as well as the argument passed
|
||||
to your action as demonstrated above.
|
||||
|
||||
## Specify the argument syntax
|
||||
|
||||
```js
|
||||
#!/usr/bin/env node
|
||||
|
||||
var program = require('commander');
|
||||
|
||||
program
|
||||
.version('0.1.0')
|
||||
.arguments('<cmd> [env]')
|
||||
.action(function (cmd, env) {
|
||||
cmdValue = cmd;
|
||||
envValue = env;
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
|
||||
if (typeof cmdValue === 'undefined') {
|
||||
console.error('no command given!');
|
||||
process.exit(1);
|
||||
}
|
||||
console.log('command:', cmdValue);
|
||||
console.log('environment:', envValue || "no environment given");
|
||||
```
|
||||
Angled brackets (e.g. `<cmd>`) indicate required input. Square brackets (e.g. `[env]`) indicate optional input.
|
||||
|
||||
## Git-style sub-commands
|
||||
|
||||
```js
|
||||
// file: ./examples/pm
|
||||
var program = require('commander');
|
||||
|
||||
program
|
||||
.version('0.1.0')
|
||||
.command('install [name]', 'install one or more packages')
|
||||
.command('search [query]', 'search with optional query')
|
||||
.command('list', 'list packages installed', {isDefault: true})
|
||||
.parse(process.argv);
|
||||
```
|
||||
|
||||
When `.command()` is invoked with a description argument, no `.action(callback)` should be called to handle sub-commands, otherwise there will be an error. This tells commander that you're going to use separate executables for sub-commands, much like `git(1)` and other popular tools.
|
||||
The commander will try to search the executables in the directory of the entry script (like `./examples/pm`) with the name `program-command`, like `pm-install`, `pm-search`.
|
||||
|
||||
Options can be passed with the call to `.command()`. Specifying `true` for `opts.noHelp` will remove the subcommand from the generated help output. Specifying `true` for `opts.isDefault` will run the subcommand if no other subcommand is specified.
|
||||
|
||||
If the program is designed to be installed globally, make sure the executables have proper modes, like `755`.
|
||||
|
||||
### `--harmony`
|
||||
|
||||
You can enable `--harmony` option in two ways:
|
||||
* Use `#! /usr/bin/env node --harmony` in the sub-commands scripts. Note some os version don’t support this pattern.
|
||||
* Use the `--harmony` option when call the command, like `node --harmony examples/pm publish`. The `--harmony` option will be preserved when spawning sub-command process.
|
||||
|
||||
## Automated --help
|
||||
|
||||
The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:
|
||||
|
||||
```
|
||||
$ ./examples/pizza --help
|
||||
Usage: pizza [options]
|
||||
|
||||
An application for pizzas ordering
|
||||
|
||||
Options:
|
||||
-h, --help output usage information
|
||||
-V, --version output the version number
|
||||
-p, --peppers Add peppers
|
||||
-P, --pineapple Add pineapple
|
||||
-b, --bbq Add bbq sauce
|
||||
-c, --cheese <type> Add the specified type of cheese [marble]
|
||||
-C, --no-cheese You do not want any cheese
|
||||
```
|
||||
|
||||
## Custom help
|
||||
|
||||
You can display arbitrary `-h, --help` information
|
||||
by listening for "--help". Commander will automatically
|
||||
exit once you are done so that the remainder of your program
|
||||
does not execute causing undesired behaviors, for example
|
||||
in the following executable "stuff" will not output when
|
||||
`--help` is used.
|
||||
|
||||
```js
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var program = require('commander');
|
||||
|
||||
program
|
||||
.version('0.1.0')
|
||||
.option('-f, --foo', 'enable some foo')
|
||||
.option('-b, --bar', 'enable some bar')
|
||||
.option('-B, --baz', 'enable some baz');
|
||||
|
||||
// must be before .parse() since
|
||||
// node's emit() is immediate
|
||||
|
||||
program.on('--help', function(){
|
||||
console.log('')
|
||||
console.log('Examples:');
|
||||
console.log(' $ custom-help --help');
|
||||
console.log(' $ custom-help -h');
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
|
||||
console.log('stuff');
|
||||
```
|
||||
|
||||
Yields the following help output when `node script-name.js -h` or `node script-name.js --help` are run:
|
||||
|
||||
```
|
||||
Usage: custom-help [options]
|
||||
|
||||
Options:
|
||||
-h, --help output usage information
|
||||
-V, --version output the version number
|
||||
-f, --foo enable some foo
|
||||
-b, --bar enable some bar
|
||||
-B, --baz enable some baz
|
||||
|
||||
Examples:
|
||||
$ custom-help --help
|
||||
$ custom-help -h
|
||||
```
|
||||
|
||||
## .outputHelp(cb)
|
||||
|
||||
Output help information without exiting.
|
||||
Optional callback cb allows post-processing of help text before it is displayed.
|
||||
|
||||
If you want to display help by default (e.g. if no command was provided), you can use something like:
|
||||
|
||||
```js
|
||||
var program = require('commander');
|
||||
var colors = require('colors');
|
||||
|
||||
program
|
||||
.version('0.1.0')
|
||||
.command('getstream [url]', 'get stream URL')
|
||||
.parse(process.argv);
|
||||
|
||||
if (!process.argv.slice(2).length) {
|
||||
program.outputHelp(make_red);
|
||||
}
|
||||
|
||||
function make_red(txt) {
|
||||
return colors.red(txt); //display the help text in red on the console
|
||||
}
|
||||
```
|
||||
|
||||
## .help(cb)
|
||||
|
||||
Output help information and exit immediately.
|
||||
Optional callback cb allows post-processing of help text before it is displayed.
|
||||
|
||||
|
||||
## Custom event listeners
|
||||
You can execute custom actions by listening to command and option events.
|
||||
|
||||
```js
|
||||
program.on('option:verbose', function () {
|
||||
process.env.VERBOSE = this.verbose;
|
||||
});
|
||||
|
||||
// error on unknown commands
|
||||
program.on('command:*', function () {
|
||||
console.error('Invalid command: %s\nSee --help for a list of available commands.', program.args.join(' '));
|
||||
process.exit(1);
|
||||
});
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
```js
|
||||
var program = require('commander');
|
||||
|
||||
program
|
||||
.version('0.1.0')
|
||||
.option('-C, --chdir <path>', 'change the working directory')
|
||||
.option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
|
||||
.option('-T, --no-tests', 'ignore test hook');
|
||||
|
||||
program
|
||||
.command('setup [env]')
|
||||
.description('run setup commands for all envs')
|
||||
.option("-s, --setup_mode [mode]", "Which setup mode to use")
|
||||
.action(function(env, options){
|
||||
var mode = options.setup_mode || "normal";
|
||||
env = env || 'all';
|
||||
console.log('setup for %s env(s) with %s mode', env, mode);
|
||||
});
|
||||
|
||||
program
|
||||
.command('exec <cmd>')
|
||||
.alias('ex')
|
||||
.description('execute the given remote cmd')
|
||||
.option("-e, --exec_mode <mode>", "Which exec mode to use")
|
||||
.action(function(cmd, options){
|
||||
console.log('exec "%s" using %s mode', cmd, options.exec_mode);
|
||||
}).on('--help', function() {
|
||||
console.log('');
|
||||
console.log('Examples:');
|
||||
console.log('');
|
||||
console.log(' $ deploy exec sequential');
|
||||
console.log(' $ deploy exec async');
|
||||
});
|
||||
|
||||
program
|
||||
.command('*')
|
||||
.action(function(env){
|
||||
console.log('deploying "%s"', env);
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
```
|
||||
|
||||
More Demos can be found in the [examples](https://github.com/tj/commander.js/tree/master/examples) directory.
|
||||
|
||||
## License
|
||||
|
||||
[MIT](https://github.com/tj/commander.js/blob/master/LICENSE)
|
||||
1224
node_modules/github-linguist/node_modules/commander/index.js
generated
vendored
Normal file
1224
node_modules/github-linguist/node_modules/commander/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
38
node_modules/github-linguist/node_modules/commander/package.json
generated
vendored
Normal file
38
node_modules/github-linguist/node_modules/commander/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"name": "commander",
|
||||
"version": "2.20.3",
|
||||
"description": "the complete solution for node.js command-line programs",
|
||||
"keywords": [
|
||||
"commander",
|
||||
"command",
|
||||
"option",
|
||||
"parser"
|
||||
],
|
||||
"author": "TJ Holowaychuk <tj@vision-media.ca>",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/tj/commander.js.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint index.js",
|
||||
"test": "node test/run.js && npm run test-typings",
|
||||
"test-typings": "tsc -p tsconfig.json"
|
||||
},
|
||||
"main": "index",
|
||||
"files": [
|
||||
"index.js",
|
||||
"typings/index.d.ts"
|
||||
],
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.7.8",
|
||||
"eslint": "^6.4.0",
|
||||
"should": "^13.2.3",
|
||||
"sinon": "^7.5.0",
|
||||
"standard": "^14.3.1",
|
||||
"ts-node": "^8.4.1",
|
||||
"typescript": "^3.6.3"
|
||||
},
|
||||
"typings": "typings/index.d.ts"
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue