Improve README and action.yml

This commit is contained in:
Michal Dorner 2021-01-23 11:51:25 +01:00
parent 8fdf2aead9
commit 92cb68e21e
No known key found for this signature in database
GPG key ID: 9EEE04B48DA36786
7 changed files with 299 additions and 80 deletions

95
dist/index.js generated vendored
View file

@ -3536,6 +3536,7 @@ function copyFile(srcFile, destFile, force) {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
const fs = __nccwpck_require__(5747);
exports.FILE_SYSTEM_ADAPTER = {
lstat: fs.lstat,
@ -3562,6 +3563,7 @@ exports.createFileSystemAdapter = createFileSystemAdapter;
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0;
const NODE_PROCESS_VERSION_PARTS = process.versions.node.split('.');
const MAJOR_VERSION = parseInt(NODE_PROCESS_VERSION_PARTS[0], 10);
const MINOR_VERSION = parseInt(NODE_PROCESS_VERSION_PARTS[1], 10);
@ -3583,6 +3585,7 @@ exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_B
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Settings = exports.scandirSync = exports.scandir = void 0;
const async = __nccwpck_require__(4507);
const sync = __nccwpck_require__(9560);
const settings_1 = __nccwpck_require__(8662);
@ -3615,10 +3618,12 @@ function getSettings(settingsOrOptions = {}) {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.readdir = exports.readdirWithFileTypes = exports.read = void 0;
const fsStat = __nccwpck_require__(109);
const rpl = __nccwpck_require__(5288);
const constants_1 = __nccwpck_require__(8838);
const utils = __nccwpck_require__(6297);
const common = __nccwpck_require__(3847);
function read(directory, settings, callback) {
if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
return readdirWithFileTypes(directory, settings, callback);
@ -3634,7 +3639,7 @@ function readdirWithFileTypes(directory, settings, callback) {
const entries = dirents.map((dirent) => ({
dirent,
name: dirent.name,
path: `${directory}${settings.pathSegmentSeparator}${dirent.name}`
path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
}));
if (!settings.followSymbolicLinks) {
return callSuccessCallback(callback, entries);
@ -3671,7 +3676,7 @@ function readdir(directory, settings, callback) {
if (readdirError !== null) {
return callFailureCallback(callback, readdirError);
}
const filepaths = names.map((name) => `${directory}${settings.pathSegmentSeparator}${name}`);
const filepaths = names.map((name) => common.joinPathSegments(directory, name, settings.pathSegmentSeparator));
const tasks = filepaths.map((filepath) => {
return (done) => fsStat.stat(filepath, settings.fsStatSettings, done);
});
@ -3705,6 +3710,27 @@ function callSuccessCallback(callback, result) {
}
/***/ }),
/***/ 3847:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.joinPathSegments = void 0;
function joinPathSegments(a, b, separator) {
/**
* The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`).
*/
if (a.endsWith(separator)) {
return a + b;
}
return a + separator + b;
}
exports.joinPathSegments = joinPathSegments;
/***/ }),
/***/ 9560:
@ -3713,9 +3739,11 @@ function callSuccessCallback(callback, result) {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.readdir = exports.readdirWithFileTypes = exports.read = void 0;
const fsStat = __nccwpck_require__(109);
const constants_1 = __nccwpck_require__(8838);
const utils = __nccwpck_require__(6297);
const common = __nccwpck_require__(3847);
function read(directory, settings) {
if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
return readdirWithFileTypes(directory, settings);
@ -3729,7 +3757,7 @@ function readdirWithFileTypes(directory, settings) {
const entry = {
dirent,
name: dirent.name,
path: `${directory}${settings.pathSegmentSeparator}${dirent.name}`
path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
};
if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) {
try {
@ -3749,7 +3777,7 @@ exports.readdirWithFileTypes = readdirWithFileTypes;
function readdir(directory, settings) {
const names = settings.fs.readdirSync(directory);
return names.map((name) => {
const entryPath = `${directory}${settings.pathSegmentSeparator}${name}`;
const entryPath = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
const stats = fsStat.statSync(entryPath, settings.fsStatSettings);
const entry = {
name,
@ -3791,7 +3819,7 @@ class Settings {
});
}
_getValue(option, value) {
return option === undefined ? value : option;
return option !== null && option !== void 0 ? option : value;
}
}
exports.default = Settings;
@ -3805,6 +3833,7 @@ exports.default = Settings;
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.createDirentFromStats = void 0;
class DirentFromStats {
constructor(name, stats) {
this.name = name;
@ -3831,6 +3860,7 @@ exports.createDirentFromStats = createDirentFromStats;
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.fs = void 0;
const fs = __nccwpck_require__(883);
exports.fs = fs;
@ -3843,6 +3873,7 @@ exports.fs = fs;
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
const fs = __nccwpck_require__(5747);
exports.FILE_SYSTEM_ADAPTER = {
lstat: fs.lstat,
@ -3867,6 +3898,7 @@ exports.createFileSystemAdapter = createFileSystemAdapter;
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.statSync = exports.stat = exports.Settings = void 0;
const async = __nccwpck_require__(4147);
const sync = __nccwpck_require__(4527);
const settings_1 = __nccwpck_require__(2410);
@ -3899,6 +3931,7 @@ function getSettings(settingsOrOptions = {}) {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.read = void 0;
function read(path, settings, callback) {
settings.fs.lstat(path, (lstatError, lstat) => {
if (lstatError !== null) {
@ -3938,6 +3971,7 @@ function callSuccessCallback(callback, result) {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.read = void 0;
function read(path, settings) {
const lstat = settings.fs.lstatSync(path);
if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
@ -3978,7 +4012,7 @@ class Settings {
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
}
_getValue(option, value) {
return option === undefined ? value : option;
return option !== null && option !== void 0 ? option : value;
}
}
exports.default = Settings;
@ -3992,6 +4026,7 @@ exports.default = Settings;
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Settings = exports.walkStream = exports.walkSync = exports.walk = void 0;
const async_1 = __nccwpck_require__(7523);
const stream_1 = __nccwpck_require__(6737);
const sync_1 = __nccwpck_require__(3068);
@ -4080,7 +4115,11 @@ class StreamProvider {
this._stream = new stream_1.Readable({
objectMode: true,
read: () => { },
destroy: this._reader.destroy.bind(this._reader)
destroy: () => {
if (!this._reader.isDestroyed) {
this._reader.destroy();
}
}
});
}
read() {
@ -4158,6 +4197,9 @@ class AsyncReader extends reader_1.default {
});
return this._emitter;
}
get isDestroyed() {
return this._isDestroyed;
}
destroy() {
if (this._isDestroyed) {
throw new Error('The reader is already destroyed');
@ -4194,7 +4236,7 @@ class AsyncReader extends reader_1.default {
});
}
_handleError(error) {
if (!common.isFatalError(this._settings, error)) {
if (this._isDestroyed || !common.isFatalError(this._settings, error)) {
return;
}
this._isFatalError = true;
@ -4231,6 +4273,7 @@ exports.default = AsyncReader;
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.joinPathSegments = exports.replacePathSegmentSeparator = exports.isAppliedFilter = exports.isFatalError = void 0;
function isFatalError(settings, error) {
if (settings.errorFilter === null) {
return true;
@ -4243,13 +4286,19 @@ function isAppliedFilter(filter, value) {
}
exports.isAppliedFilter = isAppliedFilter;
function replacePathSegmentSeparator(filepath, separator) {
return filepath.split(/[\\/]/).join(separator);
return filepath.split(/[/\\]/).join(separator);
}
exports.replacePathSegmentSeparator = replacePathSegmentSeparator;
function joinPathSegments(a, b, separator) {
if (a === '') {
return b;
}
/**
* The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`).
*/
if (a.endsWith(separator)) {
return a + b;
}
return a + separator + b;
}
exports.joinPathSegments = joinPathSegments;
@ -4369,7 +4418,7 @@ class Settings {
});
}
_getValue(option, value) {
return option === undefined ? value : option;
return option !== null && option !== void 0 ? option : value;
}
}
exports.default = Settings;
@ -9700,7 +9749,11 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
const fs = __nccwpck_require__(5747);
const os = __nccwpck_require__(2087);
const CPU_COUNT = os.cpus().length;
/**
* The `os.cpus` method can return zero. We expect the number of cores to be greater than zero.
* https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107
*/
const CPU_COUNT = Math.max(os.cpus().length, 1);
exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
lstat: fs.lstat,
lstatSync: fs.lstatSync,
@ -10089,10 +10142,15 @@ function fastqueue (context, worker, concurrency) {
context = null
}
if (concurrency < 1) {
throw new Error('fastqueue concurrency must be greater than 1')
}
var cache = reusify(Task)
var queueHead = null
var queueTail = null
var _running = 0
var errorHandler = null
var self = {
push: push,
@ -10109,7 +10167,8 @@ function fastqueue (context, worker, concurrency) {
unshift: unshift,
empty: noop,
kill: kill,
killAndDrain: killAndDrain
killAndDrain: killAndDrain,
error: error
}
return self
@ -10166,6 +10225,7 @@ function fastqueue (context, worker, concurrency) {
current.release = release
current.value = value
current.callback = done || noop
current.errorHandler = errorHandler
if (_running === self.concurrency || self.paused) {
if (queueTail) {
@ -10241,6 +10301,10 @@ function fastqueue (context, worker, concurrency) {
self.drain()
self.drain = noop
}
function error (handler) {
errorHandler = handler
}
}
function noop () {}
@ -10251,13 +10315,19 @@ function Task () {
this.next = null
this.release = noop
this.context = null
this.errorHandler = null
var self = this
this.worked = function worked (err, result) {
var callback = self.callback
var errorHandler = self.errorHandler
var val = self.value
self.value = null
self.callback = noop
if (self.errorHandler) {
errorHandler(err, val)
}
callback.call(self.context, err, result)
self.release(self)
}
@ -14395,6 +14465,7 @@ module.exports = reusify
/***/ 5288:
/***/ ((module) => {
/*! run-parallel. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
module.exports = runParallel
function runParallel (tasks, cb) {