es-toolkit/tests/utils/createPackageTarball.ts
2024-08-11 10:54:13 +09:00

18 lines
434 B
TypeScript

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,
};
}