@dlzn-ui/node-utils 2.0.15 → 2.0.21
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/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.mjs +20 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { ProjectManifest } from '@pnpm/types';
|
|
2
2
|
|
|
3
|
+
declare function getDirectDirs(patterns: string | string[], cwd?: string | URL): Promise<string[]>;
|
|
4
|
+
declare function getDirectFiles(patterns: string | string[], cwd?: string | URL): Promise<string[]>;
|
|
5
|
+
|
|
3
6
|
type Awaitable<T> = Promise<T> | T;
|
|
4
7
|
declare function errorAndExit(err: Error): never;
|
|
5
8
|
declare function execCommand<T extends () => Awaitable<any>>(fnc: T, overrideName?: string): Promise<void>;
|
|
@@ -11,4 +14,4 @@ declare function run(command: string, cwd: string): Promise<void>;
|
|
|
11
14
|
|
|
12
15
|
declare function upperFirst(str: string): string;
|
|
13
16
|
|
|
14
|
-
export { errorAndExit, execCommand, getPackageDependencies, getPackageManifest, run, upperFirst };
|
|
17
|
+
export { errorAndExit, execCommand, getDirectDirs, getDirectFiles, getPackageDependencies, getPackageManifest, run, upperFirst };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { ProjectManifest } from '@pnpm/types';
|
|
2
2
|
|
|
3
|
+
declare function getDirectDirs(patterns: string | string[], cwd?: string | URL): Promise<string[]>;
|
|
4
|
+
declare function getDirectFiles(patterns: string | string[], cwd?: string | URL): Promise<string[]>;
|
|
5
|
+
|
|
3
6
|
type Awaitable<T> = Promise<T> | T;
|
|
4
7
|
declare function errorAndExit(err: Error): never;
|
|
5
8
|
declare function execCommand<T extends () => Awaitable<any>>(fnc: T, overrideName?: string): Promise<void>;
|
|
@@ -11,4 +14,4 @@ declare function run(command: string, cwd: string): Promise<void>;
|
|
|
11
14
|
|
|
12
15
|
declare function upperFirst(str: string): string;
|
|
13
16
|
|
|
14
|
-
export { errorAndExit, execCommand, getPackageDependencies, getPackageManifest, run, upperFirst };
|
|
17
|
+
export { errorAndExit, execCommand, getDirectDirs, getDirectFiles, getPackageDependencies, getPackageManifest, run, upperFirst };
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { basename, extname } from 'node:path';
|
|
2
|
+
import { glob } from 'tinyglobby';
|
|
1
3
|
import { performance } from 'node:perf_hooks';
|
|
2
4
|
import process from 'node:process';
|
|
3
5
|
import { styleText } from 'node:util';
|
|
@@ -5,6 +7,23 @@ import consola from 'consola';
|
|
|
5
7
|
import { readFileSync } from 'node:fs';
|
|
6
8
|
import { spawn } from 'node:child_process';
|
|
7
9
|
|
|
10
|
+
async function getDirectDirs(patterns, cwd) {
|
|
11
|
+
const result = await glob(patterns, {
|
|
12
|
+
cwd,
|
|
13
|
+
expandDirectories: false,
|
|
14
|
+
onlyDirectories: true
|
|
15
|
+
});
|
|
16
|
+
return result.map((dir) => basename(dir));
|
|
17
|
+
}
|
|
18
|
+
async function getDirectFiles(patterns, cwd) {
|
|
19
|
+
const result = await glob(patterns, {
|
|
20
|
+
cwd,
|
|
21
|
+
expandDirectories: false,
|
|
22
|
+
onlyFiles: true
|
|
23
|
+
});
|
|
24
|
+
return result.map((file) => basename(file, extname(file)));
|
|
25
|
+
}
|
|
26
|
+
|
|
8
27
|
function errorAndExit(err) {
|
|
9
28
|
consola.error(err);
|
|
10
29
|
process.exit(1);
|
|
@@ -63,4 +82,4 @@ function upperFirst(str) {
|
|
|
63
82
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
64
83
|
}
|
|
65
84
|
|
|
66
|
-
export { errorAndExit, execCommand, getPackageDependencies, getPackageManifest, run, upperFirst };
|
|
85
|
+
export { errorAndExit, execCommand, getDirectDirs, getDirectFiles, getPackageDependencies, getPackageManifest, run, upperFirst };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dlzn-ui/node-utils",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.21",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@pnpm/types": "^1101.9.0",
|
|
20
|
-
"consola": "^3.4.2"
|
|
20
|
+
"consola": "^3.4.2",
|
|
21
|
+
"tinyglobby": "^0.2.17"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
23
24
|
"rimraf": "^6.1.3",
|
|
@@ -25,7 +26,6 @@
|
|
|
25
26
|
},
|
|
26
27
|
"scripts": {
|
|
27
28
|
"build": "unbuild",
|
|
28
|
-
"clean": "rimraf dist",
|
|
29
29
|
"stub": "unbuild --stub"
|
|
30
30
|
}
|
|
31
31
|
}
|