es-toolkit/tests/utils/createPackageTarball.ts

18 lines
434 B
TypeScript
Raw Normal View History

2024-07-24 18:15:16 +03:00
import os from 'node:os';
import path from 'node:path';
import fs from 'node:fs';
import { execa } from 'execa';
export async function createPackageTarball() {
const tmpdir = path.resolve(os.tmpdir(), '.es-toolkit');
const tarballPath = path.resolve(tmpdir, 'package.tgz');
await fs.promises.mkdir(tmpdir, { recursive: true });
await execa('yarn', ['pack', '--out', tarballPath]);
return {
path: tarballPath,
2024-08-11 04:54:13 +03:00
};
}