|
1 | 1 | import path from 'node:path' |
2 | | -import { _since, UnixTimestampMillis } from '@naturalcycles/js-lib' |
| 2 | +import { _since, localTime, UnixTimestampMillis } from '@naturalcycles/js-lib' |
3 | 3 | import { boldWhite, dimGrey, grey, yellow } from '../colors/colors' |
4 | 4 | import { fastGlob, fs2 } from '../index' |
5 | 5 |
|
@@ -43,7 +43,7 @@ export interface KpyOptions { |
43 | 43 | } |
44 | 44 |
|
45 | 45 | export async function kpy(opt: KpyOptions): Promise<void> { |
46 | | - const started = Date.now() as UnixTimestampMillis |
| 46 | + const started = localTime.nowUnixMillis() |
47 | 47 |
|
48 | 48 | kpyPrepare(opt) |
49 | 49 |
|
@@ -82,7 +82,7 @@ export async function kpy(opt: KpyOptions): Promise<void> { |
82 | 82 | } |
83 | 83 |
|
84 | 84 | export function kpySync(opt: KpyOptions): void { |
85 | | - const started = Date.now() as UnixTimestampMillis |
| 85 | + const started = localTime.nowUnixMillis() |
86 | 86 |
|
87 | 87 | kpyPrepare(opt) |
88 | 88 |
|
@@ -130,6 +130,21 @@ function kpyPrepare(opt: KpyOptions): void { |
130 | 130 | } |
131 | 131 |
|
132 | 132 | fs2.ensureDir(opt.outputDir) |
| 133 | + |
| 134 | + // Expand directories (ex-globby feature), experimental! |
| 135 | + const extraPatterns: string[] = [] |
| 136 | + |
| 137 | + for (const pattern of opt.inputPatterns) { |
| 138 | + if (pattern.includes('*')) continue |
| 139 | + if (fs2.isDirectory(path.resolve(opt.baseDir, pattern))) { |
| 140 | + extraPatterns.push(`${pattern}/**`) |
| 141 | + } |
| 142 | + } |
| 143 | + |
| 144 | + if (opt.verbose) { |
| 145 | + console.log({ extraPatterns }) |
| 146 | + } |
| 147 | + opt.inputPatterns.push(...extraPatterns) |
133 | 148 | } |
134 | 149 |
|
135 | 150 | function kpyLogFilenames(opt: KpyOptions, filenames: string[]): void { |
|
0 commit comments