@naturalcycles/nodejs-lib 12.75.0 → 12.75.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fs/del.js +4 -4
- package/dist/fs/kpy.js +2 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +3 -1
- package/package.json +2 -1
- package/src/fs/del.ts +5 -5
- package/src/fs/kpy.ts +3 -3
- package/src/index.ts +4 -0
package/dist/fs/del.js
CHANGED
|
@@ -32,9 +32,9 @@ async function del(_opt) {
|
|
|
32
32
|
console.log(opt);
|
|
33
33
|
}
|
|
34
34
|
// 1. glob only files, expand dirs, delete
|
|
35
|
-
const filenames = await (0, index_1.
|
|
35
|
+
const filenames = await (0, index_1.globby)(patterns, {
|
|
36
36
|
dot: true,
|
|
37
|
-
|
|
37
|
+
expandDirectories: true,
|
|
38
38
|
onlyFiles: true,
|
|
39
39
|
});
|
|
40
40
|
if (verbose || debug || dry) {
|
|
@@ -44,9 +44,9 @@ async function del(_opt) {
|
|
|
44
44
|
return;
|
|
45
45
|
await (0, js_lib_1.pMap)(filenames, filepath => fs.remove(filepath), { concurrency });
|
|
46
46
|
// 2. glob only dirs, expand, delete only empty!
|
|
47
|
-
let dirnames = await (0, index_1.
|
|
47
|
+
let dirnames = await (0, index_1.globby)(patterns, {
|
|
48
48
|
dot: true,
|
|
49
|
-
|
|
49
|
+
expandDirectories: true,
|
|
50
50
|
onlyDirectories: true,
|
|
51
51
|
});
|
|
52
52
|
// Add original patterns (if any of them are dirs)
|
package/dist/fs/kpy.js
CHANGED
|
@@ -11,7 +11,7 @@ const index_1 = require("../index");
|
|
|
11
11
|
async function kpy(opt) {
|
|
12
12
|
const started = Date.now();
|
|
13
13
|
kpyPrepare(opt);
|
|
14
|
-
const filenames = await (0, index_1.
|
|
14
|
+
const filenames = await (0, index_1.globby)(opt.inputPatterns, {
|
|
15
15
|
cwd: opt.baseDir,
|
|
16
16
|
dot: opt.dotfiles,
|
|
17
17
|
});
|
|
@@ -39,7 +39,7 @@ exports.kpy = kpy;
|
|
|
39
39
|
function kpySync(opt) {
|
|
40
40
|
const started = Date.now();
|
|
41
41
|
kpyPrepare(opt);
|
|
42
|
-
const filenames = index_1.
|
|
42
|
+
const filenames = index_1.globby.sync(opt.inputPatterns, {
|
|
43
43
|
cwd: opt.baseDir,
|
|
44
44
|
dot: opt.dotfiles,
|
|
45
45
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import Ajv from 'ajv';
|
|
2
2
|
import * as fastGlob from 'fast-glob';
|
|
3
3
|
import { Options as FastGlobOptions } from 'fast-glob';
|
|
4
|
+
import * as globby from 'globby';
|
|
5
|
+
import { GlobbyOptions } from 'globby';
|
|
4
6
|
import { RequestError, TimeoutError } from 'got';
|
|
5
7
|
import type { AfterResponseHook, BeforeErrorHook, BeforeRequestHook, Got } from 'got';
|
|
6
8
|
import { AnySchema, ValidationErrorItem } from 'joi';
|
|
@@ -69,5 +71,5 @@ export * from './validation/joi/joi.shared.schemas';
|
|
|
69
71
|
import { JoiValidationError, JoiValidationErrorData } from './validation/joi/joi.validation.error';
|
|
70
72
|
import { convert, getValidationResult, isValid, JoiValidationResult, undefinedIfInvalid, validate } from './validation/joi/joi.validation.util';
|
|
71
73
|
import { runScript, RunScriptOptions } from './script';
|
|
72
|
-
export type { FastGlobOptions, RunScriptOptions, JoiValidationErrorData, JoiValidationResult, ValidationErrorItem, ExtendedJoi, SchemaTyped, AnySchema, AnySchemaTyped, ArraySchemaTyped, BooleanSchemaTyped, NumberSchemaTyped, ObjectSchemaTyped, StringSchemaTyped, IDebug, IDebugger, SlackServiceCfg, SlackMessage, SlackMessageProps, SlackApiBody, SlackMessagePrefixHook, ReadableTyped, WritableTyped, TransformTyped, PipelineFromNDJsonFileOptions, PipelineToNDJsonFileOptions, TransformJsonParseOptions, TransformToNDJsonOptions, TransformMapOptions, TransformMapSyncOptions, NDJSONStreamForEachOptions, TransformOptions, TransformMultiThreadedOptions, WorkerClassInterface, WorkerInput, WorkerOutput, TableDiffOptions, InspectAnyOptions, Got, GetGotOptions, AfterResponseHook, BeforeErrorHook, BeforeRequestHook, AjvValidationOptions, AjvSchemaCfg, AjvValidationErrorData, };
|
|
73
|
-
export { fastGlob, JoiValidationError, validate, getValidationResult, isValid, undefinedIfInvalid, convert, Joi, Debug, SlackService, slackDefaultMessagePrefixHook, ndjsonStreamForEach, pipelineFromNDJsonFile, pipelineToNDJsonFile, NDJsonStats, streamToNDJsonFile, transformJsonParse, bufferReviver, transformToNDJson, transformMap, transformMapSync, transformMultiThreaded, BaseWorkerClass, tableDiff, inspectAny, inspectAnyStringifyFn, RequestError, TimeoutError, _chunkBuffer, Ajv, AjvSchema, AjvValidationError, readJsonSchemas, readAjvSchemas, runScript, };
|
|
74
|
+
export type { GlobbyOptions, FastGlobOptions, RunScriptOptions, JoiValidationErrorData, JoiValidationResult, ValidationErrorItem, ExtendedJoi, SchemaTyped, AnySchema, AnySchemaTyped, ArraySchemaTyped, BooleanSchemaTyped, NumberSchemaTyped, ObjectSchemaTyped, StringSchemaTyped, IDebug, IDebugger, SlackServiceCfg, SlackMessage, SlackMessageProps, SlackApiBody, SlackMessagePrefixHook, ReadableTyped, WritableTyped, TransformTyped, PipelineFromNDJsonFileOptions, PipelineToNDJsonFileOptions, TransformJsonParseOptions, TransformToNDJsonOptions, TransformMapOptions, TransformMapSyncOptions, NDJSONStreamForEachOptions, TransformOptions, TransformMultiThreadedOptions, WorkerClassInterface, WorkerInput, WorkerOutput, TableDiffOptions, InspectAnyOptions, Got, GetGotOptions, AfterResponseHook, BeforeErrorHook, BeforeRequestHook, AjvValidationOptions, AjvSchemaCfg, AjvValidationErrorData, };
|
|
75
|
+
export { globby, fastGlob, JoiValidationError, validate, getValidationResult, isValid, undefinedIfInvalid, convert, Joi, Debug, SlackService, slackDefaultMessagePrefixHook, ndjsonStreamForEach, pipelineFromNDJsonFile, pipelineToNDJsonFile, NDJsonStats, streamToNDJsonFile, transformJsonParse, bufferReviver, transformToNDJson, transformMap, transformMapSync, transformMultiThreaded, BaseWorkerClass, tableDiff, inspectAny, inspectAnyStringifyFn, RequestError, TimeoutError, _chunkBuffer, Ajv, AjvSchema, AjvValidationError, readJsonSchemas, readAjvSchemas, runScript, };
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runScript = exports.readAjvSchemas = exports.readJsonSchemas = exports.AjvValidationError = exports.AjvSchema = exports.Ajv = exports._chunkBuffer = exports.TimeoutError = exports.RequestError = exports.inspectAnyStringifyFn = exports.inspectAny = exports.tableDiff = exports.BaseWorkerClass = exports.transformMultiThreaded = exports.transformMapSync = exports.transformMap = exports.transformToNDJson = exports.bufferReviver = exports.transformJsonParse = exports.streamToNDJsonFile = exports.NDJsonStats = exports.pipelineToNDJsonFile = exports.pipelineFromNDJsonFile = exports.ndjsonStreamForEach = exports.slackDefaultMessagePrefixHook = exports.SlackService = exports.Debug = exports.Joi = exports.convert = exports.undefinedIfInvalid = exports.isValid = exports.getValidationResult = exports.validate = exports.JoiValidationError = exports.fastGlob = void 0;
|
|
3
|
+
exports.runScript = exports.readAjvSchemas = exports.readJsonSchemas = exports.AjvValidationError = exports.AjvSchema = exports.Ajv = exports._chunkBuffer = exports.TimeoutError = exports.RequestError = exports.inspectAnyStringifyFn = exports.inspectAny = exports.tableDiff = exports.BaseWorkerClass = exports.transformMultiThreaded = exports.transformMapSync = exports.transformMap = exports.transformToNDJson = exports.bufferReviver = exports.transformJsonParse = exports.streamToNDJsonFile = exports.NDJsonStats = exports.pipelineToNDJsonFile = exports.pipelineFromNDJsonFile = exports.ndjsonStreamForEach = exports.slackDefaultMessagePrefixHook = exports.SlackService = exports.Debug = exports.Joi = exports.convert = exports.undefinedIfInvalid = exports.isValid = exports.getValidationResult = exports.validate = exports.JoiValidationError = exports.fastGlob = exports.globby = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const ajv_1 = require("ajv");
|
|
6
6
|
exports.Ajv = ajv_1.default;
|
|
7
7
|
const fastGlob = require("fast-glob");
|
|
8
8
|
exports.fastGlob = fastGlob;
|
|
9
|
+
const globby = require("globby");
|
|
10
|
+
exports.globby = globby;
|
|
9
11
|
const got_1 = require("got");
|
|
10
12
|
Object.defineProperty(exports, "RequestError", { enumerable: true, get: function () { return got_1.RequestError; } });
|
|
11
13
|
Object.defineProperty(exports, "TimeoutError", { enumerable: true, get: function () { return got_1.TimeoutError; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturalcycles/nodejs-lib",
|
|
3
|
-
"version": "12.75.
|
|
3
|
+
"version": "12.75.1",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"prepare": "husky install",
|
|
6
6
|
"docs-serve": "vuepress dev docs",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"execa": "^5.0.0",
|
|
29
29
|
"fast-glob": "^3.2.11",
|
|
30
30
|
"fs-extra": "^10.0.0",
|
|
31
|
+
"globby": "^11.0.0",
|
|
31
32
|
"got": "^11.0.1",
|
|
32
33
|
"joi": "17.4.2",
|
|
33
34
|
"lru-cache": "^7.4.0",
|
package/src/fs/del.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { pFilter, pMap, _since } from '@naturalcycles/js-lib'
|
|
2
2
|
import * as fs from 'fs-extra'
|
|
3
3
|
import { dimGrey, yellow } from '../colors'
|
|
4
|
-
import {
|
|
4
|
+
import { globby } from '../index'
|
|
5
5
|
|
|
6
6
|
export interface DelOptions {
|
|
7
7
|
/**
|
|
@@ -58,9 +58,9 @@ export async function del(_opt: DelOptions | DelSingleOption): Promise<void> {
|
|
|
58
58
|
|
|
59
59
|
// 1. glob only files, expand dirs, delete
|
|
60
60
|
|
|
61
|
-
const filenames = await
|
|
61
|
+
const filenames = await globby(patterns, {
|
|
62
62
|
dot: true,
|
|
63
|
-
|
|
63
|
+
expandDirectories: true,
|
|
64
64
|
onlyFiles: true,
|
|
65
65
|
})
|
|
66
66
|
|
|
@@ -73,9 +73,9 @@ export async function del(_opt: DelOptions | DelSingleOption): Promise<void> {
|
|
|
73
73
|
await pMap(filenames, filepath => fs.remove(filepath), { concurrency })
|
|
74
74
|
|
|
75
75
|
// 2. glob only dirs, expand, delete only empty!
|
|
76
|
-
let dirnames = await
|
|
76
|
+
let dirnames = await globby(patterns, {
|
|
77
77
|
dot: true,
|
|
78
|
-
|
|
78
|
+
expandDirectories: true,
|
|
79
79
|
onlyDirectories: true,
|
|
80
80
|
})
|
|
81
81
|
|
package/src/fs/kpy.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as cpFile from 'cp-file'
|
|
|
4
4
|
import * as fs from 'fs-extra'
|
|
5
5
|
import * as moveFile from 'move-file'
|
|
6
6
|
import { boldWhite, dimGrey, grey, yellow } from '../colors'
|
|
7
|
-
import {
|
|
7
|
+
import { globby } from '../index'
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Everything defaults to `undefined`.
|
|
@@ -50,7 +50,7 @@ export async function kpy(opt: KpyOptions): Promise<void> {
|
|
|
50
50
|
|
|
51
51
|
kpyPrepare(opt)
|
|
52
52
|
|
|
53
|
-
const filenames = await
|
|
53
|
+
const filenames = await globby(opt.inputPatterns!, {
|
|
54
54
|
cwd: opt.baseDir,
|
|
55
55
|
dot: opt.dotfiles,
|
|
56
56
|
})
|
|
@@ -87,7 +87,7 @@ export function kpySync(opt: KpyOptions): void {
|
|
|
87
87
|
|
|
88
88
|
kpyPrepare(opt)
|
|
89
89
|
|
|
90
|
-
const filenames =
|
|
90
|
+
const filenames = globby.sync(opt.inputPatterns!, {
|
|
91
91
|
cwd: opt.baseDir,
|
|
92
92
|
dot: opt.dotfiles,
|
|
93
93
|
})
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import Ajv from 'ajv'
|
|
2
2
|
import * as fastGlob from 'fast-glob'
|
|
3
3
|
import { Options as FastGlobOptions } from 'fast-glob'
|
|
4
|
+
import * as globby from 'globby'
|
|
5
|
+
import { GlobbyOptions } from 'globby'
|
|
4
6
|
import { RequestError, TimeoutError } from 'got'
|
|
5
7
|
import type { AfterResponseHook, BeforeErrorHook, BeforeRequestHook, Got } from 'got'
|
|
6
8
|
import { AnySchema, ValidationErrorItem } from 'joi'
|
|
@@ -113,6 +115,7 @@ import {
|
|
|
113
115
|
import { runScript, RunScriptOptions } from './script'
|
|
114
116
|
|
|
115
117
|
export type {
|
|
118
|
+
GlobbyOptions,
|
|
116
119
|
FastGlobOptions,
|
|
117
120
|
RunScriptOptions,
|
|
118
121
|
JoiValidationErrorData,
|
|
@@ -162,6 +165,7 @@ export type {
|
|
|
162
165
|
}
|
|
163
166
|
|
|
164
167
|
export {
|
|
168
|
+
globby,
|
|
165
169
|
fastGlob,
|
|
166
170
|
JoiValidationError,
|
|
167
171
|
validate,
|