diff --git a/src/dev/build/lib/fs.ts b/src/dev/build/lib/fs.ts index 7a0fee5b64c1f..3389236c94a13 100644 --- a/src/dev/build/lib/fs.ts +++ b/src/dev/build/lib/fs.ts @@ -19,7 +19,7 @@ import fs from 'fs'; import { createHash } from 'crypto'; -import { pipeline } from 'stream'; +import { pipeline, Writable } from 'stream'; import { resolve, dirname, isAbsolute, sep } from 'path'; import { createGunzip } from 'zlib'; import { inspect, promisify } from 'util'; @@ -32,8 +32,6 @@ import deleteEmpty from 'delete-empty'; import tar, { ExtractOptions } from 'tar'; import { ToolingLog } from '@kbn/dev-utils'; -import { createMapStream } from '../../../legacy/utils'; - const pipelineAsync = promisify(pipeline); const mkdirAsync = promisify(fs.mkdir); const writeFileAsync = promisify(fs.writeFile); @@ -180,7 +178,12 @@ export async function copyAll( base: destination, dot, }), - createMapStream((file) => utimesAsync(file.path, time, time)) + new Writable({ + objectMode: true, + write(file: File, _, cb) { + utimesAsync(file.path, time, time).then(() => cb(), cb); + }, + }) ); } }