Lazy load tar-stream

Change-type: patch
This commit is contained in:
Pagan Gazzard 2020-08-10 12:01:55 +01:00
parent d348d9f71f
commit 497c8cd49b
2 changed files with 4 additions and 3 deletions

View File

@ -22,7 +22,7 @@ import * as path from 'path';
import type { Composition } from 'resin-compose-parse';
import type * as MultiBuild from 'resin-multibuild';
import type { Readable } from 'stream';
import * as tar from 'tar-stream';
import type { Pack } from 'tar-stream';
import { ExpectedError } from '../errors';
import { getBalenaSdk, getChalk, stripIndent } from './lazy';
import {
@ -263,6 +263,7 @@ export async function tarDirectory(
} else {
readFile = fs.readFile;
}
const tar = await import('tar-stream');
const pack = tar.pack();
const {
filteredFileList,
@ -573,7 +574,7 @@ async function performResolution(
// task.dockerfile, task.dockerfilePath,
// task.projectType, task.resolved
// This mimics what is currently done in `resin-builder`.
const clonedStream: tar.Pack = await cloneTarStream(
const clonedStream: Pack = await cloneTarStream(
buildTask.buildStream,
);
buildTask.buildStream = clonedStream;

View File

@ -17,7 +17,7 @@
import * as fs from 'fs';
import * as path from 'path';
import { Headers } from 'tar-stream';
import type { Headers } from 'tar-stream';
import { promisify } from 'util';
const statAsync = promisify(fs.stat);