Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function publish({tag, version, push, packOptions}, pack = packWithNpm) {
if (!tag) {
tag = `v${version}`;
}
const tmpRepoDir = await tmp.dirAsync();
let temporaryRemote = path.basename(tmpRepoDir);
const git = (...args) => execFileAsync('git', args);
const gitInTmpRepo = (...args) => execFileAsync('git', args, {
cwd: tmpRepoDir
});
try {
const gitInitPromise = gitInTmpRepo('init');
await pack(Object.assign({
sourceDir: process.cwd(),
targetDir: tmpRepoDir,
}, packOptions));
await gitInitPromise;